1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cockpit_ynh.git synced 2024-09-03 18:16:26 +02:00
cockpit_ynh/scripts/upgrade

63 lines
2.2 KiB
Text
Raw Normal View History

2019-02-20 12:08:50 +01:00
#!/bin/bash
2020-11-16 19:38:35 +01:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2019-02-20 12:08:50 +01:00
2020-11-16 19:38:35 +01:00
source _common.sh
2019-02-20 12:08:50 +01:00
source /usr/share/yunohost/helpers
2020-11-16 19:38:35 +01:00
#=================================================
# CHECK VERSION
#=================================================
2019-02-20 12:08:50 +01:00
2020-11-16 19:38:35 +01:00
upgrade_type=$(ynh_check_app_version_changed)
2019-02-20 12:08:50 +01:00
2020-11-16 19:38:35 +01:00
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
2019-02-20 12:08:50 +01:00
2022-03-13 21:51:45 +01:00
#=================================================
2023-08-12 11:14:23 +02:00
# REAPPLY SYSTEM CONFIGURATIONS
2019-02-20 12:08:50 +01:00
#=================================================
2023-08-12 11:14:23 +02:00
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
2019-02-20 12:08:50 +01:00
2022-09-03 00:44:25 +02:00
# Create a dedicated NGINX config
ynh_add_nginx_config
2019-02-20 12:08:50 +01:00
2023-08-12 11:14:23 +02:00
yunohost service add $app --description="Sysadmin login session in a web browser" --log="/var/log/$app/$app.log"
2020-11-16 19:38:35 +01:00
#=================================================
2022-03-13 21:51:45 +01:00
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a configuration file..." --weight=1
2019-02-20 12:08:50 +01:00
2022-03-13 21:51:45 +01:00
ynh_replace_string --match_string="ListenStream=.*" --replace_string="ListenStream=$port" --target_file="/lib/systemd/system/cockpit.socket"
systemctl daemon-reload
systemctl restart $app.socket
ynh_add_config --template="../conf/cockpit.conf" --destination="/etc/cockpit/cockpit.conf"
2023-08-12 10:41:47 +02:00
chmod 650 "/etc/cockpit/cockpit.conf"
chown root:$app-ws "/etc/cockpit/cockpit.conf"
2020-11-16 19:38:35 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
2019-02-20 12:08:50 +01:00
2022-03-13 21:51:45 +01:00
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started"
2019-02-20 17:56:35 +01:00
2020-11-16 19:38:35 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2019-02-20 12:08:50 +01:00
2022-03-13 21:51:45 +01:00
ynh_script_progression --message="Upgrade of $app completed" --last