mirror of
https://github.com/YunoHost-Apps/cockpit_ynh.git
synced 2024-09-03 18:16:26 +02:00
53 lines
1.7 KiB
Bash
53 lines
1.7 KiB
Bash
#!/bin/bash
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression "Stopping $app's systemd service..."
|
|
|
|
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_config_add_nginx
|
|
|
|
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 "Fixing up permissions..."
|
|
|
|
usermod -a -G cockpit cockpit-ws
|
|
usermod -a -G cockpit cockpit-wsinstance
|
|
|
|
ynh_script_progression "Updating configuration..."
|
|
|
|
ynh_replace --match="ListenStream=.*" --replace="ListenStream=$port" --file="/lib/systemd/system/cockpit.socket"
|
|
systemctl daemon-reload
|
|
systemctl restart $app.socket
|
|
|
|
ynh_config_add --template="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 "Starting $app's systemd service..."
|
|
|
|
ynh_systemctl --service=$app --action="restart" --log_path="systemd" --wait_until="Started"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression "Upgrade of $app completed"
|