1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/cockpit_ynh.git synced 2024-09-03 18:16:26 +02:00
This commit is contained in:
Éric Gaspar 2023-08-12 11:14:23 +02:00
parent 33bd4bf20c
commit 9f352eb2a6
5 changed files with 20 additions and 55 deletions

View file

@ -5,7 +5,7 @@ name = "Cockpit"
description.en = "Sysadmin login session in a web browser" description.en = "Sysadmin login session in a web browser"
description.fr = "Session de connexion sysadmin dans un navigateur Web" description.fr = "Session de connexion sysadmin dans un navigateur Web"
version = "188~ynh2" version = "188~ynh3"
maintainers = [] maintainers = []
@ -44,6 +44,7 @@ ram.runtime = "50M"
main.url = "/" main.url = "/"
[resources.ports] [resources.ports]
main.default = 9090
[resources.apt] [resources.apt]
packages = "cockpit" packages = "cockpit"

View file

@ -21,8 +21,6 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#================================================= #=================================================
# BACKUP VARIOUS FILES # BACKUP VARIOUS FILES
#================================================= #=================================================

View file

@ -10,10 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# STANDARD REMOVE # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST # REMOVE SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) # Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -22,29 +23,11 @@ then
yunohost service remove $app yunohost service remove $app
fi fi
#================================================= ynh_remove_systemd_config
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=5
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing various files..." --weight=1
# Remove a directory securely # Remove a directory securely
ynh_secure_remove --file="/etc/$app" ynh_secure_remove --file="/etc/$app"

View file

@ -10,13 +10,6 @@
source ../settings/scripts/_common.sh source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE VARIOUS FILES # RESTORE VARIOUS FILES
#================================================= #=================================================
@ -29,25 +22,24 @@ systemctl restart $app.socket
ynh_restore_file --origin_path="/etc/cockpit/cockpit.conf" ynh_restore_file --origin_path="/etc/cockpit/cockpit.conf"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 # RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
yunohost service add $app --description="Sysadmin login session in a web browser" --log="/var/log/$app/$app.log" 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
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2 ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=$app --action="restart" --log_path="systemd" --line_match="Started"
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -25,15 +25,15 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#================================================= #=================================================
# NGINX CONFIGURATION # REAPPLY SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
#================================================= yunohost service add $app --description="Sysadmin login session in a web browser" --log="/var/log/$app/$app.log"
# SPECIFIC UPGRADE
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
@ -48,15 +48,6 @@ ynh_add_config --template="../conf/cockpit.conf" --destination="/etc/cockpit/coc
chmod 650 "/etc/cockpit/cockpit.conf" chmod 650 "/etc/cockpit/cockpit.conf"
chown root:$app-ws "/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 # START SYSTEMD SERVICE
#================================================= #=================================================