From bd4cd5353778629009cc9fad79f889bcd201bbd3 Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 27 Aug 2024 18:55:29 +0200 Subject: [PATCH 1/4] use acl, fix package_check --- scripts/_common.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index ff62b1d..9e0b90e 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,8 +18,7 @@ install_borg_with_pip() { ynh_exec_as "$app" "$venvpy" -m pip install borgbackup[pyfuse3]=="$BORG_VERSION" # Make venv accessible for every user - chmod a+rX "$install_dir" - chmod a+rX -R "$install_dir/venv" + setfacl --recursive --modify g:$ssh_user:rwX,d:g:$ssh_user:rwX } create_ssh_config() { From 4ca795e023a72af16f504ce29607d2a378feceae Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 27 Aug 2024 18:56:30 +0200 Subject: [PATCH 2/4] =?UTF-8?q?=C2=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 9e0b90e..968b8da 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -18,7 +18,7 @@ install_borg_with_pip() { ynh_exec_as "$app" "$venvpy" -m pip install borgbackup[pyfuse3]=="$BORG_VERSION" # Make venv accessible for every user - setfacl --recursive --modify g:$ssh_user:rwX,d:g:$ssh_user:rwX + setfacl --recursive --modify g:$ssh_user:rwX,d:g:$ssh_user:rwX "$install_dir" } create_ssh_config() { From be46f0c7cb4de7f172b6ecd4d31dcfcbb237956d Mon Sep 17 00:00:00 2001 From: Kayou Date: Tue, 27 Aug 2024 18:57:22 +0200 Subject: [PATCH 3/4] add acl as deps --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index dde959b..81062ea 100644 --- a/manifest.toml +++ b/manifest.toml @@ -78,6 +78,7 @@ ram.runtime = "50M" [resources.apt] packages = [ + "acl", "python3", "python3-dev", "python3-pip", From 0e420dbab5adca6644fd67a1a5c4ba961f71b7b6 Mon Sep 17 00:00:00 2001 From: Kayou Date: Fri, 30 Aug 2024 22:07:34 +0200 Subject: [PATCH 4/4] 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 #=================================================