From 22e72e31dc361deef9b19c03b8ef6b7afec143d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Fri, 13 May 2022 23:11:01 +0200 Subject: [PATCH] Testing (#35) * Fix check_process warning * Update change_url * Update manifest.json * Fix linter warning * Update remove * Set badge in SVG * Use SVG for badge * Finding an available port * Patch (#21) * Fix linter warnings * Small fixes * Cleaning up * Update manifest.json * Cleaning up * Fix badges * [autopatch] Update issue and PR templates (#25) Co-authored-by: Yunohost-Bot <> * Add templates * Fix * Update restore * Fix * Update install * Fix * Update check_process * Patch (#27) * Fix * Auto-update README * Update systemd.service * Update nginx.conf Co-authored-by: Yunohost-Bot <> * Update manifest.json * 4.3 * Fix ynh_npm * Add purge option * Auto-update README * Update version (#30) * update * Auto-update README Co-authored-by: Yunohost-Bot <> * Upgrade (#32) * Fix * Auto-update README Co-authored-by: yunohost-bot * Update _common.sh (#34) * Update _common.sh * Fix * cleaning up * Update manifest.json * Auto-update README Co-authored-by: Alexandre Aubin Co-authored-by: YunoHost Bot Co-authored-by: Yunohost-Bot <> Co-authored-by: yunohost-bot --- README.md | 2 +- README_fr.md | 2 +- check_process | 5 +++++ manifest.json | 2 +- scripts/_common.sh | 2 +- scripts/backup | 2 +- scripts/install | 9 ++++++--- scripts/remove | 8 ++------ scripts/restore | 26 +++++++++++++++++++------- scripts/upgrade | 4 ++++ 10 files changed, 41 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 7efa71e..b60f95a 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Haste is an open-source pastebin software written in node.js, which is easily installable in any network. YunoHost Project uses Haste as pastebin for log sharing: [paste.yunohost.org](https://paste.yunohost.org/) -**Shipped version:** 0.1.0~ynh10 +**Shipped version:** 0.1.0~ynh11 **Demo:** http://hastebin.com/ diff --git a/README_fr.md b/README_fr.md index 7ada107..d82e115 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Haste est un logiciel pastebin open-source écrit en node.js, facilement installable sur n'importe quel réseau. Le projet YunoHost utilise Haste comme pastebin pour le partage de log : [paste.yunohost.org](https://paste.yunohost.org/) -**Version incluse :** 0.1.0~ynh10 +**Version incluse :** 0.1.0~ynh11 **Démo :** http://hastebin.com/ diff --git a/check_process b/check_process index c7e7a34..3554c31 100644 --- a/check_process +++ b/check_process @@ -12,9 +12,14 @@ setup_private=1 setup_public=1 upgrade=1 + upgrade=1 from_commit=0ea46c375b775316cec39a96fa917ec240e45970 backup_restore=1 multi_instance=0 change_url=1 ;;; Options Email= Notification=none +;;; Upgrade options + ; commit=0ea46c375b775316cec39a96fa917ec240e45970 + name=Testing (#33) + manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666& diff --git a/manifest.json b/manifest.json index 4a1cd29..175b920 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Open-source pastebin allowing to upload texts", "fr": "Pastebin open-source permettant de mettre en ligne du texte" }, - "version": "0.1.0~ynh10", + "version": "0.1.0~ynh11", "url": "http://hastebin.com/", "upstream": { "license": "MIT", diff --git a/scripts/_common.sh b/scripts/_common.sh index 7912aa4..9195d57 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,7 +4,7 @@ # COMMON VARIABLES #================================================= -nodejs_version=14 +nodejs_version=18 #================================================= # PERSONAL HELPERS diff --git a/scripts/backup b/scripts/backup index 9c7fc73..bc99ca4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -55,7 +55,7 @@ ynh_backup --src_path="/etc/logrotate.d/$app" # BACKUP DATADIR DIRECTORY #================================================= -ynh_backup --src_path="$data_path" +ynh_backup --src_path="$data_path" --is_big #================================================= # BACKUP BINARY diff --git a/scripts/install b/scripts/install index b24ea50..db3dbb8 100755 --- a/scripts/install +++ b/scripts/install @@ -94,14 +94,15 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # ADD SYSTEMD SERVICE #================================================= +ynh_script_progression --message="Configuring a systemd service..." --weight=1 -ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service" - +env_path="$PATH" ynh_add_systemd_config #================================================= # INSTALL HASTEBIN #================================================= +ynh_script_progression --message="Installing $app..." --weight=5 pushd "$final_path" ynh_use_nodejs @@ -111,7 +112,7 @@ popd #================================================= # CREATE DIRECTORY FOR DATA #================================================= -ynh_script_progression --message="Creating the data directory..." +ynh_script_progression --message="Creating the data directory..." --weight=1 # Define app's data directory data_path="/home/yunohost.app/${app}" @@ -127,6 +128,7 @@ chown -R $app:www-data "$data_path" #================================================= # CONFIGURE HASTE #================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_add_config --template="../conf/config.js" --destination="$final_path/config.js" @@ -168,6 +170,7 @@ ynh_use_logrotate #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" diff --git a/scripts/remove b/scripts/remove index e567844..f79f779 100755 --- a/scripts/remove +++ b/scripts/remove @@ -69,15 +69,10 @@ ynh_remove_logrotate #================================================= # REMOVE HASTE BINARY #================================================= +ynh_script_progression --message="Removing various files..." --weight=1 ynh_secure_remove --file="/usr/bin/$app" -#================================================= -# REMOVE DATADIR DIRECTORY -#================================================= - -ynh_secure_remove --file="$data_path" - #================================================= # REMOVE DATA DIR #================================================= @@ -92,6 +87,7 @@ fi #================================================= # REMOVE NODEJS #================================================= +ynh_script_progression --message="Removing dependencies..." --weight=5 ynh_remove_nodejs diff --git a/scripts/restore b/scripts/restore index 234e2c8..3ff4e61 100755 --- a/scripts/restore +++ b/scripts/restore @@ -40,6 +40,7 @@ test ! -d $final_path || ynh_die "There is already a directory: $final_path " #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" @@ -70,12 +71,21 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # RESTORE VARIOUS FILES #================================================= +ynh_script_progression --message="Restoring the data directory..." --weight=1 -ynh_restore_file --origin_path="$data_path" +ynh_restore_file --origin_path="$data_path" --not_mandatory + +# Create app folders +mkdir -p "$data_path" + +chmod 750 "$data_path" +chmod -R o-rwx "$data_path" +chown -R $app:www-data "$data_path" #================================================= # RESTORE BINARY #================================================= +ynh_script_progression --message="Restoring various files..." --weight=1 ynh_restore_file --origin_path="/usr/bin/$app" @@ -100,6 +110,7 @@ chown $app -R /var/log/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log" @@ -111,6 +122,13 @@ ynh_script_progression --message="Restoring the systemd configuration..." --weig ynh_restore_file --origin_path="/etc/systemd/system/$app.service" systemctl enable $app.service --quiet +#================================================= +# RESTORE THE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1 + +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -118,12 +136,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action=start --log_path="/var/log/$app/$app.log" -#================================================= -# RESTORE THE LOGROTATE CONFIGURATION -#================================================= - -ynh_restore_file --origin_path="/etc/logrotate.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index c21fc75..103c625 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -108,12 +108,14 @@ ynh_system_user_create --username=$app #================================================= # UPGRADE NODEJS #================================================= +ynh_script_progression --message="Upgrading dependencies..." --weight=8 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= # UPGRADE NPM MODULES #================================================= +ynh_script_progression --message="Installing $app..." --weight=8 pushd "$final_path" ynh_use_nodejs @@ -149,6 +151,7 @@ ynh_replace_string --match_string="https://ajax.googleapis.com/ajax/libs/jquery/ #================================================= # UPGRADE HASTE BINARY #================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 haste_url="${domain}${path_url}" ynh_add_config --template="../conf/haste.sh" --destination="/usr/bin/$app" @@ -167,6 +170,7 @@ chmod +x /usr/bin/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description="Haste is a pastebin software" --log="/var/log/$app/$app.log"