From d48f951085de91be0cde97b7f2f5c7a6fbcb038b Mon Sep 17 00:00:00 2001 From: ericgaspar Date: Mon, 15 Feb 2021 16:03:52 +0100 Subject: [PATCH] Small fixes --- README.md | 1 - conf/poller-cron | 2 +- manifest.json | 6 +++--- scripts/install | 15 ++------------- scripts/remove | 2 +- scripts/restore | 3 --- scripts/upgrade | 48 +++++++++++++----------------------------------- 7 files changed, 20 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 07d9f19..43aca5c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # ZAP for YunoHost - [![Integration level](https://dash.yunohost.org/integration/zap.svg)](https://dash.yunohost.org/appci/app/zap) ![](https://ci-apps.yunohost.org/ci/badges/zap.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/zap.maintain.svg) [![Install Zap with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=zap) diff --git a/conf/poller-cron b/conf/poller-cron index 31ba32f..f991757 100644 --- a/conf/poller-cron +++ b/conf/poller-cron @@ -1,2 +1,2 @@ # Run poller periodically to update Hubzilla -*/10 * * * * __USER__ cd YNH_WWW_PATH; /usr/bin/php__PHP_VERSION__ Zotlabs/Daemon/Master.php Cron > /dev/null 2>&1 \ No newline at end of file +*/10 * * * * __APP__ cd __FINALPATH__; /usr/bin/php__PHPVERSION__ Zotlabs/Daemon/Master.php Cron > /dev/null 2>&1 \ No newline at end of file diff --git a/manifest.json b/manifest.json index d60b4f8..99d0374 100644 --- a/manifest.json +++ b/manifest.json @@ -17,7 +17,7 @@ "multi_instance": true, "services": [ "nginx", - "php7.0-fpm", + "php7.3-fpm", "mysql", "postgresql" ], @@ -35,8 +35,8 @@ "name": "admin", "type": "user", "ask": { - "en": "Choose the ZAP administrator (must be an existing YunoHost user)", - "fr": "Choisissez l'administrateur de ZAP (doit ĂȘtre un utilisateur YunoHost existant)" + "en": "Choose the ZAP administrator", + "fr": "Choisissez l'administrateur de ZAP" } }, { diff --git a/scripts/install b/scripts/install index 11d001d..ca9af46 100755 --- a/scripts/install +++ b/scripts/install @@ -27,7 +27,7 @@ ynh_abort_if_errors domain=$YNH_APP_ARG_DOMAIN path_url="/" admin=$YNH_APP_ARG_ADMIN -email=$(yunohost user info $admin | grep "mail:" | cut -d' ' -f2) +email=$(ynh_user_get_info --username=$admin --key=mail) upload="256M" database="1" random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)" @@ -117,7 +117,6 @@ pushd "$final_path" popd - # 3 - Some extra folders ynh_script_progression --message="Creating smarty3 folder for personal data..." @@ -214,10 +213,7 @@ chown -R $app: $final_path # Set up cron job ynh_script_progression --message="Setting up cron job..." -ynh_replace_string --match_string="YNH_WWW_PATH" --replace_string="$final_path" --target_file="../conf/poller-cron" -ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron" -ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron" -cp ../conf/poller-cron /etc/cron.d/$app +ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app" #================================================= # STORE THE CONFIG FILE CHECKSUM @@ -241,13 +237,6 @@ ynh_script_progression --message="Add Fail2Ban..." ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.php.*failed login attempt.*from IP .*$" --max_retry="5" -#================================================= -# SETUP SSOWAT -#================================================= -ynh_script_progression --message="Configuring SSOwat..." -# As Zap is social network and have its own permission there is no need to keep Zap behind SSO -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" - #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/remove b/scripts/remove index 8655412..68fb57f 100755 --- a/scripts/remove +++ b/scripts/remove @@ -18,7 +18,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) db_name=$(ynh_app_setting_get --app=$app --key=db_name) -db_user="$db_name" +db_user=$db_name final_path=$(ynh_app_setting_get --app=$app --key=final_path) database=$(ynh_app_setting_get --app=$app --key=database) diff --git a/scripts/restore b/scripts/restore index 5f8af87..49c0376 100755 --- a/scripts/restore +++ b/scripts/restore @@ -125,9 +125,6 @@ ynh_restore_file "/etc/fail2ban/jail.d/$app.conf" ynh_restore_file "/etc/fail2ban/filter.d/$app.conf" ynh_systemd_action --action=restart --service_name=fail2ban -# Make app public -ynh_app_setting_set $app skipped_uris "/" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 59b2638..e036dbb 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -35,6 +35,18 @@ if [ -z "$db_name" ]; then ynh_app_setting_set --app=$app --key=db_name --value=$db_name fi +if [ -z "$final_path" ]; then + final_path=/var/www/$app + ynh_app_setting_set --app=$app --key=final_path --value=$final_path +fi + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -49,30 +61,6 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors - -#================================================= -# STANDARD UPGRADE STEPS -#================================================= -# REMOVE APP MAIN DIR -#================================================= -ynh_script_progression --message="Upgrading source files..." - -# Create a temporary directory - - - -# Remove the app directory securely -# ynh_secure_remove "$final_path" - -# If final_path doesn't exist, create it -if [ -z "$final_path" ]; then - final_path=/var/www/$app - ynh_app_setting_set --app=$app --key=final_path --value=$final_path -fi - - - - #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -194,10 +182,7 @@ ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.ph # Set cron job ynh_print_info "Setting up cron job..." -ynh_replace_string --match_string="YNH_WWW_PATH" --replace_string="$final_path" --target_file="../conf/poller-cron" -ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron" -ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron" -cp -f ../conf/poller-cron /etc/cron.d/$app +ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app" #================================================= # UPGRADE DEPENDENCIES @@ -208,13 +193,6 @@ if [ $database -eq 2 ]; then ynh_install_app_dependencies $pkg_dependencies fi -#================================================= -# SETUP SSOWAT -#================================================= -# As Zap is social network and have its own permission there is no need to keep Zap behind SSO -ynh_script_progression --message="Upgrading SSOwat configuration..." -ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" - #================================================= # RELOAD NGINX #=================================================