From 6709954f09f49c6467c6a448efdb6985a33d53a9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 6 Feb 2022 18:08:55 +0100 Subject: [PATCH 1/2] Upgrade to 1.4.9~ynh1 --- README.md | 2 +- README_fr.md | 2 +- conf/app.src | 4 ++-- manifest.json | 2 +- scripts/backup | 2 +- scripts/install | 14 +++++++++----- scripts/remove | 1 + scripts/restore | 41 +++++++++++++++-------------------------- scripts/upgrade | 15 ++++++++------- 9 files changed, 39 insertions(+), 44 deletions(-) diff --git a/README.md b/README.md index 342d64e..9b15783 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in The news reader that doesn't know you -**Shipped version:** 1.4.3~ynh2 +**Shipped version:** 1.4.9~ynh2 **Demo:** https://petrolette.space diff --git a/README_fr.md b/README_fr.md index 4a8d62f..35cb533 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour La page d'actu qui ne sait rien de toi -**Version incluse :** 1.4.3~ynh2 +**Version incluse :** 1.4.9~ynh2 **Démo :** https://petrolette.space diff --git a/conf/app.src b/conf/app.src index c4b966c..2c42577 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/v1.4.3/petrolette-v1.4.3.tar.gz -SOURCE_SUM=3a9d48a0e613cfe93def93dbf18a9d8a122245635b3b45dbd7d146c271af67f0 +SOURCE_URL=https://framagit.org/yphil/petrolette/-/archive/v1.4.9/petrolette-v1.4.9.tar.gz +SOURCE_SUM=d738bdbd50748c4658cfb1a1fe36c12b58c75d96b2d29accc386a49b44f7178c SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=tar.gz SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 8397992..a6e2ee3 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "The news reader that doesn't know you", "fr": "La page d'actu qui ne sait rien de toi" }, - "version": "1.4.3~ynh2", + "version": "1.4.9~ynh1", "url": "https://framagit.org/yphil/petrolette", "upstream": { "license": "AGPL-3.0-only", diff --git a/scripts/backup b/scripts/backup index 0aa3035..dbda78a 100644 --- a/scripts/backup +++ b/scripts/backup @@ -40,7 +40,7 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$final_path" --is_big +ynh_backup --src_path="$final_path" #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index 1ed00b7..6bcee3e 100644 --- a/scripts/install +++ b/scripts/install @@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers # MANAGE SCRIPT FAILURE #================================================= +ynh_clean_setup () { + ynh_clean_check_starting +} # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -72,7 +75,7 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -110,8 +113,9 @@ pushd $final_path [[ -v TMP_HOME ]] && HOME=$TMP_HOME || unset HOME popd -chown -R $app:$app $final_path -chmod -R o-rwx $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" #================================================= # SETUP SYSTEMD @@ -128,7 +132,7 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." -yunohost service add $app --description="The news reader that doesn't know you" --log="/home/yunohost.app/${app}/storage/logs/petrolette.log" +yunohost service add $app --description="The news reader that doesn't know you" #================================================= # START SYSTEMD SERVICE @@ -136,7 +140,7 @@ yunohost service add $app --description="The news reader that doesn't know you" ynh_script_progression --message="Starting a systemd service..." # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Directory created" #================================================= # SETUP SSOWAT diff --git a/scripts/remove b/scripts/remove index 1c56593..83250d7 100644 --- a/scripts/remove +++ b/scripts/remove @@ -59,6 +59,7 @@ ynh_remove_nginx_config #================================================= # REMOVE DEPENDENCIES #================================================= +ynh_script_progression --message="Removing dependencies..." ynh_remove_nodejs diff --git a/scripts/restore b/scripts/restore index 801fc33..6b21022 100644 --- a/scripts/restore +++ b/scripts/restore @@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - true + ynh_clean_check_starting } # Exit if an error occurs during the execution of the script ynh_abort_if_errors @@ -56,7 +56,18 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Recreating the dedicated system user..." --weight=1 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." + +ynh_restore_file --origin_path="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" #================================================= # SPECIFIC RESTORATION @@ -67,28 +78,6 @@ ynh_script_progression --message="Reinstalling dependencies..." --weight=1 ynh_install_nodejs --nodejs_version=$NODEJS_VERSION -#================================================= -# REINSTALL PETROLLETTE -#================================================= -ynh_script_progression --message="Reinstalling the app ..." --weight=5 - -ynh_setup_source --dest_dir="$final_path" - -pushd $final_path -# set port in configuration file - sed -i "/HTTP_PORT/s/[0-9]*[0-9]/$port/" package.json - sed -i "/HTTPS_PORT/s/[0-9]*[0-9]/$https_port/" package.json - [[ -v TMP_HOME ]] && TMP_HOME=$HOME - HOME=$(pwd) - ynh_use_nodejs - ynh_npm install - [[ -v TMP_HOME ]] && HOME=$TMP_HOME || unset HOME -popd - -# Restore permissions on app files -chown -R $app:$app $final_path -chmod -R o-rwx $final_path - #================================================= # RESTORE SYSTEMD #================================================= @@ -102,14 +91,14 @@ systemctl enable $app.service --quiet #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="The news reader that doesn't know you" --log="/home/yunohost.app/${app}/storage/logs/petrolette.log" +yunohost service add $app --description="The news reader that doesn't know you" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Directory created" #================================================= # GENERIC FINALIZATION diff --git a/scripts/upgrade b/scripts/upgrade index ad18d88..8a1b732 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,6 +37,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { + ynh_clean_check_starting # Restore it if the upgrade fails ynh_restore_upgradebackup } @@ -50,7 +51,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Stopping a systemd service..." --weight=1 -ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action=stop --log_path=systemd --line_match="Stopped" #================================================= # CREATE DEDICATED USER @@ -58,7 +59,7 @@ ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$ ynh_script_progression --message="Making sure dedicated system user exists..." --weight=8 # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app --home_dir=$final_path +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -106,9 +107,9 @@ pushd $final_path [[ -v TMP_HOME ]] && HOME=$TMP_HOME || unset HOME popd -# Set permissions on app files -chown -R $app:$app $final_path -chmod -R o-rwx $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:$app "$final_path" #================================================= # SETUP SYSTEMD @@ -125,14 +126,14 @@ ynh_add_systemd_config #================================================= ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 -yunohost service add $app --description="The news reader that doesn't know you" --log="/home/yunohost.app/${app}/storage/logs/petrolette.log" +yunohost service add $app --description="The news reader that doesn't know you" #================================================= # START SYSTEMD SERVICE #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=3 -ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" +ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Directory created" #================================================= # RELOAD NGINX From df2d9bea8358f3ed2a3104dca09e6f23c798c22d Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 6 Feb 2022 17:09:00 +0000 Subject: [PATCH 2/2] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9b15783..29099b7 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in The news reader that doesn't know you -**Shipped version:** 1.4.9~ynh2 +**Shipped version:** 1.4.9~ynh1 **Demo:** https://petrolette.space diff --git a/README_fr.md b/README_fr.md index 35cb533..5707136 100644 --- a/README_fr.md +++ b/README_fr.md @@ -13,7 +13,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour La page d'actu qui ne sait rien de toi -**Version incluse :** 1.4.9~ynh2 +**Version incluse :** 1.4.9~ynh1 **Démo :** https://petrolette.space