diff --git a/manifest.toml b/manifest.toml index 8672690..9381e19 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,8 @@ website = "http://www.squid-cache.org" cpe = "cpe:2.3:a:squid-cache:squid" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = false ldap = true diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..3d7f008 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,17 +1,5 @@ #!/bin/bash #================================================= -# COMMON VARIABLES -#================================================= - -#================================================= -# PERSONAL HELPERS -#================================================= - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= diff --git a/scripts/backup b/scripts/backup index 67eb21c..8fbdb12 100755 --- a/scripts/backup +++ b/scripts/backup @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -14,12 +8,12 @@ source /usr/share/yunohost/helpers # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/etc/squid/squid.conf" +ynh_backup "/etc/squid/squid.conf" -ynh_backup --src_path="/var/log/squid" +ynh_backup "/var/log/squid" #================================================= # 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 7fe5059..8c5b7e7 100755 --- a/scripts/install +++ b/scripts/install @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers @@ -14,27 +8,27 @@ source /usr/share/yunohost/helpers #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 +ynh_script_progression "Adding $app's configuration..." -ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf" +ynh_config_add --template="squid.conf" --destination="/etc/squid/squid.conf" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." yunohost service add "squid" --description "Squid3 a web proxy service" --log="/var/log/squid/access.log" --needs_exposed_ports "$port" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="squid" --action="restart" --log_path="/var/log/squid/cache.log" +ynh_systemctl --service="squid" --action="restart" --log_path="/var/log/squid/cache.log" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index 4e7078f..21736bd 100755 --- a/scripts/remove +++ b/scripts/remove @@ -1,21 +1,15 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." # Remove the service from the list of services known by YunoHost (added from `yunohost service add`) -if ynh_exec_warn_less yunohost service status "squid" >/dev/null; then +if ynh_hide_warnings yunohost service status "squid" >/dev/null; then yunohost service remove "squid" fi @@ -24,13 +18,13 @@ fi #================================================= # Remove a directory securely -ynh_secure_remove --file="/etc/squid/" +ynh_safe_rm "/etc/squid/" # Remove the log files -ynh_secure_remove --file="/var/log/squid" +ynh_safe_rm "/var/log/squid" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index a0907fa..faa3b0b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -1,11 +1,5 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - # Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,28 +7,28 @@ source /usr/share/yunohost/helpers #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression "Adding $app's configuration..." -ynh_secure_remove --file="/etc/squid/squid.conf" -ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf" +ynh_safe_rm "/etc/squid/squid.conf" +ynh_config_add --template="squid.conf" --destination="/etc/squid/squid.conf" #================================================= # 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 "squid" --description "Squid3 a web proxy service" --log="/var/log/squid/access.log" --needs_exposed_ports "$port" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="squid" --action="restart" --log_path="/var/log/squid/cache.log" +ynh_systemctl --service="squid" --action="restart" --log_path="/var/log/squid/cache.log" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index 4eb33ad..6a5dd61 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,58 +1,50 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." +ynh_script_progression "Ensuring downward compatibility..." if [[ -n "${squid:-}" ]]; then - ynh_app_setting_delete --app="$app" --key="squid" + ynh_app_setting_delete --key="squid" fi if [[ -n "${squid_name:-}" ]]; then - ynh_app_setting_delete --app="$app" --key="squid_name" + ynh_app_setting_delete --key="squid_name" fi -#================================================= -# STANDARD UPGRADE STEPS #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="squid" --action="stop" --log_path="/var/log/squid/cache.log" +ynh_systemctl --service="squid" --action="stop" --log_path="/var/log/squid/cache.log" #================================================= # UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Updating a configuration file..." +ynh_script_progression "Updating configuration..." -ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf" +ynh_config_add --template="squid.conf" --destination="/etc/squid/squid.conf" #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." yunohost service add "squid" --description "Squid3 a web proxy service" --log="/var/log/squid/access.log" --needs_exposed_ports "$port" #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="squid" --action="restart" --log_path="/var/log/squid/cache.log" +ynh_systemctl --service="squid" --action="restart" --log_path="/var/log/squid/cache.log" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" +ynh_script_progression "Upgrade of $app completed"