From eee84c5f6670d4e9be1c59516696e3d76347246a Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 29 Jun 2024 21:32:53 +0200 Subject: [PATCH 1/5] helpers2.1: also run _ynh_apply_default_permissions in ynh_restore to be consistent (also because the user uid on the new system may be different than in the archive etc) --- helpers/helpers.v2.1.d/backup | 2 ++ 1 file changed, 2 insertions(+) diff --git a/helpers/helpers.v2.1.d/backup b/helpers/helpers.v2.1.d/backup index 0668d3e17..a40c4f1f2 100644 --- a/helpers/helpers.v2.1.d/backup +++ b/helpers/helpers.v2.1.d/backup @@ -179,6 +179,8 @@ ynh_restore() { else mv "$archive_path" "${target}" fi + + _ynh_apply_default_permissions "$target" } # Restore all files that were previously backuped in an app backup script From c2271ab7310025affcbd73ba33c340ad92ec7712 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sat, 29 Jun 2024 23:57:21 +0200 Subject: [PATCH 2/5] Update changelog for 11.2.19 --- debian/changelog | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/debian/changelog b/debian/changelog index f3d38c9c7..7a8dfacc9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +yunohost (11.2.19) stable; urgency=low + + - apps: tweaks to be more robust and prevent the stupid flood of 'sh: 0: getcwd() failed: No such file or directory' when running an app upgrade/remove from /var/www/$app, sometimes making it look like the upgrade failed when it didnt (a349fc03) + - apps: be more robust when an app upgrade succeeds but for some reason is marked with 'broke the system' ... ending up in inconsistent state between the app settings vs the app scritpts (for example in v1->v2 transitions but not only) (e5b57590) + - helpers2.1: Fix getopts error handling ... (3e1c9eba) + - helpers2.1: also run _ynh_apply_default_permissions in ynh_restore to be consistent (also because the user uid on the new system may be different than in the archive etc) (eee84c5f) + + -- Alexandre Aubin Sat, 29 Jun 2024 23:55:52 +0200 + yunohost (11.2.18) stable; urgency=low - helpers2.1: Rework _ynh_apply_default_permissions to hopefully remove the necessity to chown/chmod in the app scripts ([#1883](http://github.com/YunoHost/yunohost/pull/1883)) From a18d5f26f2b42191261d6ab3755ff838d69f8aa0 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 30 Jun 2024 00:21:40 +0200 Subject: [PATCH 3/5] helpers2.1: zgrblg --- helpers/helpers.v2.1.d/go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helpers/helpers.v2.1.d/go b/helpers/helpers.v2.1.d/go index c0b8e9022..bb272d50c 100644 --- a/helpers/helpers.v2.1.d/go +++ b/helpers/helpers.v2.1.d/go @@ -97,7 +97,7 @@ ynh_go_install () { test -x /usr/bin/go_goenv && mv /usr/bin/go_goenv /usr/bin/go # Install the requested version of Go - local final_go_version=$("$goenv_latest_dir/bin/goenv-latest" --print "$go_version") + local final_go_version=$("$GOENV_INSTALL_DIR/plugins/xxenv-latest/bin/goenv-latest" --print "$go_version") ynh_print_info "Installation of Go-$final_go_version" goenv install --quiet --skip-existing "$final_go_version" 2>&1 From 3f973669fc14de9fd45cbe1b376004b6d422d9fe Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 30 Jun 2024 01:37:56 +0200 Subject: [PATCH 4/5] helpers2.1: fix automigration of phpversion to php_version --- helpers/helpers.v2.1.d/php | 12 ------------ helpers/helpers.v2.1.d/setting | 15 +++++++++++++++ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/helpers/helpers.v2.1.d/php b/helpers/helpers.v2.1.d/php index 3cca2c8fb..b7165e010 100644 --- a/helpers/helpers.v2.1.d/php +++ b/helpers/helpers.v2.1.d/php @@ -3,18 +3,6 @@ # (this is used in the apt helpers, big meh ...) readonly YNH_DEFAULT_PHP_VERSION=7.4 -# Legacy: auto-convert phpversion to php_version (for consistency with nodejs_version, ruby_version, ...) -if [[ -n "${app:-}" ]] && [[ -n "${phpversion:-}" ]] -then - if [[ -z "${php_version:-}" ]] - then - php_version=$phpversion - ynh_app_setting_set --key=php_version --value=$php_version - fi - ynh_app_setting_delete --key=phpversion - unset phpversion -fi - # Create a dedicated PHP-FPM config # # usage: ynh_config_add_phpfpm diff --git a/helpers/helpers.v2.1.d/setting b/helpers/helpers.v2.1.d/setting index 82528efa5..01480331c 100644 --- a/helpers/helpers.v2.1.d/setting +++ b/helpers/helpers.v2.1.d/setting @@ -122,3 +122,18 @@ else: EOF eval "$xtrace_enable" } + +# Legacy: auto-convert phpversion to php_version (for consistency with nodejs_version, ruby_version, ...) +# This has to be here and not in the "php" code file because ynh_app_setting_set/delete need to be defined @_@ +if [[ -n "${app:-}" ]] && [[ -n "${phpversion:-}" ]] +then + if [[ -z "${php_version:-}" ]] + then + php_version=$phpversion + ynh_app_setting_set --key=php_version --value=$php_version + fi + ynh_app_setting_delete --key=phpversion + unset phpversion +fi + + From a48bfa67de552abcf9f9a14cc94c3fe072ffe5d3 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Sun, 30 Jun 2024 17:46:52 +0200 Subject: [PATCH 5/5] helpers2.1: change source patches location + raise an error instead of a warning when a patch fails to apply on CI MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Félix Piédallu --- helpers/helpers.v2.1.d/sources | 38 ++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 18 deletions(-) diff --git a/helpers/helpers.v2.1.d/sources b/helpers/helpers.v2.1.d/sources index c0c2fb863..59dd4f12d 100644 --- a/helpers/helpers.v2.1.d/sources +++ b/helpers/helpers.v2.1.d/sources @@ -8,11 +8,7 @@ # | arg: --keep= - Space-separated list of files/folders that will be backup/restored in $dest_dir, such as a config file you don't want to overwrite. For example 'conf.json secrets.json logs' (no trailing `/` for folders) # | arg: --full_replace= - Remove previous sources before installing new sources (can be 1 or 0, default to 0) # -# ##### New 'sources' resources -# -# (See also the resources documentation which may be more complete?) -# -# This helper will read infos from the 'sources' resources in the manifest.toml of the app +# This helper will read infos from the 'sources' resources in the `manifest.toml` of the app # and expect a structure like: # # ```toml @@ -22,7 +18,9 @@ # sha256 = "0123456789abcdef" # The sha256 sum of the asset obtained from the URL # ``` # -# ##### Optional flags +# (See also the resources documentation which may be more complete?) +# +# ##### Optional flags in the 'sources' resource # # ```text # format = "tar.gz"/xz/bz2 # automatically guessed from the extension of the URL, but can be set explicitly. Will use `tar` to extract @@ -60,7 +58,8 @@ # - Uncompress the archive to `$dest_dir`. # - If `in_subdir` is true, the first level directory of the archive will be removed. # - If `in_subdir` is a numeric value, the N first level directories will be removed. -# - Patches named `patches/${src_id}-*.patch` will be applied to `$dest_dir` +# - Patches named `patches/${src_id}/*.patch` will be applied to `$dest_dir` +# - Apply sane default permissions (see _ynh_apply_default_permissions) ynh_setup_source() { # ============ Argument parsing ============= local -A args_array=([d]=dest_dir= [s]=source_id= [k]=keep= [r]=full_replace) @@ -222,17 +221,20 @@ ynh_setup_source() { fi # Apply patches - if [ -d "$YNH_APP_BASEDIR/patches/" ]; then - local patches_folder=$(realpath $YNH_APP_BASEDIR/patches/) - # Check if any file matching the pattern exists, cf https://stackoverflow.com/a/34195247 - if compgen -G "$patches_folder/${source_id}-*.patch" >/dev/null; then - pushd "$dest_dir" - for p in $patches_folder/${source_id}-*.patch; do - echo $p - patch --strip=1 <$p || ynh_print_warn "Packagers /!\\ patch $p failed to apply" - done - popd - fi + local patches_folder=$(realpath "$YNH_APP_BASEDIR/patches/$source_id") + if [ -d "$patches_folder" ]; then + pushd "$dest_dir" + for patchfile in "$patches_folder/"*.patch; do + echo "Applying $patchfile" + if ! patch --strip=1 < "$patchfile"; then + if ynh_in_ci_tests; then + ynh_die "Patch $patchfile failed to apply!" + else + ynh_print_warn "Warn your packagers /!\\ Patch $patchfile failed to apply" + fi + fi + done + popd fi # Keep files to be backup/restored at the end of the helper