From 8efe4c9c1b0a7a3df58cf5db5a26115c07880d8d Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Fri, 30 Aug 2024 23:36:27 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 1 + manifest.toml | 1 + scripts/_common.sh | 24 +++++------------------- scripts/backup | 15 ++++++--------- scripts/install | 14 +++++++------- scripts/remove | 8 ++++---- scripts/restore | 12 ++++++------ scripts/upgrade | 14 +++++++------- 8 files changed, 37 insertions(+), 52 deletions(-) diff --git a/.gitignore b/.gitignore index 783a4ae..8f144f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.sw[op] +.DS_Store diff --git a/manifest.toml b/manifest.toml index c3ecd0c..30802e7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,6 +20,7 @@ code = "https://github.com/lxc/incus" [integration] yunohost = '>= 11.2' +helpers_version = "2.1" architectures = ["amd64"] multi_instance = false ldap = "not_relevant" diff --git a/scripts/_common.sh b/scripts/_common.sh index e7ee9c1..1876a0a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,24 +1,19 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# PERSONAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= _ynh_add_dnsmasq_config() { - ynh_add_config --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app" - ynh_systemd_action --service_name=dnsmasq --action=restart --log_path=systemd + ynh_config_add --template="dnsmasq.conf" --destination="/etc/dnsmasq.d/$app" + ynh_systemctl --service=dnsmasq --action=restart --log_path=systemd } _ynh_remove_dnsmasq_config() { - ynh_secure_remove --file="/etc/dnsmasq.d/$app" - ynh_systemd_action --service_name=dnsmasq --action=restart --log_path=systemd + ynh_safe_rm "/etc/dnsmasq.d/$app" + ynh_systemctl --service=dnsmasq --action=restart --log_path=systemd } - _ynh_add_subuid_subgid() { subuid_string="# Added for Incus\nroot:100000:65536" echo -e "$subuid_string" > /etc/subuid @@ -29,12 +24,3 @@ _ynh_remove_subuid_subgid() { sed -i "/# Added for Incus$/{N;/root:100000:65536/d}" /etc/subuid sed -i "/# Added for Incus$/{N;/root:100000:65536/d}" /etc/subgid } - - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index d951f93..9d4c803 100644 --- a/scripts/backup +++ b/scripts/backup @@ -8,25 +8,22 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" -ynh_backup --src_path="/etc/dnsmasq.d/$app" +ynh_backup "/etc/dnsmasq.d/$app" #================================================= # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/var/lib/incus/" +ynh_backup "/var/lib/incus/" -ynh_backup --src_path="/var/log/incus/" +ynh_backup "/var/log/incus/" #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/install b/scripts/install index 286308f..8861704 100644 --- a/scripts/install +++ b/scripts/install @@ -10,19 +10,19 @@ source /usr/share/yunohost/helpers #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="First stopping the service..." +ynh_script_progression "First stopping the service..." -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log" +ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." +ynh_script_progression "Adding system configurations related to $app..." yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log" # Use logrotate to manage application logfile(s) -ynh_use_logrotate --logfile="/var/log/incus/incusd.log" +ynh_config_add_logrotate "/var/log/incus/incusd.log" _ynh_add_dnsmasq_config @@ -31,12 +31,12 @@ _ynh_add_subuid_subgid #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting $app's systemd service..." +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log" +ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 51f5442..b7bd59f 100644 --- a/scripts/remove +++ b/scripts/remove @@ -10,13 +10,13 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." +ynh_script_progression "Removing system configurations related to $app..." yunohost service remove "$app" -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log" +ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log" -ynh_remove_logrotate +ynh_config_remove_logrotate _ynh_remove_dnsmasq_config @@ -26,4 +26,4 @@ _ynh_remove_subuid_subgid # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index f05c33d..38d7e53 100644 --- a/scripts/restore +++ b/scripts/restore @@ -11,13 +11,13 @@ source /usr/share/yunohost/helpers #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log" -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_restore "/etc/logrotate.d/$app" -ynh_restore_file --origin_path="/etc/dnsmasq.d/$app" +ynh_restore "/etc/dnsmasq.d/$app" _ynh_add_subuid_subgid @@ -25,11 +25,11 @@ _ynh_add_subuid_subgid # RESTORE VARIOUS FILES #================================================= -ynh_restore_file --origin_path="/var/lib/incus" -ynh_restore_file --origin_path="/var/log/incus" +ynh_restore "/var/lib/incus" +ynh_restore "/var/log/incus" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 85b4bfe..5ee56c1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,19 +10,19 @@ source /usr/share/yunohost/helpers #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="First stopping $app service..." +ynh_script_progression "First stopping $app service..." -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log" +ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." +ynh_script_progression "Upgrading system configurations related to $app..." yunohost service add "$app" --description="Incus system container and virtual machine manager" --log="/var/log/incus/incusd.log" # Use logrotate to manage application logfile(s) -ynh_use_logrotate --non-append +ynh_config_add_logrotate _ynh_add_dnsmasq_config @@ -32,13 +32,13 @@ _ynh_add_subuid_subgid #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting $app's systemd service..." +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/incus/incusd.log" +ynh_systemctl --service="$app" --action="start" --log_path="/var/log/incus/incusd.log" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"