From c65b32ae06fc3528d3cbdb41ee26c6ae5073a6db Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 02:06:00 +0200 Subject: [PATCH] Apply last example_ynh --- scripts/install | 7 +++---- scripts/restore | 8 +++----- scripts/upgrade | 4 ++-- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/scripts/install b/scripts/install index 068d833..d8aed93 100755 --- a/scripts/install +++ b/scripts/install @@ -69,7 +69,7 @@ ynh_install_app_dependencies $pkg_dependencies ynh_script_progression --message="Configuring system user..." # Create a system user -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -78,8 +78,7 @@ ynh_script_progression --message="Setting up source files..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src -mkdir "$final_path" -mkdir "$final_path/tmp" +mkdir -p "$final_path/tmp" ynh_setup_source --dest_dir="$final_path/tmp" cp -a "$final_path/tmp/src/." "$final_path/." ynh_secure_remove "$final_path/tmp" @@ -233,7 +232,7 @@ ynh_script_progression --message="Configuring permissions..." ynh_permission_update --permission="main" --add="visitors" domain_regex=$(echo "$domain" | sed 's@-@.@g') -ynh_permission_create --permission="autodiscover" --url "re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true" +ynh_permission_create --permission="autodiscover" --url="re:$domain_regex/[Aa]uto[Dd]iscover/.*" --allowed="visitors" --show_tile="false" --protected="true" #================================================= # RELOAD NGINX diff --git a/scripts/restore b/scripts/restore index e1552e1..7c473c5 100755 --- a/scripts/restore +++ b/scripts/restore @@ -59,7 +59,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_script_progression --message="Recreating the dedicated system user..." # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # RESTORE THE APP MAIN DIR @@ -70,15 +70,13 @@ ynh_restore_file --origin_path="$final_path" # Restore statedir ynh_restore_file --origin_path="$statedir" --not_mandatory - -# Restore logs, data & permissions -ynh_restore_file --origin_path="$final_logpath" --not_mandatory - mkdir -p $statedir chmod 750 "$statedir" chmod -R o-rwx "$statedir" chown -R root:$app "$statedir" +# Restore logs, data & permissions +ynh_restore_file --origin_path="$final_logpath" --not_mandatory mkdir -p $final_logpath chmod 750 "$final_logpath" chmod -R o-rwx "$final_logpath" diff --git a/scripts/upgrade b/scripts/upgrade index 0a53c57..e43d887 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,7 +56,7 @@ if ynh_legacy_permissions_exists; then fi #================================================= -# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP +# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." @@ -77,7 +77,7 @@ ynh_abort_if_errors ynh_script_progression --message="Making sure dedicated system user exists..." # Create a dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE