From 0e8425bcd43107a58f161e4e97dcf5f69b5b4a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Mon, 16 Jan 2023 19:29:00 +0100 Subject: [PATCH] Linter --- doc/DESCRIPTION.md | 2 -- manifest.json | 4 ++-- scripts/install | 3 ++- scripts/upgrade | 9 +++++++-- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/DESCRIPTION.md b/doc/DESCRIPTION.md index 7f8afa3..afa199e 100644 --- a/doc/DESCRIPTION.md +++ b/doc/DESCRIPTION.md @@ -1,5 +1,3 @@ -## Overview - A [Restic](https://restic.net/) package for YunoHost (heavily inspired by [the Borg package](https://github.com/YunoHost-Apps/borg_ynh/)). Restic is a backup tool that can make local and remote backups. diff --git a/manifest.json b/manifest.json index fc75ad7..af83129 100644 --- a/manifest.json +++ b/manifest.json @@ -3,8 +3,8 @@ "id": "restic", "packaging_format": 1, "description": { - "en": "Backup your server with restic.", - "fr": "Sauvegardez votre serveur avec restic." + "en": "Backup your server with Restic", + "fr": "Sauvegardez votre serveur avec Restic" }, "version": "0.12.0~ynh9", "url": "https://restic.net/", diff --git a/scripts/install b/scripts/install index f8f3598..082d9b9 100755 --- a/scripts/install +++ b/scripts/install @@ -76,6 +76,7 @@ ynh_configure check_method "${final_path}/check_method_${app}" # SETUP LOG SCRIPTS #================================================= ynh_script_progression --message="Setting up backup log script" + ynh_configure restic_log "${final_path}/restic_log_${app}" chmod +x "${final_path}/restic_log_${app}" chown ${app}: "${final_path}/restic_log_${app}" @@ -133,6 +134,7 @@ ynh_use_logrotate --logfile=/var/log/restic_check_${app}.err # GENERATE SSH KEY #================================================= ynh_script_progression --message="Generating private key" + ssh_dir="/root/.ssh" if [ ! -d "${ssh_dir}" ];then mkdir -p "${ssh_dir}" @@ -164,7 +166,6 @@ ynh_script_progression --message="You should now allow the following public key $(cat ${private_key}.pub)" - #================================================= # SEND A README FOR THE ADMIN #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 2db9354..2709a7f 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -30,11 +30,9 @@ export data=$(ynh_app_setting_get $app data) export apps=$(ynh_app_setting_get $app apps) export allow_extra_space_use=$(ynh_app_setting_get $app allow_extra_space_use) - #================================================= # CHECK VERSION #================================================= -ynh_script_progression --message="Checking version..." upgrade_type=$(ynh_check_app_version_changed) @@ -64,12 +62,14 @@ fi # INSTALL RESTIC #================================================= ynh_script_progression --message="Installing restic binary" --weight=7 + install_restic #================================================= # CREATE APP USER #================================================= 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 @@ -106,6 +106,7 @@ chown -R ${app}: /home/${app} # ACTIVATE BACKUP METHODS #================================================= ynh_script_progression --message="Activating backup methods" + mkdir -p /etc/yunohost/hooks.d/backup_method mkdir -p /usr/share/yunohost/backup_method @@ -113,6 +114,7 @@ mkdir -p /usr/share/yunohost/backup_method # SETUP THE BACKUP METHOD #================================================= ynh_script_progression --message="Setting up backup methods" + ynh_configure backup_method "/etc/yunohost/hooks.d/backup_method/05-${app}_app" ynh_configure check_method "${final_path}/check_method_${app}" @@ -120,6 +122,7 @@ ynh_configure check_method "${final_path}/check_method_${app}" # SETUP LOG SCRIPTS #================================================= ynh_script_progression --message="Setting up backup log script" + ynh_configure restic_log "${final_path}/restic_log_${app}" chmod +x "${final_path}/restic_log_${app}" chown ${app}: "${final_path}/restic_log_${app}" @@ -133,6 +136,7 @@ chown ${app}: "${final_path}/restic_check_log_${app}" # CONFIGURE CRON #================================================= ynh_script_progression --message="Configuring cron" --weight=5 + ynh_configure backup-with-restic "/usr/local/bin/backup-with-${app}" ynh_configure check-restic "${final_path}/check-${app}" chmod +x "/usr/local/bin/backup-with-${app}" @@ -189,6 +193,7 @@ fi # SETUP LOGROTATE #================================================= ynh_script_progression --message="Configuring logrotate" + ynh_use_logrotate --logfile=/var/log/restic_backup_${app}.log ynh_use_logrotate --logfile=/var/log/restic_backup_${app}.err ynh_use_logrotate --logfile=/var/log/restic_check_${app}.log