From f9362bb33a87e4528fb5dfc1abcc84146c9ce76b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sat, 2 Mar 2024 08:52:38 +0100 Subject: [PATCH] cleaning --- manifest.toml | 3 +++ scripts/_common.sh | 2 +- scripts/backup | 8 -------- scripts/change_url | 8 ++++---- scripts/install | 5 ++--- scripts/remove | 25 ------------------------- scripts/restore | 26 ++------------------------ scripts/upgrade | 13 ++++--------- 8 files changed, 16 insertions(+), 74 deletions(-) diff --git a/manifest.toml b/manifest.toml index 52c1172..5360338 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,8 +19,11 @@ code = "https://sr.ht/~emersion/gamja/" yunohost = ">= 11.2" architectures = "all" multi_instance = true + ldap = false + sso = true + disk = "50M" ram.build = "50M" ram.runtime = "50M" diff --git a/scripts/_common.sh b/scripts/_common.sh index 9ecc68b..80c93db 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,8 +4,8 @@ # COMMON VARIABLES #================================================= -# dependencies used by the app nodejs_version=20 + go_version=1.20 #================================================= diff --git a/scripts/backup b/scripts/backup index 0ae9c52..6d2e59e 100755 --- a/scripts/backup +++ b/scripts/backup @@ -27,16 +27,8 @@ ynh_backup --src_path="$install_dir" ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - ynh_backup --src_path="$webircgateway_path" #================================================= diff --git a/scripts/change_url b/scripts/change_url index 2c672a1..bac16b2 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -14,14 +14,14 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +ynh_script_progression --message="Stopping a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 ynh_change_url_nginx_config @@ -30,7 +30,7 @@ ynh_change_url_nginx_config #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Using config" @@ -38,4 +38,4 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --l # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 67b0427..f96efee 100755 --- a/scripts/install +++ b/scripts/install @@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Installing dependencies..." --weight=7 +ynh_script_progression --message="Installing dependencies..." --weight=7 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_go --go_version=$go_version @@ -23,7 +23,6 @@ ynh_exec_warn_less ynh_install_go --go_version=$go_version #================================================= ynh_script_progression --message="Setting up source files..." --weight=5 -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" @@ -55,7 +54,7 @@ popd #================================================= ynh_script_progression --message="Adding a configuration file..." --weight=2 -ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" +ynh_add_config --template="config.json" --destination="$install_dir/config.json" chmod 744 "$install_dir/config.json" chown $app:www-data "$install_dir/config.json" diff --git a/scripts/remove b/scripts/remove index 187ea4e..65033e5 100755 --- a/scripts/remove +++ b/scripts/remove @@ -22,37 +22,12 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1 - -# Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - -# Remove the dedicated NGINX config ynh_remove_nginx_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - -# Remove metapackage and its dependencies ynh_remove_nodejs -#================================================= -# SPECIFIC REMOVE -#================================================= -# REMOVE VARIOUS FILES -#================================================= -ynh_script_progression --message="Removing various files..." - ynh_secure_remove --file="$webircgateway_path" #================================================= diff --git a/scripts/restore b/scripts/restore index 7c563e0..7ebdba1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -23,7 +23,7 @@ chown -R $app:www-data "$install_dir" #================================================= # REINSTALL DEPENDENCIES #================================================= -#REMOVEME? ynh_script_progression --message="Reinstalling dependencies..." --weight=7 +ynh_script_progression --message="Reinstalling dependencies..." --weight=7 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version @@ -34,27 +34,12 @@ ynh_script_progression --message="Restoring the NGINX web server configuration.. ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE VARIOUS FILES -#================================================= -ynh_script_progression --message="Restoring various files..." - ynh_restore_file --origin_path="$webircgateway_path" -#================================================= -# RESTORE SYSTEMD -#================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 - ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - -yunohost service add $app --description="Simple IRC web client" +yunohost service add $app --description="Simple IRC web client" --log="/var/log/$app/$app.log" #================================================= # START SYSTEMD SERVICE @@ -63,13 +48,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Using config" -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX AND PHP-FPM -#================================================= -ynh_script_progression --message="Reloading NGINX web server.." --weight=1 - ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 4fff87f..0c640e9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,14 +28,9 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=3 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=3 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="config.json" -fi +ynh_setup_source --dest_dir="$install_dir" --keep="config.json" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -74,7 +69,7 @@ popd #================================================= ynh_script_progression --message="Updating a configuration file..." --weight=1 -ynh_add_config --template="../conf/config.json" --destination="$install_dir/config.json" +ynh_add_config --template="config.json" --destination="$install_dir/config.json" chmod 744 "$install_dir/config.json" chown $app:www-data "$install_dir/config.json" @@ -105,7 +100,7 @@ chmod -R o-rwx "$webircgateway_path" chown -R $app:www-data "$webircgateway_path" chmod +x "$webircgateway_path/webircgateway" -ynh_add_config --template="../conf/config.conf" --destination="$webircgateway_path/config.conf" +ynh_add_config --template="config.conf" --destination="$webircgateway_path/config.conf" chmod 755 "$webircgateway_path/config.conf" chown $app:www-data "$webircgateway_path/config.conf"