From 8a2ff1a1aef5bbf4723e9e68224f62cb55f62d99 Mon Sep 17 00:00:00 2001 From: Robles Rodolphe Date: Mon, 29 Mar 2021 20:27:48 +0200 Subject: [PATCH] clean syntax for scripts with new release helpers in yunohost --- manifest.json | 12 ------------ scripts/backup | 2 +- scripts/install | 3 --- scripts/upgrade | 36 ++++++------------------------------ 4 files changed, 7 insertions(+), 46 deletions(-) diff --git a/manifest.json b/manifest.json index 7ca9676..0545d5b 100644 --- a/manifest.json +++ b/manifest.json @@ -26,29 +26,17 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Garradin", - "fr": "Choisissez un domaine pour Garradin" - }, "example": "domain.org" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for Garradin", - "fr": "Choisissez un chemin pour Garradin" - }, "example": "/garradin", "default": "/garradin" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "help": { "en": "The SSO is not implemented for this app and yunohost is not sure for hundred of users...", "fr": "Le SSO n'est pas implémenté pour cette application et yunohost n'est pas sûr pour une centaine d'utilisateurs..." diff --git a/scripts/backup b/scripts/backup index 2ba0d4f..551df9d 100644 --- a/scripts/backup +++ b/scripts/backup @@ -20,7 +20,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." +ynh_print_info "Declaring files to be backed up..." app=$YNH_APP_INSTANCE_NAME diff --git a/scripts/install b/scripts/install index 65582d4..9ff666a 100644 --- a/scripts/install +++ b/scripts/install @@ -33,9 +33,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Normalize the URL path syntax -path_url=$(ynh_normalize_url_path $path_url) - # Check web path availability ynh_webpath_available $domain $path_url # Register (book) web path diff --git a/scripts/upgrade b/scripts/upgrade index 5c20f28..fd06324 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -25,8 +25,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) # CHECK VERSION #================================================= if ynh_compare_current_package_version --comparison lt --version 0.9.8.1~ynh1; then - ynh_print_info --message="Sorry your version is outdated and need first an update to version O.9.8.1 with the branch 0.9.8, proceed like that:'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug' and please first connect to your garradin admin page before next update to version 1.0.*" - ynh_die "Sorry your version is outdated and need first an update to version O.9.8.1 with the branch 0.9.8, proceed like that: 'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug' and please first connect to your garradin admin page before next update to version 1.0.*" + ynh_print_info --message="Sorry your version is outdated and need first an update to version O.9.8.1 with the branch 0.9.8, proceed like that: 'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug'" + ynh_die "Sorry your version is outdated and need first an update to version O.9.8.1 with the branch 0.9.8, proceed like that: 'sudo yunohost app upgrade garradin -u https://github.com/YunoHost-Apps/garradin_ynh/tree/0.9.8 --debug'" else upgrade_type=$(ynh_check_app_version_changed) fi @@ -42,28 +42,6 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -### If nobody installed your app before 3.7, -### then you may safely remove these lines - -# Cleaning legacy permissions -# is_public=$(ynh_app_setting_get --app=$app --key=is_public) - -if [ -n "$is_public" ]; then - # Remove protected_uris - ynh_app_setting_delete --app=$app --key=protected_uris - - #Removing skipped/unprotected_uris under certain conditions, remove the visitors group added during the migration process of 3.7 - #Remove skipped_uris. If the app was public, add visitors again to the main permission - if ynh_permission_has_user --permission=main --user=visitors - then - ynh_app_setting_delete --app=$app --key=skipped_uris - ynh_permission_update --permission "main" --add "visitors" - else - ynh_app_setting_delete --app=$app --key=skipped_uris - fi - ynh_app_setting_delete --app=$app --key=is_public -fi - #================================================= # Backup Data #================================================= @@ -99,11 +77,7 @@ ynh_abort_if_errors #================================================= ynh_script_progression --message="Upgrading source files..." --weight=5 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - # Download, check integrity, uncompress and patch the source from app.src - ynh_setup_source --dest_dir="$final_path" -fi +$upgrade_type == "UPGRADE_APP" #================================================= # CREATE DEDICATED USER @@ -128,7 +102,7 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2 # Create a dedicated PHP-FPM config ynh_add_fpm_config --package="$extra_php_dependencies" - +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #======================================================= # backup bdd, squelettes directory and config.local.php #======================================================= @@ -140,11 +114,13 @@ backup_squelettes=/tmp/squelettes if [ -d "$backup_squelettes" ] then cp -ar $backup_squelettes $final_path/www/squelettes + rm -r $backup_squelettes fi if [ -e "$backup_bdd" ] then cp -a $backup_bdd $final_path/association.sqlite + rm -r $backup_bdd fi key=$(ynh_string_random --length=50)