From 8237df4b7c79cda34b94b7f88f4ef1987d491323 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Fri, 30 Aug 2024 22:47:04 +0200 Subject: [PATCH 1/4] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 1 + conf/systemd.service | 4 ++-- manifest.toml | 3 ++- scripts/_common.sh | 28 +++++++------------------ scripts/backup | 21 ++++++++----------- scripts/change_url | 14 ++++++------- scripts/install | 50 ++++++++++++++++++++++---------------------- scripts/remove | 20 +++++++++--------- scripts/restore | 31 +++++++++++++-------------- scripts/upgrade | 47 +++++++++++++++++++---------------------- 10 files changed, 101 insertions(+), 118 deletions(-) diff --git a/.gitignore b/.gitignore index 783a4ae..8f144f3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *~ *.sw[op] +.DS_Store diff --git a/conf/systemd.service b/conf/systemd.service index 5c6b613..d770135 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,8 +9,8 @@ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/sources/ Environment=NODE_ENV=production Environment=NODE_CONFIG_DIR=__INSTALL_DIR__/sources/config/ -Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__YNH_NPM__ start +Environment="PATH=__PATH_WITH_NODEJS__" +ExecStart=__NODEJS_DIR__/npm start StandardOutput=syslog StandardError=syslog SyslogIdentifier=__APP__ diff --git a/manifest.toml b/manifest.toml index 6d6f359..d2619f2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,7 +19,8 @@ code = "https://framagit.org/squeak/dato" website = "https://squeak.eauchat.org/dato" [integration] -yunohost = ">= 11.2.10" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true ldap = false diff --git a/scripts/_common.sh b/scripts/_common.sh index 2a0dbe8..e0a3bde 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,16 +1,12 @@ #!/bin/bash #================================================= -# COMMON VARIABLES +# COMMON VARIABLES AND CUSTOM HELPERS #================================================= # nodejs version nodejs_version=12 -#================================================= -# PERSONAL HELPERS -#================================================= - bool_to_str() { bool_str=(false true) echo "${bool_str[$1]}" @@ -20,24 +16,16 @@ dato_setup_config_files() { mkdir -p "$install_dir/sources/config/" # setup public dato config - ynh_add_config --template="public.js" --destination="$install_dir/sources/config/public.js" - chmod 400 "$install_dir/sources/config/public.js" - chown "$app:$app" "$install_dir/sources/config/public.js" + ynh_config_add --template="public.js" --destination="$install_dir/sources/config/public.js" + #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/sources/config/public.js" + #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/sources/config/public.js" # setup private dato config if [[ $autosynchronize == true ]]; then - ynh_add_config --template="private-autosync.js" --destination="$install_dir/sources/config/private.js" + ynh_config_add --template="private-autosync.js" --destination="$install_dir/sources/config/private.js" else - ynh_add_config --template="private.js" --destination="$install_dir/sources/config/private.js" + ynh_config_add --template="private.js" --destination="$install_dir/sources/config/private.js" fi - chmod 400 "$install_dir/sources/config/private.js" - chown "$app:$app" "$install_dir/sources/config/private.js" + #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 400 "$install_dir/sources/config/private.js" + #REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown "$app:$app" "$install_dir/sources/config/private.js" } - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - -#================================================= -# FUTURE OFFICIAL HELPERS -#================================================= diff --git a/scripts/backup b/scripts/backup index e0b47e8..32d0608 100755 --- a/scripts/backup +++ b/scripts/backup @@ -8,43 +8,40 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers -#================================================= -# DECLARE DATA AND CONF FILES TO BACKUP -#================================================= -ynh_print_info --message="Declaring files to be backed up..." +ynh_print_info "Declaring files to be backed up..." #================================================= # BACKUP THE APP MAIN DIR #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP THE SYSTEM CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_backup --src_path="/etc/logrotate.d/$app" +ynh_backup "/etc/logrotate.d/$app" -ynh_backup --src_path="/etc/systemd/system/$app.service" +ynh_backup "/etc/systemd/system/$app.service" #================================================= # BACKUP VARIOUS FILES #================================================= -ynh_backup --src_path="/var/log/$app/" +ynh_backup "/var/log/$app/" if [[ "$autosynchronize" == true ]]; then # backup dato.ini config in couch - ynh_backup --src_path="/opt/couchdb/etc/local.d/$app.ini" + ynh_backup "/opt/couchdb/etc/local.d/$app.ini" # notify that couchdb users and dbs are left - ynh_print_warn --message="Please note that backing up dato doesn't backup the databases you created through it. To backup your data, you should backup the couchdb app." + ynh_print_warn "Please note that backing up dato doesn't backup the databases you created through it. To backup your data, you should backup the couchdb app." fi #================================================= # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." +ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index bd7390c..4f041e0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -10,27 +10,27 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping $app's systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" +ynh_systemctl --service="$app" --action="stop" --log_path="systemd" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting $app's systemd service..." --weight=60 +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600 +ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="electrode server listening on port" --timeout=600 #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --last +ynh_script_progression "Change of URL completed for $app" diff --git a/scripts/install b/scripts/install index 80b9293..8c2d5df 100755 --- a/scripts/install +++ b/scripts/install @@ -13,19 +13,19 @@ source /usr/share/yunohost/helpers # Convert to true/false autosynchronize=$(bool_to_str "$autosynchronize") -ynh_app_setting_set --app="$app" --key=autosynchronize --value="$autosynchronize" +ynh_app_setting_set --key=autosynchronize --value="$autosynchronize" #================================================= # INSTALL NODEJS #================================================= -ynh_script_progression --message="Installing NodeJS..." --weight=6 +ynh_script_progression "Installing NodeJS..." -ynh_install_nodejs --nodejs_version="$nodejs_version" +ynh_nodejs_install #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=2 +ynh_script_progression "Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/sources" @@ -36,17 +36,17 @@ chown -R "$app:www-data" "$install_dir/sources" #================================================= # BUILD NODE DEPENDENCIES #================================================= -ynh_script_progression --message="Building node dependencies..." --weight=90 +ynh_script_progression "Building node dependencies..." pushd "$install_dir/sources" - ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --loglevel warn + + ynh_hide_warnings ynh_exec_as_app node_load_PATH" npm install --loglevel warn popd #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Adding $app's configuration file..." --weight=3 +ynh_script_progression "Adding $app's configuration file..." dato_setup_config_files @@ -59,10 +59,10 @@ if [[ $autosynchronize == true ]]; then #================================================= # CUSTOMIZE COUCHDB SETTINGS #================================================= - ynh_script_progression --message="Customizing couch config..." --weight=2 + ynh_script_progression "Customizing couch config..." # make sure that couchdb has CORS enabled and that it accepts requests from dato domain - ynh_add_config --template="couch.ini" --destination="/opt/couchdb/etc/local.d/$app.ini" + ynh_config_add --template="couch.ini" --destination="/opt/couchdb/etc/local.d/$app.ini" # restart couchdb service so that it takes into consideration the changes yunohost service restart couchdb @@ -70,7 +70,7 @@ if [[ $autosynchronize == true ]]; then #================================================= # SETUP A COUCHDB DATO ADMIN USER #================================================= - ynh_script_progression --message="Setting up admin user in couch..." --weight=2 + ynh_script_progression "Setting up admin user in couch..." # figure out couch url with password couch_pw_url=$(echo "$couch_url" | sed -En "s+^https?://+https://$couch_admin_name:$couch_admin_password@+p") @@ -83,10 +83,10 @@ if [[ $autosynchronize == true ]]; then # display error message if there was an error creating dato admin user in couch if [[ $addDatoAdmin_curlResult != '{"ok":true'* ]]; then - ynh_print_err --message="There was an error creating the dato admin user for in couch. You will probably have to do it manually (check the last section of this page for instructions: https://squeak.eauchat.org/apps/dato/?setups)." - ynh_print_err --message="Here is the error message from couchdb:" - ynh_print_err --message="$addDatoAdmin_curlResult" - ynh_print_err --message="Please make sure that your couchdb instance is accessible from the url you provided, with a proper SSL certificate (not a self-signed one), otherwise you will not be able to login to dato!" + ynh_print_warn "There was an error creating the dato admin user for in couch. You will probably have to do it manually (check the last section of this page for instructions: https://squeak.eauchat.org/apps/dato/?setups)." + ynh_print_warn "Here is the error message from couchdb:" + ynh_print_warn "$addDatoAdmin_curlResult" + ynh_print_warn "Please make sure that your couchdb instance is accessible from the url you provided, with a proper SSL certificate (not a self-signed one), otherwise you will not be able to login to dato!" fi # modify _users db _security document @@ -99,9 +99,9 @@ if [[ $autosynchronize == true ]]; then # display error message if there was an error modifying _users db _security document if [[ $usersSecDocChange_curlResult != '{"ok":true'* ]]; then - ynh_print_err --message="There was an error enabling dato users to access their user profile in couch. You will have to do it manually (check the 'Configure couchdb so that it accepts requests from dato' section in the following page for instructions: https://squeak.eauchat.org/apps/dato/?setups)." - ynh_print_err --message="Here is the error message from couchdb:" - ynh_print_err --message="$usersSecDocChange_curlResult" + ynh_print_warn "There was an error enabling dato users to access their user profile in couch. You will have to do it manually (check the 'Configure couchdb so that it accepts requests from dato' section in the following page for instructions: https://squeak.eauchat.org/apps/dato/?setups)." + ynh_print_warn "Here is the error message from couchdb:" + ynh_print_warn "$usersSecDocChange_curlResult" fi fi @@ -116,28 +116,28 @@ chown -R "$app:$app" "$install_dir/sources/dist" "$install_dir/sources/config" #================================================= # SYSTEM CONFIGURATION #================================================= -ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 +ynh_script_progression "Adding system configurations related to $app..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx # Create a dedicated systemd config -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add "$app" --description="Data storage with a convenient and flexible interface" --log="/var/log/$app/$app.log" # Use logrotate to manage application logfile(s) -ynh_use_logrotate +ynh_config_add_logrotate #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting $app's systemd service..." --weight=60 +ynh_script_progression "Starting $app's systemd service..." # Start a systemd service -ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600 +ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="electrode server listening on port" --timeout=600 #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --last +ynh_script_progression "Installation of $app completed" diff --git a/scripts/remove b/scripts/remove index b6b741a..576ca5d 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,29 +10,29 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 +ynh_script_progression "Removing system configurations related to $app..." # 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; then +if ynh_hide_warnings yunohost service status "$app" >/dev/null; then yunohost service remove "$app" fi # Remove the dedicated systemd config -ynh_remove_systemd_config +ynh_config_remove_systemd # Remove the app-specific logrotate config -ynh_remove_logrotate +ynh_config_remove_logrotate # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # REMOVE NODEJS #================================================= -ynh_script_progression --message="Removing NodeJS..." --weight=13 +ynh_script_progression "Removing NodeJS..." # Remove metapackage and its dependencies -ynh_remove_nodejs +ynh_nodejs_remove #================================================= # AUTOSYNCHRONIZED SPECIFICS @@ -40,14 +40,14 @@ ynh_remove_nodejs if [[ $autosynchronize == true ]]; then # Remove dato specific config added to couch - ynh_secure_remove --file="/opt/couchdb/etc/local.d/$app.ini" + ynh_safe_rm "/opt/couchdb/etc/local.d/$app.ini" # notify that couchdb users and dbs are left - ynh_print_warn --message="Please note that dbs and users in the attached couchdb instance haven't been modified. If you want them removed, you should do that manually, for example from the couchdb web interface." + ynh_print_warn "Please note that dbs and users in the attached couchdb instance haven't been modified. If you want them removed, you should do that manually, for example from the couchdb web interface." fi #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of $app completed" --last +ynh_script_progression "Removal of $app completed" diff --git a/scripts/restore b/scripts/restore index 86f1a29..cb45568 100755 --- a/scripts/restore +++ b/scripts/restore @@ -11,21 +11,20 @@ source /usr/share/yunohost/helpers #================================================= # REINSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Reinstalling NodeJS..." --weight=5 +ynh_script_progression "Reinstalling NodeJS..." # Define and install dependencies -ynh_install_nodejs --nodejs_version="$nodejs_version" +ynh_nodejs_install #================================================= # RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring the app main directory..." --weight=1 +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" +ynh_restore "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" mkdir -p "$install_dir/sources/dist" chown -R "$app:$app" "$install_dir/sources/dist" "$install_dir/sources/global" "$install_dir/sources/config" @@ -35,33 +34,33 @@ chown -R "$app:$app" "$install_dir/sources/dist" "$install_dir/sources/global" " # restore dato.ini config in couch if [[ $autosynchronize == true ]]; then - ynh_restore_file --origin_path="/opt/couchdb/etc/local.d/$app.ini" + ynh_restore "/opt/couchdb/etc/local.d/$app.ini" fi #================================================= # RESTORE SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1 +ynh_script_progression "Restoring system configurations related to $app..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -ynh_restore_file --origin_path="/etc/systemd/system/$app.service" +ynh_restore "/etc/systemd/system/$app.service" systemctl enable "$app.service" --quiet yunohost service add "$app" --description="Data storage with a convenient and flexible interface" --log="/var/log/$app/$app.log" -ynh_restore_file --origin_path="/etc/logrotate.d/$app" +ynh_restore "/etc/logrotate.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM OR THE APP SERVICE #================================================= -ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1 +ynh_script_progression "Reloading NGINX web server and $app's service..." -ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600 +ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="electrode server listening on port" --timeout=600 -ynh_systemd_action --service_name=nginx --action=reload +ynh_systemctl --service=nginx --action=reload #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for $app" --last +ynh_script_progression "Restoration completed for $app" diff --git a/scripts/upgrade b/scripts/upgrade index d80454e..98e8de3 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,14 +10,14 @@ source /usr/share/yunohost/helpers #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --weight=1 +ynh_script_progression "Stopping $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd" +ynh_systemctl --service="$app" --action="stop" --log_path="systemd" #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +ynh_script_progression "Ensuring downward compatibility..." # Cleanup legacy install dir if [ ! -d "$install_dir/sources" ]; then @@ -28,66 +28,63 @@ fi #================================================= # UPGRADE DEPENDENCIES #================================================= -ynh_script_progression --message="Upgrading NodeJS..." --weight=5 +ynh_script_progression "Upgrading NodeJS..." -ynh_install_nodejs --nodejs_version="$nodejs_version" +ynh_nodejs_install #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Upgrading source files..." --weight=3 +ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir/sources" --full_replace=1 --keep="config" +ynh_setup_source --dest_dir="$install_dir/sources" --full_replace --keep="config" -chmod -R o-rwx "$install_dir" -chown -R "$app:www-data" "$install_dir" - -#================================================= -# SPECIFIC UPGRADE +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" +#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" #================================================= # BUILD NODE DEPENDENCIES #================================================= -ynh_script_progression --message="Building node dependencies..." --weight=20 +ynh_script_progression "Building node dependencies..." pushd "$install_dir/sources" - ynh_use_nodejs - ynh_secure_remove --file="$install_dir/node_modules/" - ynh_secure_remove --file="$install_dir/package-lock.json" - ynh_exec_warn_less ynh_exec_as "$app" "$ynh_node_load_PATH" "$ynh_npm" install --loglevel warn + + ynh_safe_rm "$install_dir/node_modules/" + ynh_safe_rm "$install_dir/package-lock.json" + ynh_hide_warnings ynh_exec_as_app node_load_PATH" npm install --loglevel warn popd #================================================= # ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Updating $app's configuration file..." --weight=3 +ynh_script_progression "Updating $app's configuration file..." dato_setup_config_files #================================================= # REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 +ynh_script_progression "Upgrading system configurations related to $app..." # Create a dedicated NGINX config -ynh_add_nginx_config +ynh_config_add_nginx # Create a dedicated systemd config -ynh_add_systemd_config +ynh_config_add_systemd yunohost service add "$app" --description="Data storage with a convenient and flexible interface" --log="/var/log/$app/$app.log" # Use logrotate to manage app-specific logfile(s) -ynh_use_logrotate --non-append +ynh_config_add_logrotate #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting $app's systemd service..." --weight=1 +ynh_script_progression "Starting $app's systemd service..." -ynh_systemd_action --service_name="$app" --action="start" --log_path="systemd" --line_match="electrode server listening on port" --timeout=600 +ynh_systemctl --service="$app" --action="start" --log_path="systemd" --wait_until="electrode server listening on port" --timeout=600 #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed" From c9925adf3334e677921fecf5dc19397056d33179 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 31 Aug 2024 15:45:49 +0200 Subject: [PATCH 2/4] cleaning --- scripts/install | 4 +--- scripts/upgrade | 9 +-------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index 8c2d5df..3b740dd 100755 --- a/scripts/install +++ b/scripts/install @@ -27,7 +27,6 @@ ynh_nodejs_install #================================================= ynh_script_progression "Setting up source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/sources" chmod -R o-rwx "$install_dir/sources" @@ -39,8 +38,7 @@ chown -R "$app:www-data" "$install_dir/sources" ynh_script_progression "Building node dependencies..." pushd "$install_dir/sources" - - ynh_hide_warnings ynh_exec_as_app node_load_PATH" npm install --loglevel warn + ynh_hide_warnings ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --loglevel warn popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 98e8de3..ba29708 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,21 +37,17 @@ ynh_nodejs_install #================================================= ynh_script_progression "Upgrading source files..." -# Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir/sources" --full_replace --keep="config" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" #================================================= # BUILD NODE DEPENDENCIES #================================================= ynh_script_progression "Building node dependencies..." pushd "$install_dir/sources" - ynh_safe_rm "$install_dir/node_modules/" ynh_safe_rm "$install_dir/package-lock.json" - ynh_hide_warnings ynh_exec_as_app node_load_PATH" npm install --loglevel warn + ynh_hide_warnings ynh_hide_warnings ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --loglevel warn popd #================================================= @@ -66,14 +62,11 @@ dato_setup_config_files #================================================= ynh_script_progression "Upgrading system configurations related to $app..." -# Create a dedicated NGINX config ynh_config_add_nginx -# Create a dedicated systemd config ynh_config_add_systemd yunohost service add "$app" --description="Data storage with a convenient and flexible interface" --log="/var/log/$app/$app.log" -# Use logrotate to manage app-specific logfile(s) ynh_config_add_logrotate #================================================= From 0119a9dc8af8a18891a2c4069269f7f72bcce592 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 31 Aug 2024 15:46:00 +0200 Subject: [PATCH 3/4] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index d2619f2..b90df6d 100644 --- a/manifest.toml +++ b/manifest.toml @@ -19,7 +19,7 @@ code = "https://framagit.org/squeak/dato" website = "https://squeak.eauchat.org/dato" [integration] -yunohost = ">= 11.2.18" +yunohost = ">= 11.2.29" helpers_version = "2.1" architectures = "all" multi_instance = true From c34e13701e4a00d1e0343a238b8bcf87eccb8183 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 31 Aug 2024 15:46:54 +0200 Subject: [PATCH 4/4] cleaning --- scripts/backup | 1 - scripts/remove | 10 ---------- scripts/restore | 4 ---- 3 files changed, 15 deletions(-) diff --git a/scripts/backup b/scripts/backup index 32d0608..bf26fcf 100755 --- a/scripts/backup +++ b/scripts/backup @@ -4,7 +4,6 @@ # IMPORT GENERIC HELPERS #================================================= -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers diff --git a/scripts/remove b/scripts/remove index 576ca5d..6437b81 100755 --- a/scripts/remove +++ b/scripts/remove @@ -12,26 +12,16 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression "Removing system configurations related to $app..." -# Remove the service from the list of services known by YunoHost (added from `yunohost service add`) if ynh_hide_warnings yunohost service status "$app" >/dev/null; then yunohost service remove "$app" fi -# Remove the dedicated systemd config ynh_config_remove_systemd -# Remove the app-specific logrotate config ynh_config_remove_logrotate -# Remove the dedicated NGINX config ynh_config_remove_nginx -#================================================= -# REMOVE NODEJS -#================================================= -ynh_script_progression "Removing NodeJS..." - -# Remove metapackage and its dependencies ynh_nodejs_remove #================================================= diff --git a/scripts/restore b/scripts/restore index cb45568..ac2d356 100755 --- a/scripts/restore +++ b/scripts/restore @@ -4,7 +4,6 @@ # IMPORT GENERIC HELPERS #================================================= -# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -13,7 +12,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression "Reinstalling NodeJS..." -# Define and install dependencies ynh_nodejs_install #================================================= @@ -23,8 +21,6 @@ ynh_script_progression "Restoring the app main directory..." ynh_restore "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx "$install_dir" -#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R "$app:www-data" "$install_dir" mkdir -p "$install_dir/sources/dist" chown -R "$app:$app" "$install_dir/sources/dist" "$install_dir/sources/global" "$install_dir/sources/config"