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/install
Éric Gaspar 1e9d3b5088 v2
2023-08-12 10:41:47 +02:00

57 lines
2 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# SPECIFIC SETUP
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding 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-ws "/etc/cockpit/cockpit.conf"
#=================================================
# GENERIC FINALIZATION
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="Sysadmin login session in a web browser" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last