From 023cf09cedcaff1dde016766cc46576539dc6115 Mon Sep 17 00:00:00 2001 From: Lionel Coupouchetty-Ramouchetty Date: Tue, 16 Mar 2021 17:37:51 +0100 Subject: [PATCH] fix: apps backup sudo command did not list apps with a backup script, replaced ls wildcard with find command --- conf/backup-with-restic.j2 | 2 +- manifest.json | 2 +- scripts/install | 2 +- scripts/upgrade | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/conf/backup-with-restic.j2 b/conf/backup-with-restic.j2 index 824d0b5..dbaea84 100644 --- a/conf/backup-with-restic.j2 +++ b/conf/backup-with-restic.j2 @@ -39,7 +39,7 @@ fi # Backup all apps independently apps=$(sudo yunohost app setting {{ app }} apps) -for app in $(ls /etc/yunohost/apps/*/scripts/backup | cut -d / -f 5); do +for app in $(sudo /usr/bin/find /etc/yunohost/apps -name backup | cut -d / -f 5); do backup_app=false for selected_app in $(echo $apps | tr "," " ");do if [[ "$selected_app" == "$app" ]] || [ "$apps" = "all" ]; then diff --git a/manifest.json b/manifest.json index 0a27f93..d985e72 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Backup your server with restic.", "fr": "Sauvegardez votre serveur avec restic." }, - "version": "0.12.0~ynh4", + "version": "0.12.0~ynh5", "url": "https://restic.net/", "license": "BSD-2-Clause", "maintainer": { diff --git a/scripts/install b/scripts/install index fc51360..e1c6df4 100755 --- a/scripts/install +++ b/scripts/install @@ -43,7 +43,7 @@ ynh_script_progression --message="Creating user ${app}" useradd -m ${app} ynh_script_progression --message="Configure ${app} user sudoer rights" cat > /tmp/${app}_sudoer << EOSUDOER -${app} ALL = (root) NOPASSWD: /usr/bin/yunohost*, /bin/journalctl* +${app} ALL = (root) NOPASSWD: /usr/bin/yunohost*, /bin/journalctl*, /usr/bin/find /etc/yunohost/apps -name backup EOSUDOER visudo -cf /tmp/${app}_sudoer && mv /tmp/${app}_sudoer /etc/sudoers.d/${app} diff --git a/scripts/upgrade b/scripts/upgrade index 418c3fa..4cebdad 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -67,7 +67,7 @@ ynh_script_progression --message="Creating user ${app}" id ${app} 2>/dev/null || useradd -m ${app} ynh_script_progression --message="Configure ${app} user sudoer rights" cat > /tmp/${app}_sudoer << EOSUDOER -${app} ALL = (root) NOPASSWD: /usr/bin/yunohost*, /bin/journalctl* +${app} ALL = (root) NOPASSWD: /usr/bin/yunohost*, /bin/journalctl*, /usr/bin/find /etc/yunohost/apps -name backup EOSUDOER visudo -cf /tmp/${app}_sudoer && mv /tmp/${app}_sudoer /etc/sudoers.d/${app} ynh_script_progression --message="Move ssh keys from root to ${app} user's home"