mirror of
https://github.com/YunoHost-Apps/borg_ynh.git
synced 2024-09-03 18:16:05 +02:00
Upgrade to upstream version
This commit is contained in:
parent
e6d5788297
commit
50643e260c
9 changed files with 81 additions and 31 deletions
|
@ -1,6 +1,6 @@
|
||||||
# Borg Backup App for YunoHost
|
# Borg Backup for YunoHost
|
||||||
|
|
||||||
[](https://github.com/YunoHost-Apps/borg_ynh/releases)
|
[](https://github.com/YunoHost-Apps/borg_ynh/releases)
|
||||||
[](https://github.com/YunoHost-Apps/borg_ynh/milestones)
|
[](https://github.com/YunoHost-Apps/borg_ynh/milestones)
|
||||||
[](https://dash.yunohost.org/appci/app/borg)
|
[](https://dash.yunohost.org/appci/app/borg)
|
||||||
[](https://raw.githubusercontent.com/YunoHost-Apps/borg_ynh/master/LICENSE)
|
[](https://raw.githubusercontent.com/YunoHost-Apps/borg_ynh/master/LICENSE)
|
||||||
|
|
|
@ -17,20 +17,8 @@
|
||||||
upgrade=1
|
upgrade=1
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
incorrect_path=0
|
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
change_url=0
|
change_url=0
|
||||||
;;; Levels
|
|
||||||
Level 1=auto
|
|
||||||
Level 2=auto
|
|
||||||
Level 3=auto
|
|
||||||
Level 4=na
|
|
||||||
Level 5=auto
|
|
||||||
Level 6=auto
|
|
||||||
Level 7=auto
|
|
||||||
Level 8=0
|
|
||||||
Level 9=0
|
|
||||||
Level 10=0
|
|
||||||
;;; Options
|
;;; Options
|
||||||
Email=ljf+borg_ynh@reflexlibre.net
|
Email=ljf+borg_ynh@reflexlibre.net
|
||||||
Notification=down
|
Notification=down
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "Borg Backup App",
|
"name": "Borg Backup",
|
||||||
"id": "borg",
|
"id": "borg",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Backup your server on a host server using Borg.",
|
"en": "Backup your server on a host server using Borg.",
|
||||||
"fr": "Sauvegardez votre serveur sur un serveur distant avec Borg."
|
"fr": "Sauvegardez votre serveur sur un serveur distant avec Borg."
|
||||||
},
|
},
|
||||||
"version": "1.1.13~ynh2",
|
"version": "1.1.14~ynh1",
|
||||||
"url": "https://borgbackup.readthedocs.io",
|
"url": "https://borgbackup.readthedocs.io",
|
||||||
"license": "BSD-3-Clause",
|
"license": "BSD-3-Clause",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
|
@ -15,7 +15,7 @@
|
||||||
"url": "https://reflexlibre.net"
|
"url": "https://reflexlibre.net"
|
||||||
},
|
},
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 3.5.0"
|
"yunohost": ">= 3.8.1"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [],
|
"services": [],
|
||||||
|
|
|
@ -12,7 +12,7 @@ pkg_dependencies="python3-pip python3-dev libacl1-dev libssl-dev liblz4-dev pyth
|
||||||
install_borg_with_pip () {
|
install_borg_with_pip () {
|
||||||
if [ ! -d /opt/borg-env ]; then
|
if [ ! -d /opt/borg-env ]; then
|
||||||
virtualenv --python=python3 /opt/borg-env
|
virtualenv --python=python3 /opt/borg-env
|
||||||
/opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup==1.1.13
|
/opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup==1.1.14
|
||||||
echo "#!/bin/bash
|
echo "#!/bin/bash
|
||||||
/opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg
|
/opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg
|
||||||
chmod u+x /usr/local/bin/borg
|
chmod u+x /usr/local/bin/borg
|
||||||
|
|
|
@ -18,9 +18,14 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
ynh_backup "/usr/local/bin/backup-with-$app"
|
ynh_backup "/usr/local/bin/backup-with-$app"
|
||||||
ynh_backup "/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
@ -28,3 +33,9 @@ ynh_backup "/etc/systemd/system/$app.timer"
|
||||||
ynh_backup "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
ynh_backup "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
||||||
ynh_backup "/root/.ssh/id_${app}_ed25519"
|
ynh_backup "/root/.ssh/id_${app}_ed25519"
|
||||||
ynh_backup "/root/.ssh/id_${app}_ed25519.pub"
|
ynh_backup "/root/.ssh/id_${app}_ed25519.pub"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
export app=$YNH_APP_INSTANCE_NAME
|
export app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
|
@ -27,17 +28,21 @@ ynh_export server ssh_user passphrase on_calendar conf data apps
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_save_args server ssh_user passphrase on_calendar conf data apps
|
ynh_save_args server ssh_user passphrase on_calendar conf data apps
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Installing dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
install_borg_with_pip
|
install_borg_with_pip
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE BACKUP METHODS
|
# ACTIVATE BACKUP METHODS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
mkdir -p /etc/yunohost/hooks.d/backup_method
|
mkdir -p /etc/yunohost/hooks.d/backup_method
|
||||||
mkdir -p /usr/share/yunohost/backup_method
|
mkdir -p /usr/share/yunohost/backup_method
|
||||||
|
|
||||||
|
@ -49,19 +54,28 @@ ynh_configure backup_method "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE CRON
|
# CONFIGURE CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_configure backup-with-borg "/usr/local/bin/backup-with-$app"
|
ynh_configure backup-with-borg "/usr/local/bin/backup-with-$app"
|
||||||
chmod u+x "/usr/local/bin/backup-with-$app"
|
chmod u+x "/usr/local/bin/backup-with-$app"
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
ynh_configure systemd.timer "/etc/systemd/system/$app.timer"
|
ynh_configure systemd.timer "/etc/systemd/system/$app.timer"
|
||||||
systemctl enable $app.timer
|
systemctl enable $app.timer --quiet
|
||||||
systemctl start $app.timer
|
systemctl start $app.timer
|
||||||
#yunohost service add $app.timer
|
#yunohost service add $app.timer
|
||||||
#yunohost service enable $app.timer
|
#yunohost service enable $app.timer
|
||||||
#yunohost service start $app.timer
|
#yunohost service start $app.timer
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||||
|
|
||||||
|
yunohost service add $app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERATE SSH KEY
|
# GENERATE SSH KEY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
private_key="/root/.ssh/id_${app}_ed25519"
|
private_key="/root/.ssh/id_${app}_ed25519"
|
||||||
test -f $private_key || ssh-keygen -q -t ed25519 -N "" -f $private_key
|
test -f $private_key || ssh-keygen -q -t ed25519 -N "" -f $private_key
|
||||||
|
|
||||||
|
@ -73,10 +87,10 @@ echo "You should now install the \"Borg Server\" app on $server and fill questio
|
||||||
User: ${ssh_user}
|
User: ${ssh_user}
|
||||||
Public key: $(cat ${private_key}.pub)"
|
Public key: $(cat ${private_key}.pub)"
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SEND A README FOR THE ADMIN
|
# SEND A README FOR THE ADMIN
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_OFF
|
ynh_print_OFF
|
||||||
message="You should now install the \"Borg Server\" app on $server and fill questions like this:
|
message="You should now install the \"Borg Server\" app on $server and fill questions like this:
|
||||||
User: ${ssh_user}
|
User: ${ssh_user}
|
||||||
|
@ -91,3 +105,8 @@ If you facing an issue or want to improve this app, please open a new issue in t
|
||||||
ynh_send_readme_to_admin "$message" "root"
|
ynh_send_readme_to_admin "$message" "root"
|
||||||
ynh_print_ON
|
ynh_print_ON
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Installation of $app completed" --last
|
||||||
|
|
|
@ -18,6 +18,8 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE DEPENDENCIES
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing dependencies..."
|
||||||
|
|
||||||
ynh_remove_app_dependencies
|
ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -29,3 +31,9 @@ ynh_remove_systemd_config
|
||||||
ynh_secure_remove "/etc/systemd/system/$app.timer"
|
ynh_secure_remove "/etc/systemd/system/$app.timer"
|
||||||
ynh_secure_remove "/usr/local/bin/backup-with-$app"
|
ynh_secure_remove "/usr/local/bin/backup-with-$app"
|
||||||
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
ynh_secure_remove "/etc/yunohost/hooks.d/backup_method/05-${app}_app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -19,6 +19,7 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# LOAD SETTINGS
|
# LOAD SETTINGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
@ -28,25 +29,29 @@ ssh_user=$(ynh_app_setting_get $app ssh_user)
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Reinstalling dependencies..."
|
||||||
|
|
||||||
ynh_install_app_dependencies $pkg_dependencies
|
ynh_install_app_dependencies $pkg_dependencies
|
||||||
install_borg_with_pip
|
install_borg_with_pip
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ACTIVATE BACKUP METHODS
|
# ACTIVATE BACKUP METHODS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
mkdir -p /etc/yunohost/hooks.d/backup_method
|
mkdir -p /etc/yunohost/hooks.d/backup_method
|
||||||
mkdir -p /usr/share/yunohost/backup_method
|
mkdir -p /usr/share/yunohost/backup_method
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE FILES
|
# RESTORE FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore
|
ynh_restore
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADVERTISE SERVICE IN ADMIN PANEL
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
#=================================================
|
#=================================================
|
||||||
yunohost service add $app
|
yunohost service add $app
|
||||||
systemctl enable $app.timer
|
systemctl enable $app.timer --quiet
|
||||||
systemctl start $app.timer
|
systemctl start $app.timer
|
||||||
#yunohost service add $app.timer
|
#yunohost service add $app.timer
|
||||||
#yunohost service enable $app.timer
|
#yunohost service enable $app.timer
|
||||||
|
@ -55,5 +60,11 @@ systemctl start $app.timer
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
systemctl enable $app.service
|
|
||||||
|
|
||||||
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
|
@ -39,6 +39,7 @@ ynh_check_app_version_changed
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
|
@ -46,13 +47,14 @@ ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
# restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
|
||||||
if grep "borg.timer" /etc/yunohost/services.yml > /dev/null ; then
|
if grep "borg.timer" /etc/yunohost/services.yml > /dev/null ; then
|
||||||
yunohost service remove $app.timer
|
yunohost service remove $app.timer
|
||||||
systemctl enable $app.timer
|
systemctl enable $app.timer --quiet
|
||||||
systemctl start $app.timer
|
systemctl start $app.timer
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -64,7 +66,6 @@ if is_buster; then
|
||||||
install_borg_with_pip
|
install_borg_with_pip
|
||||||
touch /opt/borg-env/buster
|
touch /opt/borg-env/buster
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -79,5 +80,17 @@ ynh_configure backup-with-borg "/usr/local/bin/backup-with-$app"
|
||||||
chmod u+x "/usr/local/bin/backup-with-$app"
|
chmod u+x "/usr/local/bin/backup-with-$app"
|
||||||
ynh_add_systemd_config
|
ynh_add_systemd_config
|
||||||
ynh_configure systemd.timer "/etc/systemd/system/$app.timer"
|
ynh_configure systemd.timer "/etc/systemd/system/$app.timer"
|
||||||
systemctl enable $app.timer
|
systemctl enable $app.timer --quiet
|
||||||
systemctl start $app.timer
|
systemctl start $app.timer
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
yunohost service add $app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# END OF SCRIPT
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||||
|
|
Loading…
Add table
Reference in a new issue