mirror of
https://github.com/YunoHost-Apps/cockpit_ynh.git
synced 2024-09-03 18:16:26 +02:00
67 lines
2.3 KiB
Bash
67 lines
2.3 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# CHECK VERSION
|
|
#=================================================
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
#=================================================
|
|
# 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"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
yunohost service add $app --description="Sysadmin login session in a web browser" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# UPDATE A CONFIG FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Fixing up permissions..." --weight=1
|
|
|
|
usermod -a -G cockpit cockpit-ws
|
|
usermod -a -G cockpit cockpit-wsinstance
|
|
|
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
|
|
|
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"
|
|
|
|
chmod 650 "/etc/cockpit/cockpit.conf"
|
|
chown root:$app "/etc/cockpit/cockpit.conf"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|
|
|
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|