From f49b5e40e704e4121f9cb6565f986cee37f9ec11 Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Sun, 14 Apr 2024 18:18:35 +0200 Subject: [PATCH] cleaning --- manifest.toml | 2 +- scripts/install | 14 +------------- scripts/remove | 20 -------------------- scripts/restore | 23 ++--------------------- scripts/upgrade | 49 ++++++++++++------------------------------------- 5 files changed, 16 insertions(+), 92 deletions(-) diff --git a/manifest.toml b/manifest.toml index bb847b1..c7ccc64 100644 --- a/manifest.toml +++ b/manifest.toml @@ -5,7 +5,7 @@ name = "NodeBB" description.en = "Forum software built for the modern web" description.fr = "Logiciel de forum conçu pour le Web moderne" -version = "3.5.0~ynh1" +version = "3.7.3~ynh1" maintainers = [""] diff --git a/scripts/install b/scripts/install index fd7f874..4f1e217 100644 --- a/scripts/install +++ b/scripts/install @@ -57,7 +57,7 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Configuring the app..." --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" setup="{ \"admin:username\": \"$admin\", @@ -84,21 +84,9 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=1 # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# GENERIC FINALIZATION -#================================================= -# SETUP LOGROTATE -#================================================= -ynh_script_progression --message="Configuring log rotation..." --weight=1 - # Use logrotate to manage application logfile(s) ynh_use_logrotate -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log" #================================================= diff --git a/scripts/remove b/scripts/remove index 489be0f..fccea68 100644 --- a/scripts/remove +++ b/scripts/remove @@ -22,35 +22,15 @@ 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 LOGROTATE CONFIGURATION -#================================================= -ynh_script_progression --message="Removing logrotate configuration..." --weight=1 - # Remove the app-specific logrotate config ynh_remove_logrotate -#================================================= -# 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 diff --git a/scripts/restore b/scripts/restore index 106802d..5cfcd88 100644 --- a/scripts/restore +++ b/scripts/restore @@ -10,15 +10,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 web server configuration..." - -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" - #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -51,14 +42,11 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name #================================================= ynh_script_progression --message="Restoring the systemd configuration..." --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="Forum software" --log="/var/log/$app/$app.log" #================================================= @@ -68,13 +56,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 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 849a9f3..9b94475 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -11,12 +11,6 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -29,23 +23,19 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=1 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=1 - - pushd $install_dir - ynh_use_nodejs - # Shut down your forum - git config --system --add safe.directory $install_dir - ynh_exec_as $app env "$ynh_node_load_PATH" $install_dir/nodebb stop - # Grab the latest and greatest code - git fetch # Grab the latest code from the NodeBB Repository - git reset --hard origin/$nodebb_version # Replace v1.12.x with the branch name! - # Run the NodeBB upgrade script - ynh_exec_as $app $ynh_node_load_PATH $install_dir/nodebb upgrade 2>/dev/null - popd -fi +pushd $install_dir + ynh_use_nodejs + # Shut down your forum + git config --system --add safe.directory $install_dir + ynh_exec_as $app env "$ynh_node_load_PATH" $install_dir/nodebb stop + # Grab the latest and greatest code + git fetch # Grab the latest code from the NodeBB Repository + git reset --hard origin/$nodebb_version # Replace v1.12.x with the branch name! + # Run the NodeBB upgrade script + ynh_exec_as $app $ynh_node_load_PATH $install_dir/nodebb upgrade 2>/dev/null +popd chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" @@ -58,27 +48,12 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..." - # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# UPGRADE DEPENDENCIES -#================================================= -ynh_script_progression --message="Upgrading dependencies..." --weight=1 - # Install Nodejs ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -#================================================= -# SETUP SYSTEMD -#================================================= -ynh_script_progression --message="Upgrading systemd configuration..." --weight=1 - # Create a dedicated systemd config ynh_add_systemd_config -#================================================= -# INTEGRATE SERVICE IN YUNOHOST -#================================================= -ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 - yunohost service add $app --description="Forum software" --log="/var/log/$app/$app.log" #=================================================