From a9d1f4a35d03a455aeaf5224ff0c3f5f8154af90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sun, 7 Apr 2024 09:46:39 +0200 Subject: [PATCH] cleaning --- manifest.toml | 3 +++ scripts/install | 4 ++-- scripts/remove | 20 +++----------------- scripts/restore | 25 +++---------------------- scripts/upgrade | 50 +++++++++++-------------------------------------- 5 files changed, 22 insertions(+), 80 deletions(-) diff --git a/manifest.toml b/manifest.toml index ca2c41b..d6421a9 100644 --- a/manifest.toml +++ b/manifest.toml @@ -20,8 +20,11 @@ code = "https://github.com/thelounge/thelounge" yunohost = ">= 11.2" architectures = "all" multi_instance = false + ldap = false + sso = false + disk = "50M" ram.build = "1500M" ram.runtime = "50M" diff --git a/scripts/install b/scripts/install index e391e14..7f1ef6c 100644 --- a/scripts/install +++ b/scripts/install @@ -43,12 +43,12 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Modifying a config file..." --weight=1 -ynh_add_config --template="../conf/config.js" --destination="$data_dir/config.js" +ynh_add_config --template="config.js" --destination="$data_dir/config.js" #================================================= # INSTALL THE LOUNGE #================================================= -ynh_script_progression --message="Installing The Lounge..." --weight=10 +ynh_script_progression --message="Installing $app..." --weight=10 pushd $install_dir ynh_use_nodejs diff --git a/scripts/remove b/scripts/remove index 899d403..fb19483 100644 --- a/scripts/remove +++ b/scripts/remove @@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SERVICE INTEGRATION IN YUNOHOST #================================================= +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`) if ynh_exec_warn_less yunohost service status $app >/dev/null @@ -22,30 +23,15 @@ then yunohost service remove $app fi -#================================================= -# STOP AND REMOVE SERVICE -#================================================= -ynh_script_progression --message="Stopping and removing the systemd service..." --weight=2 +# Remove the dedicated NGINX config +ynh_remove_nginx_config # Remove the dedicated systemd config ynh_remove_systemd_config -#================================================= -# REMOVE DEPENDENCIES -#================================================= -ynh_script_progression --message="Removing dependencies..." --weight=1 - # Remove NodeJS ynh_remove_nodejs -#================================================= -# REMOVE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 - -# Remove the dedicated NGINX config -ynh_remove_nginx_config - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/restore b/scripts/restore index c9dcc8b..42764d5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -9,15 +9,6 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD RESTORATION STEPS -#================================================= -# RESTORE THE NGINX CONFIGURATION -#================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -50,16 +41,13 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # RESTORE SYSTEMD #================================================= -ynh_script_progression --message="Restoring the systemd configuration..." --weight=1 +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" 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="Client Web IRC" --log="/var/log/$app/$app.log" #================================================= @@ -69,13 +57,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path=systemd -#================================================= -# GENERIC FINALIZATION -#================================================= -# RELOAD NGINX -#================================================= -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 4c1866e..e34d44b 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,12 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -27,32 +21,18 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=2 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=2 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir=$install_dir --full_replace=1 -fi +ynh_setup_source --dest_dir=$install_dir --full_replace=1 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=2 - -# Create a dedicated NGINX config -ynh_add_nginx_config - #================================================= # UPGRADE DEPENDENCIES #================================================= ynh_script_progression --message="Upgrading dependencies..." --weight=5 -# Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= @@ -61,30 +41,22 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # UPGRADE THE LOUNGE #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - pushd $install_dir - ynh_use_nodejs - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install - ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn build - popd -fi +pushd $install_dir + ynh_use_nodejs + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH yarn install + ynh_exec_warn_less sudo -u $app env $ynh_node_load_PATH NODE_ENV=production yarn build +popd #================================================= -# SETUP SYSTEMD +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=2 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 + +ynh_add_nginx_config env_path="$PATH" ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Client Web IRC" --log="/var/log/$app/$app.log" #=================================================