From ade2378dffdf8dd7afb3b862976ad2a510c70ecd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 12 Aug 2024 13:03:41 +0200 Subject: [PATCH 1/6] Refactoring of borgserver, like borg_ynh, stop using /opt/borg-env and /usr/local/bin --- conf/monitor-backup | 2 -- conf/monitor-backup.cron | 2 ++ conf/monitor-backup.sh | 12 ++++++++ manifest.toml | 16 +++++++---- scripts/_common.sh | 60 +++++++++++++++++++++++++++------------- scripts/backup | 28 +++++++++++++++++-- scripts/install | 31 ++++++++------------- scripts/remove | 13 +-------- scripts/restore | 33 +++++++++------------- scripts/upgrade | 58 +++++++++++++++----------------------- tests.toml | 2 ++ 11 files changed, 142 insertions(+), 115 deletions(-) delete mode 100644 conf/monitor-backup create mode 100644 conf/monitor-backup.cron create mode 100644 conf/monitor-backup.sh diff --git a/conf/monitor-backup b/conf/monitor-backup deleted file mode 100644 index 7ecc10b..0000000 --- a/conf/monitor-backup +++ /dev/null @@ -1,2 +0,0 @@ -SHELL=/bin/bash -0 9,20 * * * root : Monitor __SSH_USER__ backup ; ALERT_DELAY="$(grep '^alert_delay: ' /etc/yunohost/apps/__APP__/settings.yml | awk -F\' '{print $2}')"; [[ $(find /home/__SSH_USER__/backup/data -follow -mtime -${ALERT_DELAY} -ls | wc -l) > 0 ]] || ( echo "No file has been backuped in /home/__SSH_USER__ since ${ALERT_DELAY} days" | mail -s "[YNH] Backup missing : __SSH_USER__" $(grep '^alert_mails: ' /etc/yunohost/apps/__APP__/settings.yml | awk '{print $2}')) diff --git a/conf/monitor-backup.cron b/conf/monitor-backup.cron new file mode 100644 index 0000000..e5fd379 --- /dev/null +++ b/conf/monitor-backup.cron @@ -0,0 +1,2 @@ +# Monitor __SSH_USER__ backup every day +0 9,20 * * * root __INSTALL_DIR__/monitor-backup.sh diff --git a/conf/monitor-backup.sh b/conf/monitor-backup.sh new file mode 100644 index 0000000..2618aa0 --- /dev/null +++ b/conf/monitor-backup.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +ALERT_DELAY="$(grep '^alert_delay: ' /etc/yunohost/apps/__APP__/settings.yml | awk -F\' '{print $2}')" + + + +if [[ $(find /home/__SSH_USER__/backup/data -follow -mtime -${ALERT_DELAY} -ls | wc -l) > 0 ]]; then + : +else + echo "No file has been backuped in /home/__SSH_USER__ since ${ALERT_DELAY} days" \ + | mail -s "[YNH] Backup missing : __SSH_USER__" $(grep '^alert_mails: ' /etc/yunohost/apps/__APP__/settings.yml | awk '{print $2}') +fi diff --git a/manifest.toml b/manifest.toml index bef8d3d..2f43d83 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "borgserver" @@ -5,7 +7,7 @@ name = "Borg Server" description.en = "Offer backup storage to a friend" description.fr = "Offrez un espace de stockage à un⋅e ami⋅e" -version = "1.2.8~ynh1" +version = "1.2.8~ynh2" maintainers = ["ljf"] @@ -67,19 +69,23 @@ ram.runtime = "50M" autoupdate.strategy = "latest_github_release" autoupdate.upstream = "https://github.com/borgbackup/borg" + [resources.system_user] + # Not really useful, but required for install_dir + + [resources.install_dir] + [resources.permissions] [resources.apt] packages = [ "python3-pip", "python3-dev", - "libacl1-dev", - "libssl-dev", - "liblz4-dev", "python3-jinja2", "python3-setuptools", "python3-venv", - "virtualenv", + "libacl1-dev", + "libssl-dev", + "liblz4-dev", "libfuse3-dev", "pkg-config", ] diff --git a/scripts/_common.sh b/scripts/_common.sh index 7151311..bf347f7 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,23 +1,45 @@ #!/bin/bash -BORG_VERSION=1.2.8 +#================================================= +# COMMON VARIABLES +#================================================= -# Install borg with pip if borg is not here -install_borg_with_pip () { - if [ -d /opt/borg-env ]; then - /opt/borg-env/bin/python /opt/borg-env/bin/pip list | grep "borgbackup *$BORG_VERSION" || ynh_secure_remove /opt/borg-env - fi - if [ ! -d /opt/borg-env ]; then - python3 -m venv /opt/borg-env - /opt/borg-env/bin/python /opt/borg-env/bin/pip install pip -U - /opt/borg-env/bin/python /opt/borg-env/bin/pip install setuptools -U - /opt/borg-env/bin/python /opt/borg-env/bin/pip install wheel -U - ynh_print_info --message="Installing/compiling borg, this may take some time..." - /opt/borg-env/bin/python /opt/borg-env/bin/pip install borgbackup[pyfuse3]==$BORG_VERSION - echo "#!/bin/bash - /opt/borg-env/bin/python /opt/borg-env/bin/borg \"\$@\"" > /usr/local/bin/borg - touch "/opt/borg-env/$(ynh_get_debian_release)" - fi - # We need this to be executable by other borg apps - chmod a+x /usr/local/bin/borg +#================================================= +# PERSONAL HELPERS +#================================================= + +install_borg_with_pip() { + ynh_exec_as "$app" python3 -m venv --upgrade "$install_dir/venv" + venvpy="$install_dir/venv/bin/python3" + + ynh_exec_as "$app" "$venvpy" -m pip install --upgrade setuptools wheel + + BORG_VERSION=$(ynh_app_upstream_version) + ynh_exec_as "$app" "$venvpy" -m pip install borgbackup[pyfuse3]=="$BORG_VERSION" } + +create_ssh_config() { + ssh_dir=$1 + repository=$2 + extra="" + if [[ -n "$quota" ]]; then + extra="--storage-quota $quota" + fi + command="borg serve $extra --restrict-to-repository $repository" + ssh_opts="command=\"$command\",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc" + + mkdir -p "$ssh_dir" + touch "$ssh_dir/authorized_keys" + echo "$ssh_opts $public_key" >> "$ssh_dir/authorized_keys" + + chown -R "$ssh_user:$ssh_user" "$ssh_dir" + chmod -R u=rwX,go=--- "$ssh_dir" +} + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= diff --git a/scripts/backup b/scripts/backup index 5a503fa..50c4e36 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,17 +1,39 @@ #!/bin/bash +#================================================= +# GENERIC START +#================================================= +# IMPORT GENERIC HELPERS +#================================================= + source /usr/share/yunohost/helpers #================================================= # DECLARE DATA AND CONF FILES TO BACKUP #================================================= ynh_print_info --message="Declaring files to be backed up..." -ynh_backup "/home/$ssh_user/.ssh" -ynh_backup "/home/$ssh_user/.nobackup" -ynh_backup "/etc/cron.d/$app" + +#================================================= +# BACKUP THE APP MAIN DIR +#================================================= + +ynh_backup --src_path="$install_dir" + +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="/home/$ssh_user/.ssh" +ynh_backup --src_path="/home/$ssh_user/.nobackup" ynh_print_info --message="Borg backup repo in /home/$ssh_user/ won't be backup to avoid backup of backup loop issue." +#================================================= +# BACKUP VARIOUS FILES +#================================================= + +ynh_backup --src_path="/etc/cron.d/$app" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 4faa57f..9343dd5 100755 --- a/scripts/install +++ b/scripts/install @@ -12,48 +12,41 @@ source /usr/share/yunohost/helpers #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THIS ARGS #================================================= -# Here is a small hack to avoid multi install CI test to fail due +# Here is a small hack to avoid multi install CI test to fail due # to same ssh_user provided if [[ "${PACKAGE_CHECK_EXEC:-}" = "1" ]] && [[ "$YNH_APP_INSTANCE_NUMBER" != "1" ]] ; then ssh_user+="$YNH_APP_INSTANCE_NUMBER" fi -ynh_system_user_exists --username=$ssh_user && ynh_die --message="This user already exists" +ynh_system_user_exists --username="$ssh_user" && ynh_die --message="This user already exists" #================================================= -# INSTALL DEPENDENCIES +# INSTALL BORG #================================================= -ynh_script_progression --message="Installing dependencies..." +ynh_script_progression --message="Installing Borg..." install_borg_with_pip #================================================= # AUTORIZE SSH FOR THIS USER #================================================= -ynh_script_progression --message="Configuring SSH public key for remote connexion..." +ynh_script_progression --message="Configuring user and SSH public key for remote connexion..." -ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app - -home=/home/$ssh_user -mkdir -p $home/.ssh -chmod o=--- $home -chown -R $ssh_user:$ssh_user $home -touch $home/.ssh/authorized_keys -extra="--storage-quota $quota" -if [ "$quota" = "" ]; then - extra="" -fi -echo "command=\"borg serve $extra --restrict-to-repository $home/backup\",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc $public_key" >> $home/.ssh/authorized_keys +ynh_system_user_create --username="$ssh_user" --home_dir="/home/$ssh_user" --use_shell --groups ssh.app # Tweak to prevent the backup of the backup itself -touch $home/.nobackup +touch "/home/$ssh_user/.nobackup" + +create_ssh_config "/home/$ssh_user/.ssh" "/home/$ssh_user/backup" #================================================= # SETUP CRON #================================================= ynh_script_progression --message="Configuring cron to monitor backup..." -ynh_add_config --template="monitor-backup" --destination="/etc/cron.d/$app" +ynh_add_config --template="monitor-backup.cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="monitor-backup.sh" --destination="$install_dir/monitor-backup.sh" +chmod +x "$install_dir/monitor-backup.sh" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index d907141..ed76711 100755 --- a/scripts/remove +++ b/scripts/remove @@ -9,24 +9,13 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." - -# Remove borg if we are removing the last borg app on the system -if [ "$(yunohost app list | grep "id: borg" | wc -l)" == "1" ] ; then - ynh_secure_remove "/opt/borg-env" - ynh_secure_remove "/usr/local/bin/borg" -fi - #================================================= # REMOVE USER BUT KEEP FILES #================================================= # We keep files cause we don't know what the user want to do about # backups stored in the home directory -ynh_system_user_delete --username=$ssh_user +ynh_system_user_delete --username="$ssh_user" #================================================= # REMOVE CRON FILES diff --git a/scripts/restore b/scripts/restore index c176e72..a352d10 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,35 +10,28 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= -# INSTALL DEPENDENCIES +# RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Reinstalling borg env..." +ynh_script_progression --message="Restoring the app main directory..." --weight=1 -install_borg_with_pip +ynh_restore_file --origin_path="$install_dir" #================================================= -# CREATE SSH USER USED BY BORG +# RESTORE THE DATA DIRECTORY #================================================= -ynh_script_progression --message="Making sure SSH user exists with appropriate permissions..." +ynh_script_progression --message="Restoring the user and SSH configuration..." --weight=1 -ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app +ynh_system_user_create --username="$ssh_user" --home_dir="/home/$ssh_user" --use_shell --groups ssh.app -home=/home/$ssh_user -mkdir -p $home/.ssh -chmod o=--- $home -extra="--storage-quota $quota" -if [ "$quota" = "" ]; then - extra="" -fi -echo "command=\"borg serve $extra --restrict-to-repository $home/backup\",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc $public_key" >> $home/.ssh/authorized_keys -chown -R $ssh_user:$ssh_user $home +ynh_restore_file --origin_path="/home/$ssh_user/.ssh" +ynh_restore_file --origin_path="/home/$ssh_user/.nobackup" -# Tweak to prevent the backup of the backup itself -touch $home/.nobackup +#================================================= +# RESTORE SYSTEM CONFIGURATIONS +#================================================= +ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 - -# Actual restore of ...? -ynh_restore +ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # END OF SCRIPT diff --git a/scripts/upgrade b/scripts/upgrade index 4546a08..caed06b 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,24 +9,25 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK IF AN UPGRADE IS NEEDED -#================================================= - -ynh_check_app_version_changed - #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= ynh_script_progression --message="Ensuring downward compatibility..." +# Remove legacy stuff if [ -f "/etc/apt/sources.list.d/$app-stretch-backports.list" ]; then - rm -f /etc/apt/sources.list.d/$app-stretch-backports.list - install_borg_with_pip + ynh_secure_remove "/etc/apt/sources.list.d/$app-stretch-backports.list" fi if [ -f "/etc/yunohost/hooks.d/backup/17-data_home" ]; then - ynh_secure_remove /etc/yunohost/hooks.d/backup/17-data_home + ynh_secure_remove "/etc/yunohost/hooks.d/backup/17-data_home" +fi + +# Clear legacy stuff +if [ -d /opt/borg-env ]; then + ynh_secure_remove --file="/opt/borg-env" + ynh_secure_remove --file="/usr/local/bin/borg" + ynh_secure_remove --file="/usr/local/bin/backup-with-borg" fi # Fix broken value ssh_user that mistakenly got replaced by the public key in previous versions... @@ -34,30 +35,23 @@ fi if echo "$ssh_user" | grep -q ' '; then ssh_user=$(grep "$ssh_user" /home/*/.ssh/authorized_keys | grep borg | cut -d/ -f3) [ -n "$ssh_user" ] || ynh_die "Unable to retrieve ssh_user please fix /etc/yunohost/apps/$app/settings.yml manually :( !" - ynh_app_setting_set --app=$app --key=ssh_user --value="$ssh_user" + ynh_app_setting_set --app="$app" --key=ssh_user --value="$ssh_user" fi if echo "$public_key" | grep -q -v ' '; then - ynh_app_setting_set --app=$app --key=public_key --value="$(grep -Po 'no-user-rc \K.*$' /home/$ssh_user/.ssh/authorized_keys)" + ynh_app_setting_set --app="$app" --key=public_key --value="$(grep -Po 'no-user-rc \K.*$' "/home/$ssh_user/.ssh/authorized_keys")" fi # Alert delay and alert mail missing if [ -z "${alert_delay:-}" ]; then - ynh_app_setting_set --app=$app --key=alert_delay --value=1 - ynh_app_setting_set --app=$app --key=alert_mails --value="root" -fi - -# Reinstall borg if debian change of major version -if [ ! -f "/opt/borg-env/$(ynh_get_debian_release)" ] ; then - ynh_secure_remove /opt/borg-env + ynh_app_setting_set --app="$app" --key=alert_delay --value="1" + ynh_app_setting_set --app="$app" --key=alert_mails --value="root" fi #================================================= -# SPECIFIC UPGRADE +# UPGRADE BORG #================================================= -# Upgrade borgbackup -#================================================= -ynh_script_progression --message="Upgrading borgbackup..." --weight=1 +ynh_script_progression --message="Upgrading Borg..." --weight=1 install_borg_with_pip @@ -66,27 +60,21 @@ install_borg_with_pip #================================================= ynh_script_progression --message="Making sure SSH user exists with appropriate permissions..." -ynh_system_user_create --username=$ssh_user --home_dir=/home/$ssh_user --use_shell --groups ssh.app - -home=/home/$ssh_user -mkdir -p $home/.ssh -chmod o=--- $home -extra="--storage-quota $quota" -if [ "$quota" = "" ]; then - extra="" -fi -echo "command=\"borg serve $extra --restrict-to-repository $home/backup\",no-pty,no-agent-forwarding,no-port-forwarding,no-X11-forwarding,no-user-rc $public_key" >> $home/.ssh/authorized_keys -chown -R $ssh_user:$ssh_user $home +ynh_system_user_create --username="$ssh_user" --home_dir="/home/$ssh_user" --use_shell --groups ssh.app # Tweak to prevent the backup of the backup itself -touch $home/.nobackup +touch "/home/$ssh_user/.nobackup" + +create_ssh_config "/home/$ssh_user/.ssh" "/home/$ssh_user/backup" #================================================= # SETUP CRON #================================================= ynh_script_progression --message="Configuring cron to monitor backup..." -ynh_add_config --template="monitor-backup" --destination="/etc/cron.d/$app" +ynh_add_config --template="monitor-backup.cron" --destination="/etc/cron.d/$app" +ynh_add_config --template="monitor-backup.sh" --destination="$install_dir/monitor-backup.sh" +chmod +x "$install_dir/monitor-backup.sh" #================================================= # END OF SCRIPT diff --git a/tests.toml b/tests.toml index faaf6c7..08e4328 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default] From 1993bf43de309334c5e2d6cc07ce4c0e50bfc39d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 12 Aug 2024 13:09:28 +0200 Subject: [PATCH 2/6] Add test upgrade from for refactoring --- tests.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests.toml b/tests.toml index 08e4328..2512755 100644 --- a/tests.toml +++ b/tests.toml @@ -9,3 +9,5 @@ test_format = 1.0 args.alert_delay = 1 args.alert_mails = "sam@domain.tld" args.quota = "1G" + + test_upgrade_from.4c8c3cabad44a45e7df0d8ddd61a87889a3d4fa3.name = "Before refactoring" From 840b7f47587e26d9489d033770a9d96318272c17 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Mon, 12 Aug 2024 11:10:20 +0000 Subject: [PATCH 3/6] Auto-update READMEs --- README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_id.md | 2 +- README_zh_Hans.md | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 13cfaa5..4ba608d 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Shipped version:** 1.2.8~ynh1 +**Shipped version:** 1.2.8~ynh2 ## Documentation and resources - Official app website: diff --git a/README_es.md b/README_es.md index 54afc3b..70047d4 100644 --- a/README_es.md +++ b/README_es.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Versión actual:** 1.2.8~ynh1 +**Versión actual:** 1.2.8~ynh2 ## Documentaciones y recursos - Sitio web oficial: diff --git a/README_eu.md b/README_eu.md index 1cb9735..496648e 100644 --- a/README_eu.md +++ b/README_eu.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Paketatutako bertsioa:** 1.2.8~ynh1 +**Paketatutako bertsioa:** 1.2.8~ynh2 ## Dokumentazioa eta baliabideak - Aplikazioaren webgune ofiziala: diff --git a/README_fr.md b/README_fr.md index a4b95c3..1a0841b 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Version incluse :** 1.2.8~ynh1 +**Version incluse :** 1.2.8~ynh2 ## Documentations et ressources - Site officiel de l’app : diff --git a/README_gl.md b/README_gl.md index cdfa688..de857cd 100644 --- a/README_gl.md +++ b/README_gl.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Versión proporcionada:** 1.2.8~ynh1 +**Versión proporcionada:** 1.2.8~ynh2 ## Documentación e recursos - Web oficial da app: diff --git a/README_id.md b/README_id.md index 9b78739..fc93daf 100644 --- a/README_id.md +++ b/README_id.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Versi terkirim:** 1.2.8~ynh1 +**Versi terkirim:** 1.2.8~ynh2 ## Dokumentasi dan sumber daya - Website aplikasi resmi: diff --git a/README_zh_Hans.md b/README_zh_Hans.md index af9fb07..67d07d9 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**分发版本:** 1.2.8~ynh1 +**分发版本:** 1.2.8~ynh2 ## 文档与资源 - 官方应用网站: From 677a9cca66a5e768a11d6c28698c3e1c5889c28d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Mon, 12 Aug 2024 13:35:02 +0200 Subject: [PATCH 4/6] Fix: mkdir home --- scripts/install | 3 +++ scripts/restore | 3 +++ scripts/upgrade | 3 +++ 3 files changed, 9 insertions(+) diff --git a/scripts/install b/scripts/install index 9343dd5..8a8fc52 100755 --- a/scripts/install +++ b/scripts/install @@ -33,6 +33,9 @@ install_borg_with_pip ynh_script_progression --message="Configuring user and SSH public key for remote connexion..." ynh_system_user_create --username="$ssh_user" --home_dir="/home/$ssh_user" --use_shell --groups ssh.app +mkdir -p "/home/$ssh_user" +chmod 700 "/home/$ssh_user" +chown "$ssh_user" "/home/$ssh_user" # Tweak to prevent the backup of the backup itself touch "/home/$ssh_user/.nobackup" diff --git a/scripts/restore b/scripts/restore index a352d10..c4163b2 100755 --- a/scripts/restore +++ b/scripts/restore @@ -22,6 +22,9 @@ ynh_restore_file --origin_path="$install_dir" ynh_script_progression --message="Restoring the user and SSH configuration..." --weight=1 ynh_system_user_create --username="$ssh_user" --home_dir="/home/$ssh_user" --use_shell --groups ssh.app +mkdir -p "/home/$ssh_user" +chmod 700 "/home/$ssh_user" +chown "$ssh_user" "/home/$ssh_user" ynh_restore_file --origin_path="/home/$ssh_user/.ssh" ynh_restore_file --origin_path="/home/$ssh_user/.nobackup" diff --git a/scripts/upgrade b/scripts/upgrade index caed06b..52b3813 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -61,6 +61,9 @@ install_borg_with_pip ynh_script_progression --message="Making sure SSH user exists with appropriate permissions..." ynh_system_user_create --username="$ssh_user" --home_dir="/home/$ssh_user" --use_shell --groups ssh.app +mkdir -p "/home/$ssh_user" +chmod 700 "/home/$ssh_user" +chown "$ssh_user" "/home/$ssh_user" # Tweak to prevent the backup of the backup itself touch "/home/$ssh_user/.nobackup" From 85601b1b1a3cbee948175fb07259cf111c4a2319 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 14 Aug 2024 10:33:27 +0000 Subject: [PATCH 5/6] Bump package revision --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 2f43d83..57ec46c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Borg Server" description.en = "Offer backup storage to a friend" description.fr = "Offrez un espace de stockage à un⋅e ami⋅e" -version = "1.2.8~ynh2" +version = "1.2.8~ynh3" maintainers = ["ljf"] From 30f9612fb461b5b0ca5651ab7cbed8f74f1b8a5f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Wed, 14 Aug 2024 10:33:31 +0000 Subject: [PATCH 6/6] Auto-update READMEs --- ALL_README.md | 1 + README.md | 2 +- README_es.md | 2 +- README_eu.md | 2 +- README_fr.md | 2 +- README_gl.md | 2 +- README_id.md | 2 +- README_ru.md | 45 +++++++++++++++++++++++++++++++++++++++++++++ README_zh_Hans.md | 2 +- 9 files changed, 53 insertions(+), 7 deletions(-) create mode 100644 README_ru.md diff --git a/ALL_README.md b/ALL_README.md index 4ed64dd..e3c80d2 100644 --- a/ALL_README.md +++ b/ALL_README.md @@ -6,4 +6,5 @@ - [Lire le README en français](README_fr.md) - [Le o README en galego](README_gl.md) - [Baca README dalam bahasa bahasa Indonesia](README_id.md) +- [Прочитать README на русский](README_ru.md) - [阅读中文(简体)的 README](README_zh_Hans.md) diff --git a/README.md b/README.md index 4ba608d..41b58b3 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Shipped version:** 1.2.8~ynh2 +**Shipped version:** 1.2.8~ynh3 ## Documentation and resources - Official app website: diff --git a/README_es.md b/README_es.md index 70047d4..690095d 100644 --- a/README_es.md +++ b/README_es.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Versión actual:** 1.2.8~ynh2 +**Versión actual:** 1.2.8~ynh3 ## Documentaciones y recursos - Sitio web oficial: diff --git a/README_eu.md b/README_eu.md index 496648e..8e7352b 100644 --- a/README_eu.md +++ b/README_eu.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Paketatutako bertsioa:** 1.2.8~ynh2 +**Paketatutako bertsioa:** 1.2.8~ynh3 ## Dokumentazioa eta baliabideak - Aplikazioaren webgune ofiziala: diff --git a/README_fr.md b/README_fr.md index 1a0841b..ec4350a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Version incluse :** 1.2.8~ynh2 +**Version incluse :** 1.2.8~ynh3 ## Documentations et ressources - Site officiel de l’app : diff --git a/README_gl.md b/README_gl.md index de857cd..3b0c4d2 100644 --- a/README_gl.md +++ b/README_gl.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Versión proporcionada:** 1.2.8~ynh2 +**Versión proporcionada:** 1.2.8~ynh3 ## Documentación e recursos - Web oficial da app: diff --git a/README_id.md b/README_id.md index fc93daf..4309d14 100644 --- a/README_id.md +++ b/README_id.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**Versi terkirim:** 1.2.8~ynh2 +**Versi terkirim:** 1.2.8~ynh3 ## Dokumentasi dan sumber daya - Website aplikasi resmi: diff --git a/README_ru.md b/README_ru.md new file mode 100644 index 0000000..b8cd6f0 --- /dev/null +++ b/README_ru.md @@ -0,0 +1,45 @@ + + +# Borg Server для YunoHost + +[![Уровень интеграции](https://dash.yunohost.org/integration/borgserver.svg)](https://ci-apps.yunohost.org/ci/apps/borgserver/) ![Состояние работы](https://ci-apps.yunohost.org/ci/badges/borgserver.status.svg) ![Состояние сопровождения](https://ci-apps.yunohost.org/ci/badges/borgserver.maintain.svg) + +[![Установите Borg Server с YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=borgserver) + +*[Прочтите этот README на других языках.](./ALL_README.md)* + +> *Этот пакет позволяет Вам установить Borg Server быстро и просто на YunoHost-сервер.* +> *Если у Вас нет YunoHost, пожалуйста, посмотрите [инструкцию](https://yunohost.org/install), чтобы узнать, как установить его.* + +## Обзор + +Setup a storage space to be used for backup using Borg + +This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. + + +**Поставляемая версия:** 1.2.8~ynh3 +## Документация и ресурсы + +- Официальный веб-сайт приложения: +- Официальная документация администратора: +- Репозиторий кода главной ветки приложения: +- Магазин YunoHost: +- Сообщите об ошибке: + +## Информация для разработчиков + +Пришлите Ваш запрос на слияние в [ветку `testing`](https://github.com/YunoHost-Apps/borgserver_ynh/tree/testing). + +Чтобы попробовать ветку `testing`, пожалуйста, сделайте что-то вроде этого: + +```bash +sudo yunohost app install https://github.com/YunoHost-Apps/borgserver_ynh/tree/testing --debug +или +sudo yunohost app upgrade borgserver -u https://github.com/YunoHost-Apps/borgserver_ynh/tree/testing --debug +``` + +**Больше информации о пакетировании приложений:** diff --git a/README_zh_Hans.md b/README_zh_Hans.md index 67d07d9..5b6a3a6 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -21,7 +21,7 @@ Setup a storage space to be used for backup using Borg This app is the "server" part, meant to be installed on the machine providing the backup storage. It is designed to work in combination with the [borg 'client' app](https://apps.yunohost.org/app/borg) installed on a diffent machine. -**分发版本:** 1.2.8~ynh2 +**分发版本:** 1.2.8~ynh3 ## 文档与资源 - 官方应用网站: