From a8d8ac341805f4e754c0ada48234b580d2ab02d0 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sat, 31 Aug 2024 00:58:47 +0200 Subject: [PATCH] [autopatch] Automatic patch attempt for helpers 2.1 --- .gitignore | 2 ++ manifest.toml | 4 +++- scripts/_common.sh | 5 ----- scripts/backup | 17 ++++------------- scripts/change_url | 14 +++----------- scripts/install | 36 +++++++++++++----------------------- scripts/remove | 12 +++--------- scripts/restore | 29 ++++++++++------------------- scripts/upgrade | 41 ++++++++++++----------------------------- 9 files changed, 50 insertions(+), 110 deletions(-) diff --git a/.gitignore b/.gitignore index cd2946a..25a9140 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,5 @@ $RECYCLE.BIN/ Network Trash Folder Temporary Items .apdisk +*~ +*.sw[op] diff --git a/manifest.toml b/manifest.toml index 9615a58..4b5064c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -17,7 +17,8 @@ admindoc = "https://github.com/keeweb/keeweb/wiki" code = "https://github.com/keeweb/keeweb" [integration] -yunohost = ">= 11.2" +yunohost = ">= 11.2.18" +helpers_version = "2.1" architectures = "all" multi_instance = true @@ -47,6 +48,7 @@ ram.runtime = "50M" [resources.system_user] [resources.install_dir] + group = "www-data:r-x" [resources.permissions] main.url = "/" diff --git a/scripts/_common.sh b/scripts/_common.sh index cf080fd..a9bf588 100755 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,6 +1 @@ #!/bin/bash - -#================================================= -# EXPERIMENTAL HELPERS -#================================================= - diff --git a/scripts/backup b/scripts/backup index 5669879..88170da 100644 --- a/scripts/backup +++ b/scripts/backup @@ -1,33 +1,24 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - 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 OF THE MAIN DIR OF THE APP #================================================= -ynh_backup --src_path="$install_dir" +ynh_backup "$install_dir" #================================================= # BACKUP OF THE NGINX CONFIGURATION #================================================= -ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" #================================================= # 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 6a52cf0..39d37fc 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -1,25 +1,17 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." +ynh_script_progression "Updating NGINX web server configuration..." -ynh_change_url_nginx_config +ynh_config_change_url_nginx #================================================= # 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 a938a1c..995a70a 100644 --- a/scripts/install +++ b/scripts/install @@ -1,32 +1,24 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# STANDARD MODIFICATIONS #================================================= # INSTALL SOURCES #================================================= -ynh_script_progression --message="Setting up source files..." +ynh_script_progression "Setting up source files..." # To avoid a complete rebuild, I downloaded the gh-pages as explained here: https://github.com/keeweb/keeweb#self-hosting -# and put all files in "../sources/extra_files/app/", like that I can assure the version install in YunoHost is the version described in the manifest +# and put all files in "../sources/", like that I can assure the version install in YunoHost is the version described in the manifest mkdir -p "$install_dir" -cp -r ../sources/extra_files/app/* "$install_dir" +cp -r ../sources/* "$install_dir" #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring NGINX web server..." +ynh_script_progression "Configuring NGINX web server..." -ynh_add_nginx_config +ynh_config_add_nginx #================================================= # SPECIFIC SETUP @@ -34,28 +26,26 @@ ynh_add_nginx_config # USE THE CONFIG FILE #================================================= -ynh_replace_string "(no-config)" "config.json" "$install_dir/index.html" +# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file= +ynh_replace "(no-config)" "config.json" "$install_dir/index.html" #================================================= # COPY THE CONFIG FILE #================================================= -ynh_script_progression --message="Adding a configuration file..." +ynh_script_progression "Adding $app's configuration..." -ynh_add_config --template="config.json" --destination="$install_dir/config.json" +ynh_config_add --template="config.json" --destination="$install_dir/config.json" -#================================================= -# GENERIC FINALISATION #================================================= # SECURING FILES AND DIRECTORIES #================================================= # Les fichiers appartiennent à root -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$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 750 "$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" #================================================= # 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 bd9719d..0b0795d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -1,24 +1,18 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing NGINX web server configuration..." +ynh_script_progression "Removing NGINX web server configuration..." # Remove the dedicated NGINX config -ynh_remove_nginx_config +ynh_config_remove_nginx #================================================= # 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 8527c73..a55f00f 100644 --- a/scripts/restore +++ b/scripts/restore @@ -1,43 +1,34 @@ #!/bin/bash -#================================================= -# GENERIC START -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers #================================================= # RESTORE OF THE MAIN DIR OF THE APP #================================================= -ynh_script_progression --message="Restoring the app main directory..." +ynh_script_progression "Restoring the app main directory..." -ynh_restore_file --origin_path="$install_dir" - -chmod 750 "$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 750 "$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" #================================================= # RESTORE OF THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." +ynh_script_progression "Restoring the NGINX configuration..." -ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" +ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# GENERIC FINALISATION #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." +ynh_script_progression "Reloading NGINX web server and PHP-FPM..." -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 2026407..cd34cc7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -1,68 +1,51 @@ #!/bin/bash -#================================================= -# GENERIC STARTING -#================================================= -# IMPORT GENERIC HELPERS -#================================================= - source _common.sh source /usr/share/yunohost/helpers -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - -#================================================= -# STANDARD UPGRADE STEPS #================================================= # INSTALL SOURCES #================================================= -if [ "$upgrade_type" == "UPGRADE_APP" ] +# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed +if ynh_app_upstream_version_changed then - ynh_script_progression --message="Upgrading source files..." + ynh_script_progression "Upgrading source files..." # Download, check integrity, uncompress and patch the source from app.src mkdir -p "$install_dir" - cp -r ../sources/extra_files/app/* "$install_dir" + cp -r ../sources/* "$install_dir" fi #================================================= # NGINX CONFIGURATION #================================================= -ynh_add_nginx_config +ynh_config_add_nginx -#================================================= -# SPECIFIC UPGRADE #================================================= # USE THE CONFIG FILE #================================================= -ynh_replace_string "(no-config)" "config.json" "$install_dir/index.html" +# FIXMEhelpers2.1: ynh_replace used with positional args. Please add the keywords: --match=, --replace=, --file= +ynh_replace "(no-config)" "config.json" "$install_dir/index.html" #================================================= # COPY THE CONFIG FILE #================================================= # Copie ou modification d'un fichier de config -ynh_add_config --template="config.json" --destination="$install_dir/config.json" +ynh_config_add --template="config.json" --destination="$install_dir/config.json" -#================================================= -# GENERIC FINALISATION #================================================= # SECURING FILES AND DIRECTORIES #================================================= -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$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 750 "$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" #================================================= # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of $app completed" --last +ynh_script_progression "Upgrade of $app completed"