From 82b976a6d3ef53b54d12465c2acfded68cbc2716 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Tue, 18 Jun 2024 08:11:22 +0200 Subject: [PATCH] fix --- conf/systemd.service | 2 +- scripts/_common.sh | 2 +- scripts/backup | 22 +++++----------------- scripts/install | 1 - scripts/remove | 5 ++--- scripts/upgrade | 17 +++-------------- 6 files changed, 12 insertions(+), 37 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index ac28b34..954f53b 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__ -Environment="PATH=__ENV_PATH__" +Environment="__YNH_NODE_LOAD_PATH__" ExecStart=__YNH_NPM__ start StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/scripts/_common.sh b/scripts/_common.sh index 9195d57..44277c5 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=18 +nodejs_version=20 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index d45b6dc..a8196c4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -21,18 +21,6 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$install_dir" -#================================================= -# BACKUP THE NGINX CONFIGURATION -#================================================= - -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" - -#================================================= -# BACKUP LOGROTATE -#================================================= - -ynh_backup --src_path="/etc/logrotate.d/$app" - #================================================= # BACKUP DATA_DIR DIRECTORY #================================================= @@ -40,15 +28,15 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="$data_dir" --is_big #================================================= -# BACKUP BINARY +# SYSTEM CONFIGURATION #================================================= +ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" + +ynh_backup --src_path="/etc/logrotate.d/$app" + ynh_backup --src_path="/usr/bin/$app" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= diff --git a/scripts/install b/scripts/install index 615d5d3..8614dd9 100755 --- a/scripts/install +++ b/scripts/install @@ -33,7 +33,6 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2 # Create a dedicated NGINX config ynh_add_nginx_config -env_path="$PATH" ynh_add_systemd_config # FIXME Currently, the log is only redirected to syslog. diff --git a/scripts/remove b/scripts/remove index 9434ca3..17c3382 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,10 +10,9 @@ source _common.sh source /usr/share/yunohost/helpers #================================================= -# STANDARD REMOVE -#================================================= -# REMOVE SERVICE INTEGRATION IN YUNOHOST +# REMOVE SYSTEM CONFIGURATIONS #================================================= +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 diff --git a/scripts/upgrade b/scripts/upgrade index 45bdbce..a9ad805 100755 --- 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) - #================================================= # STOP SYSTEMD SERVICE #================================================= @@ -25,14 +19,10 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=7 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=7 - - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$install_dir" --keep="config.js" -fi +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" --keep="config.js" #================================================= # UPGRADE NODEJS @@ -52,7 +42,6 @@ ynh_add_nginx_config # FIXME Currently, the log is only redirected to syslog. ynh_use_logrotate --non-append -env_path="$PATH" ynh_add_systemd_config yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log"