From 0e420dbab5adca6644fd67a1a5c4ba961f71b7b6 Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 30 Aug 2024 22:07:34 +0200 Subject: [PATCH] create user before installing borg --- scripts/_common.sh | 2 +- scripts/install | 14 +++++++------- scripts/restore | 14 +++++++------- scripts/upgrade | 14 +++++++------- 4 files changed, 22 insertions(+), 22 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 968b8da..5de1c05 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -17,7 +17,7 @@ install_borg_with_pip() { BORG_VERSION=$(ynh_app_upstream_version) ynh_exec_as "$app" "$venvpy" -m pip install borgbackup[pyfuse3]=="$BORG_VERSION" - # Make venv accessible for every user + # Make venv accessible for ssh_user setfacl --recursive --modify g:$ssh_user:rwX,d:g:$ssh_user:rwX "$install_dir" } diff --git a/scripts/install b/scripts/install index 8a8fc52..06e77a8 100755 --- a/scripts/install +++ b/scripts/install @@ -20,13 +20,6 @@ fi ynh_system_user_exists --username="$ssh_user" && ynh_die --message="This user already exists" -#================================================= -# INSTALL BORG -#================================================= -ynh_script_progression --message="Installing Borg..." - -install_borg_with_pip - #================================================= # AUTORIZE SSH FOR THIS USER #================================================= @@ -42,6 +35,13 @@ touch "/home/$ssh_user/.nobackup" create_ssh_config "/home/$ssh_user/.ssh" "/home/$ssh_user/backup" +#================================================= +# INSTALL BORG +#================================================= +ynh_script_progression --message="Installing Borg..." + +install_borg_with_pip + #================================================= # SETUP CRON #================================================= diff --git a/scripts/restore b/scripts/restore index c4163b2..93ae944 100755 --- a/scripts/restore +++ b/scripts/restore @@ -9,13 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 - -ynh_restore_file --origin_path="$install_dir" - #================================================= # RESTORE THE DATA DIRECTORY #================================================= @@ -29,6 +22,13 @@ chown "$ssh_user" "/home/$ssh_user" ynh_restore_file --origin_path="/home/$ssh_user/.ssh" ynh_restore_file --origin_path="/home/$ssh_user/.nobackup" +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=1 + +ynh_restore_file --origin_path="$install_dir" + #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 52b3813..3cab735 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -48,13 +48,6 @@ if [ -z "${alert_delay:-}" ]; then ynh_app_setting_set --app="$app" --key=alert_mails --value="root" fi -#================================================= -# UPGRADE BORG -#================================================= -ynh_script_progression --message="Upgrading Borg..." --weight=1 - -install_borg_with_pip - #================================================= # AUTORIZE SSH FOR THIS USER #================================================= @@ -70,6 +63,13 @@ touch "/home/$ssh_user/.nobackup" create_ssh_config "/home/$ssh_user/.ssh" "/home/$ssh_user/backup" +#================================================= +# UPGRADE BORG +#================================================= +ynh_script_progression --message="Upgrading Borg..." --weight=1 + +install_borg_with_pip + #================================================= # SETUP CRON #=================================================