From 628ae1c23d10c9dc65d757990c02f86166774955 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?E=CC=81ric=20Gaspar?=
<46165813+ericgaspar@users.noreply.github.com>
Date: Sun, 26 May 2024 21:20:00 +0200
Subject: [PATCH] cleaning
---
scripts/backup | 6 +-----
scripts/install | 22 +++++-----------------
scripts/restore | 4 ----
scripts/upgrade | 39 +++++----------------------------------
4 files changed, 11 insertions(+), 60 deletions(-)
diff --git a/scripts/backup b/scripts/backup
index 2696784..c2cadee 100755
--- a/scripts/backup
+++ b/scripts/backup
@@ -28,15 +28,11 @@ ynh_backup --src_path="$install_dir"
ynh_backup --src_path="$data_dir" --is_big
#=================================================
-# BACKUP THE NGINX CONFIGURATION
+# SYSTEM CONFIGURATION
#=================================================
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
-#=================================================
-# BACKUP SYSTEMD
-#=================================================
-
ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup --src_path="/etc/systemd/system/${app}_ldap.service"
diff --git a/scripts/install b/scripts/install
index 6d750bd..0a2fcf1 100755
--- a/scripts/install
+++ b/scripts/install
@@ -44,14 +44,6 @@ ynh_replace_string --match_string="
" -
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
-#=================================================
-# NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Configuring NGINX web server..." --weight=2
-
-# Create a dedicated NGINX config
-ynh_add_nginx_config
-
#=================================================
# SPECIFIC SETUP
#=================================================
@@ -114,23 +106,19 @@ chmod 400 "$data_dir/groups/YunoHost_Users.json"
chown $app:$app "$data_dir/groups/YunoHost_Users.json"
#=================================================
-# SETUP SYSTEMD
+# SYSTEM CONFIGURATION
#=================================================
-ynh_script_progression --message="Configuring a systemd service..." --weight=1
+ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
public_ip4="$(curl -s ip.yunohost.org)" || true
+# Create a dedicated NGINX config
+ynh_add_nginx_config
+
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_add_systemd_config --service=${app}_ldap --template="ldap.service"
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
-
yunohost service add $app --description="Videoconferencing server" --needs_exposed_ports="$port_turn"
yunohost service add ${app}_ldap --description="LDAP integration for the videoconferencing server"
diff --git a/scripts/restore b/scripts/restore
index 7296baa..9dbd5d9 100755
--- a/scripts/restore
+++ b/scripts/restore
@@ -27,10 +27,6 @@ ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
-mkdir -p $data_dir/{groups,recordings}
-
-chmod 750 "$data_dir"
-chmod -R o-rwx "$data_dir"
chown -R $app:www-data "$data_dir"
#=================================================
diff --git a/scripts/upgrade b/scripts/upgrade
index a4d96f6..f59e67b 100644
--- a/scripts/upgrade
+++ b/scripts/upgrade
@@ -25,23 +25,6 @@ ynh_script_progression --message="Stopping a systemd service..." --weight=3
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_systemd_action --service_name=${app}_ldap --action="stop" --log_path="systemd"
-#=================================================
-# ENSURE DOWNWARD COMPATIBILITY
-#=================================================
-ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
-
-# For version 0.6~ynh1 and before
-if [[ ! -d "$install_dir/live" ]]
-then
- tempdir="$(mktemp -d)"
- mv $install_dir $tempdir
- mkdir -p "$install_dir/live"
- mv $tempdir/$app/galene "$install_dir/live/"
- mv $tempdir/$app/data/ "$install_dir/live/"
- mv $tempdir/$app/static/ "$install_dir/live/"
- ynh_secure_remove --file="$tempdir"
-fi
-
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@@ -60,14 +43,6 @@ ynh_replace_string --match_string="" -
chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
-#=================================================
-# NGINX CONFIGURATION
-#=================================================
-ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3
-
-# Create a dedicated NGINX config
-ynh_add_nginx_config
-
#=================================================
# SPECIFIC UPGRADE
#=================================================
@@ -133,23 +108,19 @@ chmod 400 "$data_dir/groups/YunoHost_Users.json"
chown $app:$app "$data_dir/groups/YunoHost_Users.json"
#=================================================
-# SETUP SYSTEMD
+# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
-ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
+ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
public_ip4="$(curl -s ip.yunohost.org)" || true
+# Create a dedicated NGINX config
+ynh_add_nginx_config
+
# Create a dedicated systemd config
ynh_add_systemd_config
ynh_add_systemd_config --service=${app}_ldap --template="ldap.service"
-#=================================================
-# GENERIC FINALIZATION
-#=================================================
-# INTEGRATE SERVICE IN YUNOHOST
-#=================================================
-ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
-
yunohost service add $app --description="Videoconferencing server" --needs_exposed_ports="$port_turn"
yunohost service add ${app}_ldap --description="LDAP integration for the videoconferencing server"