2018-09-15 09:48:48 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-01-31 21:35:45 +01:00
|
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
2018-09-15 09:48:48 +02:00
|
|
|
#=================================================
|
2024-01-31 21:35:45 +01:00
|
|
|
ynh_script_progression --message="Ensuring downward compatibility..."
|
2018-09-15 09:48:48 +02:00
|
|
|
|
2024-01-31 21:35:45 +01:00
|
|
|
if [[ -n "${squid:-}" ]]; then
|
2024-02-01 11:25:07 +01:00
|
|
|
ynh_app_setting_delete --app="$app" --key="squid"
|
|
|
|
fi
|
2024-02-01 11:54:07 +01:00
|
|
|
if [[ -n "${squid_name:-}" ]]; then
|
|
|
|
ynh_app_setting_delete --app="$app" --key="squid_name"
|
2024-01-31 21:35:45 +01:00
|
|
|
fi
|
2018-09-15 09:48:48 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-13 16:50:54 +01:00
|
|
|
# STANDARD UPGRADE STEPS
|
2018-09-15 09:48:48 +02:00
|
|
|
#=================================================
|
2022-03-13 16:50:54 +01:00
|
|
|
# STOP SYSTEMD SERVICE
|
2018-09-15 09:48:48 +02:00
|
|
|
#=================================================
|
2022-03-13 16:50:54 +01:00
|
|
|
ynh_script_progression --message="Stopping a systemd service..."
|
2020-10-17 11:19:50 +02:00
|
|
|
|
2024-02-01 11:54:07 +01:00
|
|
|
ynh_systemd_action --service_name="squid" --action="stop" --log_path="/var/log/squid/cache.log"
|
2022-03-13 16:50:54 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# UPDATE A CONFIG FILE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Updating a configuration file..."
|
2018-09-28 12:38:03 +02:00
|
|
|
|
2024-01-31 21:35:45 +01:00
|
|
|
find_squid_version
|
2018-09-15 09:48:48 +02:00
|
|
|
|
2024-02-01 11:54:07 +01:00
|
|
|
ynh_add_config --template="squid.conf" --destination="/etc/squid/squid.conf"
|
2018-09-15 09:48:48 +02:00
|
|
|
|
|
|
|
#=================================================
|
2024-01-31 21:35:45 +01:00
|
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
2018-09-15 09:48:48 +02:00
|
|
|
#=================================================
|
2024-01-31 21:35:45 +01:00
|
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
2018-09-15 09:48:48 +02:00
|
|
|
|
2024-02-01 11:54:07 +01:00
|
|
|
yunohost service add "squid" --description "Squid3 a web proxy service" --log="/var/log/squid/access.log" --needs_exposed_ports "$port"
|
2018-09-15 09:48:48 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-03-13 16:50:54 +01:00
|
|
|
# START SYSTEMD SERVICE
|
2018-09-15 09:48:48 +02:00
|
|
|
#=================================================
|
2022-03-13 16:50:54 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..."
|
2018-09-15 09:48:48 +02:00
|
|
|
|
2024-02-01 11:54:07 +01:00
|
|
|
ynh_systemd_action --service_name="squid" --action="restart" --log_path="/var/log/squid/cache.log"
|
2020-10-17 12:08:40 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-11-02 19:27:34 +01:00
|
|
|
ynh_script_progression --message="Upgrade of $app completed"
|