diff --git a/README.md b/README.md index b8c919c..8a3c1c1 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ It shall NOT be edited by hand. # Borg Backup for YunoHost -[![Integration level](https://dash.yunohost.org/integration/borg.svg)](https://dash.yunohost.org/appci/app/borg) ![Working status](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/borg.svg)](https://ci-apps.yunohost.org/ci/apps/borg/) ![Working status](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) [![Install Borg Backup with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=borg) @@ -22,7 +22,7 @@ This app is the "client" part, meant to be installed on the server to be backed ### Features -- Backup on a remote machine, in comination with the [borg server app](https://apps.yunohost.org/app/borgserver) +- Backup on a remote machine, in combination with the [borg server app](https://apps.yunohost.org/app/borgserver) - ... or on a [commercial borg service](https://www.borgbackup.org/support/commercial.html) - Backups are encrypted (the remote server can't read the content) and deduplicated (optimize space) - Backups are ran automatically, you can choose when and at which frequency @@ -34,7 +34,7 @@ This app is the "client" part, meant to be installed on the server to be backed Maybe counter-intuitively, you should *first* install this app (`borg_ynh`) and *then* (`borgserver_ynh`) on the other machine. In fact, at the end of the install of `borg_ynh`, you will be provided with the info, in particular the SSH public key, to be used to setup `borgserver_ynh` on the other 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 097e3cd..409719c 100644 --- a/README_es.md +++ b/README_es.md @@ -5,7 +5,7 @@ No se debe editar a mano. # Borg Backup para Yunohost -[![Nivel de integración](https://dash.yunohost.org/integration/borg.svg)](https://dash.yunohost.org/appci/app/borg) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) +[![Nivel de integración](https://dash.yunohost.org/integration/borg.svg)](https://ci-apps.yunohost.org/ci/apps/borg/) ![Estado funcional](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Estado En Mantención](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) [![Instalar Borg Backup con Yunhost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=borg) @@ -22,7 +22,7 @@ This app is the "client" part, meant to be installed on the server to be backed ### Features -- Backup on a remote machine, in comination with the [borg server app](https://apps.yunohost.org/app/borgserver) +- Backup on a remote machine, in combination with the [borg server app](https://apps.yunohost.org/app/borgserver) - ... or on a [commercial borg service](https://www.borgbackup.org/support/commercial.html) - Backups are encrypted (the remote server can't read the content) and deduplicated (optimize space) - Backups are ran automatically, you can choose when and at which frequency @@ -34,7 +34,7 @@ This app is the "client" part, meant to be installed on the server to be backed Maybe counter-intuitively, you should *first* install this app (`borg_ynh`) and *then* (`borgserver_ynh`) on the other machine. In fact, at the end of the install of `borg_ynh`, you will be provided with the info, in particular the SSH public key, to be used to setup `borgserver_ynh` on the other 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 4ca632f..b4b35a1 100644 --- a/README_eu.md +++ b/README_eu.md @@ -5,7 +5,7 @@ EZ editatu eskuz. # Borg Backup YunoHost-erako -[![Integrazio maila](https://dash.yunohost.org/integration/borg.svg)](https://dash.yunohost.org/appci/app/borg) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) +[![Integrazio maila](https://dash.yunohost.org/integration/borg.svg)](https://ci-apps.yunohost.org/ci/apps/borg/) ![Funtzionamendu egoera](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Mantentze egoera](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) [![Instalatu Borg Backup YunoHost-ekin](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=borg) @@ -22,7 +22,7 @@ This app is the "client" part, meant to be installed on the server to be backed ### Features -- Backup on a remote machine, in comination with the [borg server app](https://apps.yunohost.org/app/borgserver) +- Backup on a remote machine, in combination with the [borg server app](https://apps.yunohost.org/app/borgserver) - ... or on a [commercial borg service](https://www.borgbackup.org/support/commercial.html) - Backups are encrypted (the remote server can't read the content) and deduplicated (optimize space) - Backups are ran automatically, you can choose when and at which frequency @@ -34,7 +34,7 @@ This app is the "client" part, meant to be installed on the server to be backed Maybe counter-intuitively, you should *first* install this app (`borg_ynh`) and *then* (`borgserver_ynh`) on the other machine. In fact, at the end of the install of `borg_ynh`, you will be provided with the info, in particular the SSH public key, to be used to setup `borgserver_ynh` on the other 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 494ac91..f2439c1 100644 --- a/README_fr.md +++ b/README_fr.md @@ -5,7 +5,7 @@ Il NE doit PAS être modifié à la main. # Borg Backup pour YunoHost -[![Niveau d’intégration](https://dash.yunohost.org/integration/borg.svg)](https://dash.yunohost.org/appci/app/borg) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) +[![Niveau d’intégration](https://dash.yunohost.org/integration/borg.svg)](https://ci-apps.yunohost.org/ci/apps/borg/) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) [![Installer Borg Backup avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=borg) @@ -22,7 +22,7 @@ This app is the "client" part, meant to be installed on the server to be backed ### Features -- Backup on a remote machine, in comination with the [borg server app](https://apps.yunohost.org/app/borgserver) +- Backup on a remote machine, in combination with the [borg server app](https://apps.yunohost.org/app/borgserver) - ... or on a [commercial borg service](https://www.borgbackup.org/support/commercial.html) - Backups are encrypted (the remote server can't read the content) and deduplicated (optimize space) - Backups are ran automatically, you can choose when and at which frequency @@ -34,7 +34,7 @@ This app is the "client" part, meant to be installed on the server to be backed Maybe counter-intuitively, you should *first* install this app (`borg_ynh`) and *then* (`borgserver_ynh`) on the other machine. In fact, at the end of the install of `borg_ynh`, you will be provided with the info, in particular the SSH public key, to be used to setup `borgserver_ynh` on the other 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 8b4dc22..816c7f1 100644 --- a/README_gl.md +++ b/README_gl.md @@ -5,7 +5,7 @@ NON debe editarse manualmente. # Borg Backup para YunoHost -[![Nivel de integración](https://dash.yunohost.org/integration/borg.svg)](https://dash.yunohost.org/appci/app/borg) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) +[![Nivel de integración](https://dash.yunohost.org/integration/borg.svg)](https://ci-apps.yunohost.org/ci/apps/borg/) ![Estado de funcionamento](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![Estado de mantemento](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) [![Instalar Borg Backup con YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=borg) @@ -22,7 +22,7 @@ This app is the "client" part, meant to be installed on the server to be backed ### Features -- Backup on a remote machine, in comination with the [borg server app](https://apps.yunohost.org/app/borgserver) +- Backup on a remote machine, in combination with the [borg server app](https://apps.yunohost.org/app/borgserver) - ... or on a [commercial borg service](https://www.borgbackup.org/support/commercial.html) - Backups are encrypted (the remote server can't read the content) and deduplicated (optimize space) - Backups are ran automatically, you can choose when and at which frequency @@ -34,7 +34,7 @@ This app is the "client" part, meant to be installed on the server to be backed Maybe counter-intuitively, you should *first* install this app (`borg_ynh`) and *then* (`borgserver_ynh`) on the other machine. In fact, at the end of the install of `borg_ynh`, you will be provided with the info, in particular the SSH public key, to be used to setup `borgserver_ynh` on the other 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_zh_Hans.md b/README_zh_Hans.md index ae401a3..9c4e690 100644 --- a/README_zh_Hans.md +++ b/README_zh_Hans.md @@ -5,7 +5,7 @@ # YunoHost 上的 Borg Backup -[![集成程度](https://dash.yunohost.org/integration/borg.svg)](https://dash.yunohost.org/appci/app/borg) ![工作状态](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) +[![集成程度](https://dash.yunohost.org/integration/borg.svg)](https://ci-apps.yunohost.org/ci/apps/borg/) ![工作状态](https://ci-apps.yunohost.org/ci/badges/borg.status.svg) ![维护状态](https://ci-apps.yunohost.org/ci/badges/borg.maintain.svg) [![使用 YunoHost 安装 Borg Backup](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=borg) @@ -22,7 +22,7 @@ This app is the "client" part, meant to be installed on the server to be backed ### Features -- Backup on a remote machine, in comination with the [borg server app](https://apps.yunohost.org/app/borgserver) +- Backup on a remote machine, in combination with the [borg server app](https://apps.yunohost.org/app/borgserver) - ... or on a [commercial borg service](https://www.borgbackup.org/support/commercial.html) - Backups are encrypted (the remote server can't read the content) and deduplicated (optimize space) - Backups are ran automatically, you can choose when and at which frequency @@ -34,7 +34,7 @@ This app is the "client" part, meant to be installed on the server to be backed Maybe counter-intuitively, you should *first* install this app (`borg_ynh`) and *then* (`borgserver_ynh`) on the other machine. In fact, at the end of the install of `borg_ynh`, you will be provided with the info, in particular the SSH public key, to be used to setup `borgserver_ynh` on the other machine. -**分发版本:** 1.2.8~ynh1 +**分发版本:** 1.2.8~ynh2 ## 文档与资源 - 官方应用网站: diff --git a/conf/backup-with-borg b/conf/backup-with-borg index 0912891..466edd6 100644 --- a/conf/backup-with-borg +++ b/conf/backup-with-borg @@ -60,7 +60,7 @@ for application in $(sudo ls /etc/yunohost/apps/); do done #========================================================= -# SEND MAIL TO NOTIFY SUCCED OR FAILED OPERATIONS +# SEND MAIL TO NOTIFY ABOUT SUCCEEDED OR FAILED OPERATIONS #========================================================= partial_errors="$(cat "$log_file" | grep -E "Error|Skipped")" @@ -79,9 +79,9 @@ else fi if [[ -n "$errors" && $mailalert != "never" ]]; then - cat <(echo -e "$errors\n\n\n") "$log_file" "$err_file" | mail -s "[borg] Backup failed from $domain onto $repository" root + cat <(echo -e "$errors\n\n\n") "$log_file" "$err_file" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "[borg] Backup failed from $domain onto $repository" root exit 1 elif [ "$mailalert" == "always" ]; then - cat "$log_file" | mail -s "[borg] Backup succeed from $domain onto $repository" root + cat "$log_file" | mail -a "Content-Type: text/plain; charset=UTF-8" -s "[borg] Backup succeeded from $domain onto $repository" root exit 0 fi diff --git a/conf/backup_method b/conf/backup_method index 0d9540f..29a3980 100644 --- a/conf/backup_method +++ b/conf/backup_method @@ -5,7 +5,8 @@ borg="__INSTALL_DIR__/venv/bin/borg" app="__APP__" BORG_PASSPHRASE="$(yunohost app setting "$app" passphrase)" -repo="$(yunohost app setting "$app" repository)" #$4 +BORG_REPO="$(yunohost app setting "$app" repository)" +BORG_LOGGING_CONF="__INSTALL_DIR__/logging.conf" if ssh-keygen -F "__SERVER__" >/dev/null ; then BORG_RSH="ssh -i /root/.ssh/id_${app}_ed25519 -oStrictHostKeyChecking=yes " @@ -17,59 +18,52 @@ do_need_mount() { true } -LOGFILE=/var/log/backup_borg.err -log_with_timestamp() { - sed -e "s/^/[$(date +"%Y-%m-%d_%H:%M:%S")] /" | tee -a $LOGFILE -} - do_backup() { export BORG_PASSPHRASE + export BORG_REPO export BORG_RSH + export BORG_LOGGING_CONF export BORG_RELOCATED_REPO_ACCESS_IS_OK=yes work_dir="$1" name="$2" - repo="$3" - size="$4" - description="$5" - current_date=$(date +"%Y-%m-%d_%H:%M") - pushd "$work_dir" + size="$3" + description="$4" set +e - if "$borg" init -e repokey "$repo" ; then + if ! "$borg" list > /dev/null 2>&1; then + "$borg" init -e repokey # human_size=`echo $size | awk '{ suffix=" KMGT"; for(i=1; $1>1024 && i < length(suffix); i++) $1/=1024; print int($1) substr(suffix, i, 1), $3; }'` # Speed in Kbps # speed=1000 # evaluated_time=$(($size / ($speed * 1000 / 8) / 3600)) echo "Hello, -Your first backup on $repo is starting. +Your first backup on $BORG_REPO is starting. This is an automated message from your beloved YunoHost server." | /usr/bin/mail.mailutils -a "Content-Type: text/plain; charset=UTF-8" -s "[YNH] First backup is starting" "root" fi set -e - "$borg" create "$repo::_${name}-${current_date}" ./ 2>&1 >/dev/null | log_with_timestamp - popd + # About the {now} placeholder: + # https://borgbackup.readthedocs.io/en/stable/usage/create.html#description + # In the archive name, you may use the following placeholders: {now}, {utcnow}, {fqdn}, {hostname}, {user} and some others. + "$borg" create --stats "::${name}-{now}" "$work_dir" - # About thi _20 it's a crazy fix to avoid pruning wordpress__2 - # if you prune wordpress - "$borg" prune "$repo" -P "_${name}-" --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp - - # Prune legacy archive name without error on wordpress/wordpress__2 - "$borg" prune "$repo" -P "${name}_" --keep-within 2m --keep-monthly=12 2>&1 >/dev/null | log_with_timestamp + "$borg" prune --glob-archives "${name}-*" --list --keep-hourly 2 --keep-daily=7 --keep-weekly=8 --keep-monthly=12 # We prune potential manual backup older than 1 year - "$borg" prune "$repo" --keep-within 1y 2>&1 >/dev/null | log_with_timestamp + "$borg" prune --list --keep-within 1y } do_mount() { export BORG_PASSPHRASE + export BORG_REPO export BORG_RSH + export BORG_LOGGING_CONF work_dir="$1" name="$2" - repo="$3" - size="$4" - description="$5" - "$borg" mount "$repo::$name" "$work_dir" 2>&1 >/dev/null | log_with_timestamp + size="$3" + description="$4" + "$borg" mount "::$name" "$work_dir" } work_dir="$2" @@ -80,13 +74,13 @@ description="$6" case "$1" in need_mount) - do_need_mount "$work_dir" "$name" "$repo" "$size" "$description" + do_need_mount "$work_dir" "$name" "$size" "$description" ;; backup) - do_backup "$work_dir" "$name" "$repo" "$size" "$description" + do_backup "$work_dir" "$name" "$size" "$description" ;; mount) - do_mount "$work_dir" "$name" "$repo" "$size" "$description" + do_mount "$work_dir" "$name" "$size" "$description" ;; *) echo "hook called with unknown argument \`$1'" >&2 diff --git a/conf/logging.conf b/conf/logging.conf new file mode 100644 index 0000000..7739e4f --- /dev/null +++ b/conf/logging.conf @@ -0,0 +1,23 @@ +[loggers] +keys=root + +[handlers] +keys=logfile + +[formatters] +keys=logfile + +[logger_root] +level=NOTSET +handlers=logfile + +[handler_logfile] +class=FileHandler +level=INFO +formatter=logfile +args=('/var/log/__APP__/borg.log', 'a') + +[formatter_logfile] +format=%(asctime)s %(levelname)s %(message)s +datefmt= +class=logging.Formatter diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 07e01d2..08b2fca 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -4,7 +4,7 @@ This app is the "client" part, meant to be installed on the server to be backed ### Features -- Backup on a remote machine, in comination with the [borg server app](https://apps.yunohost.org/app/borgserver) +- Backup on a remote machine, in combination with the [borg server app](https://apps.yunohost.org/app/borgserver) - ... or on a [commercial borg service](https://www.borgbackup.org/support/commercial.html) - Backups are encrypted (the remote server can't read the content) and deduplicated (optimize space) - Backups are ran automatically, you can choose when and at which frequency diff --git a/doc/POST_UPGRADE.d/1.2.8.md b/doc/POST_UPGRADE.d/1.2.8.md new file mode 100644 index 0000000..1041730 --- /dev/null +++ b/doc/POST_UPGRADE.d/1.2.8.md @@ -0,0 +1,7 @@ +[Borg pre-version 1.2.5 had CVE in archive format](https://github.com/borgbackup/borg/blob/1.2.8/docs/changes.rst#pre-125-archives-spoofing-vulnerability-cve-2023-36811). One liner to check if you're affected is: + +```sh +sudo env BORG_RSH="ssh -i /root/.ssh/id___APP___ed25519 -oStrictHostKeyChecking=yes " BORG_PASSPHRASE="$(sudo yunohost app setting __APP__ passphrase)" BORG_RELOCATED_REPO_ACCESS_IS_OK=yes BORG_REPO="$(sudo yunohost app setting __APP__ repository)" __INSTALL_DIR__/venv/bin/borg upgrade --show-rc --check-tam $BORG_REPO +``` + +Consult the linked documentation on how to interpret the result. diff --git a/manifest.toml b/manifest.toml index b91c260..07a5401 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Borg Backup" description.en = "Regularly create deduplicated, encrypted backups sent to another server using Borg" description.fr = "Créez régulièrement des sauvegardes dédupliquées et chiffées envoyées sur un autre serveur à l'aide de Borg" -version = "1.2.8~ynh1" +version = "1.2.8~ynh2" maintainers = ["ljf"] @@ -24,7 +24,7 @@ multi_instance = true ldap = "not_relevant" sso = "not_relevant" disk = "50M" -ram.build = "50M" +ram.build = "500M" ram.runtime = "50M" [install] @@ -81,6 +81,8 @@ ram.runtime = "50M" [resources.install_dir] + [resources.permissions] + [resources.apt] packages = [ "python3-pip", diff --git a/scripts/backup b/scripts/backup index 964f5d9..1a8036e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -22,6 +22,9 @@ ynh_backup --src_path="/etc/sudoers.d/$app" ynh_backup --src_path="/root/.ssh/id_${app}_ed25519" --not_mandatory ynh_backup --src_path="/root/.ssh/id_${app}_ed25519.pub" --not_mandatory +ynh_backup --src_path="$install_dir/backup-with-borg" +ynh_backup --src_path="$install_dir/logging.conf" + #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/config b/scripts/config index a6972e7..edb17a7 100644 --- a/scripts/config +++ b/scripts/config @@ -53,6 +53,10 @@ $(BORG_PASSPHRASE="$(ynh_app_setting_get $app passphrase)" BORG_RSH="ssh -i /roo EOF } +get__conf() { + ynh_app_setting_get --app=$app --key=conf +} + #================================================= # SPECIFIC VALIDATORS FOR TOML SHORT KEYS #================================================= @@ -74,6 +78,15 @@ set__data_multimedia() { ynh_secure_remove /home/yunohost.multimedia/.nobackup fi } + +set__conf() { + if [ -n "${conf}" ] + then + # Update the config of the app + ynh_app_setting_set --app=$app --key=conf --value=$conf + fi +} + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/install b/scripts/install index 57da313..2adbf74 100755 --- a/scripts/install +++ b/scripts/install @@ -71,6 +71,9 @@ chown "$app:$app" "$install_dir/backup-with-borg" ynh_add_config --template="sudoer" --destination="/etc/sudoers.d/$app" chown root:root "/etc/sudoers.d/$app" +ynh_add_config --template="logging.conf" --destination="$install_dir/logging.conf" +chown "$app:$app" "$install_dir/logging.conf" + #================================================= # SYSTEM CONFIGURATION #================================================= @@ -78,7 +81,7 @@ ynh_script_progression --message="Adding system configurations related to $app.. # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" --log "/var/log/$app/borg.log" # Disable the service, this is to prevent the service from being triggered at boot time systemctl disable $app.service --quiet diff --git a/scripts/restore b/scripts/restore index 7f7831c..afd6c98 100755 --- a/scripts/restore +++ b/scripts/restore @@ -37,13 +37,20 @@ chmod go=--- "/etc/yunohost/hooks.d/backup_method/05-${app}_app" ynh_restore_file --origin_path="/etc/sudoers.d/$app" chown root:root "/etc/sudoers.d/$app" +ynh_restore_file --origin_path="$install_dir/backup-with-borg" +chmod u+x "$install_dir/backup-with-borg" +chown "$app:$app" "$install_dir/backup-with-borg" + +ynh_restore_file --origin_path="$install_dir/logging.conf" +chown "$app:$app" "$install_dir/logging.conf" + #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 ynh_restore_file --origin_path="/etc/systemd/system/$app.service" -yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" --log "/var/log/$app/borg.log" # Disable the service, this is to prevent the service from being triggered at boot time systemctl disable $app.service --quiet diff --git a/scripts/upgrade b/scripts/upgrade index 93a6039..1ddafe9 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -93,6 +93,9 @@ chown "$app:$app" "$install_dir/backup-with-borg" ynh_add_config --template="sudoer" --destination="/etc/sudoers.d/$app" chown root:root "/etc/sudoers.d/$app" +ynh_add_config --template="logging.conf" --destination="$install_dir/logging.conf" +chown "$app:$app" "$install_dir/logging.conf" + #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= @@ -100,7 +103,7 @@ ynh_script_progression --message="Upgrading system configurations related to $ap # Create a dedicated systemd config ynh_add_systemd_config -yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" +yunohost service add $app --description="Deduplicating backup program" --test_status="systemctl show $app.service -p ActiveState --value | grep -v failed" --log "/var/log/$app/borg.log" # Disable the service, this is to prevent the service from being triggered at boot time systemctl disable $app.service --quiet diff --git a/tests.toml b/tests.toml index 050cb44..f9de7b5 100644 --- a/tests.toml +++ b/tests.toml @@ -27,6 +27,16 @@ test_format = 1.0 args.on_calendar = "Daily" args.mailalert = "never" + [default.test_upgrade_from.159bd111c63fcce0a1b8b3d589b517aa15007a21] + name = "First working bookworm version/manifest v2" + args.repository = "ssh://sam@domain.tld:22/~/backup" + args.passphrase = "A_Passphrase" + args.conf = 1 + args.data = 1 + args.apps = "all" + args.on_calendar = "Daily" + args.mailalert = "errors_only" + [local_directory] args.repository = "/mnt/backup"