From a734ac22aa5b4faa86507e8078ceeed28c7196f5 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 20:48:50 +0200 Subject: [PATCH 01/14] Apply last example_ynh --- README.md | 4 ++-- check_process | 55 ++++++++++++++++++++++++------------------------- conf/nginx.conf | 2 +- manifest.json | 4 ---- scripts/backup | 6 +++--- scripts/install | 44 +++++++++++++++++++-------------------- scripts/remove | 4 ++-- scripts/restore | 40 +++++++++++++++++------------------ scripts/upgrade | 41 +++++++++++++++--------------------- 9 files changed, 94 insertions(+), 106 deletions(-) diff --git a/README.md b/README.md index 45ab151..b9da417 100644 --- a/README.md +++ b/README.md @@ -28,8 +28,8 @@ Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchroni #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/z-push%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/z-push/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/z-push%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/z-push/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/z-push.svg)](https://ci-apps.yunohost.org/ci/apps/z-push/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/z-push.svg)](https://ci-apps-arm.yunohost.org/ci/apps/z-push/) ## Links diff --git a/check_process b/check_process index ee41019..8983981 100644 --- a/check_process +++ b/check_process @@ -1,33 +1,32 @@ ;; Test complet - auto_remove=1 - ; Manifest - domain="domain.tld" (DOMAIN) - path="/Microsoft-Server-ActiveSync" (PATH) - ; Checks - pkg_linter=1 - setup_sub_dir=1 - setup_root=0 - setup_nourl=0 - setup_private=0 - setup_public=1 - upgrade=1 - # 2.5.1~ynh3 - upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db - # 2.5.2~ynh1 - upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3 - # 2.6.1~ynh1 - upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b - backup_restore=1 - multi_instance=1 - port_already_use=0 - change_url=0 + ; Manifest + domain="domain.tld" (DOMAIN) + path="/Microsoft-Server-ActiveSync" (PATH) + ; Checks + pkg_linter=1 + setup_sub_dir=1 + setup_root=0 + setup_nourl=0 + setup_private=0 + setup_public=1 + upgrade=1 + # 2.5.1~ynh3 + upgrade=1 from_commit=9e8a72669814237122dfc6f901c9377895c193db + # 2.5.2~ynh1 + upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3 + # 2.6.1~ynh1 + upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b + backup_restore=1 + multi_instance=1 + port_already_use=0 + change_url=0 ;;; Options Email=yalh@yahoo.com Notification=all ;;; Upgrade options - ; commit=9e8a72669814237122dfc6f901c9377895c193db - name=2.5.1~ynh3 - ; commit=a857788c1fb369baa5f0608da12013b003cceed3 - name=2.5.2~ynh1 - ; commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b - name=2.6.1~ynh1 + ; commit=9e8a72669814237122dfc6f901c9377895c193db + name=2.5.1~ynh3 + ; commit=a857788c1fb369baa5f0608da12013b003cceed3 + name=2.5.2~ynh1 + ; commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b + name=2.6.1~ynh1 diff --git a/conf/nginx.conf b/conf/nginx.conf index 70e4d41..41cf3a2 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -13,7 +13,7 @@ location /Microsoft-Server-ActiveSync/ { # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file client_max_body_size 50M; - + try_files $uri $uri/ index.php; rewrite ^(.*)$ /Microsoft-Server-ActiveSync/index.php last; location ~ [^/]\.php(/|$) { diff --git a/manifest.json b/manifest.json index 44f0e06..ecf5315 100644 --- a/manifest.json +++ b/manifest.json @@ -33,10 +33,6 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain for Z-Push", - "fr": "Choisissez un domaine pour Z-Push" - }, "example": "example.com" } ] diff --git a/scripts/backup b/scripts/backup index 89a96c0..8112f3a 100755 --- a/scripts/backup +++ b/scripts/backup @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -45,10 +45,10 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" # Backup statedir -ynh_backup --src_path="$statedir" +ynh_backup --src_path="$statedir" --is_big # Backup logs -ynh_backup --src_path="$final_logpath" +ynh_backup --src_path="$final_logpath" --is_big #================================================= # BACKUP THE NGINX CONFIGURATION diff --git a/scripts/install b/scripts/install index df6f985..068d833 100755 --- a/scripts/install +++ b/scripts/install @@ -63,6 +63,14 @@ ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." + +# Create a system user +ynh_system_user_create --username=$app + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -76,28 +84,24 @@ ynh_setup_source --dest_dir="$final_path/tmp" cp -a "$final_path/tmp/src/." "$final_path/." ynh_secure_remove "$final_path/tmp" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Configuring NGINX web server..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Configuring PHP-FPM..." -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) @@ -109,15 +113,19 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Creating statedir and final_logpath..." mkdir -p $statedir -chown -R $app: $statedir +chmod 750 "$statedir" +chmod -R o-rwx "$statedir" +chown -R root:$app "$statedir" mkdir -p $final_logpath -chown -R $app: $final_logpath +chmod 750 "$final_logpath" +chmod -R o-rwx "$final_logpath" +chown -R root:$app "$final_logpath" #================================================= -# MODIFY A CONFIG FILE +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Adding a config file..." # Configuration ynh_replace_string --match_string="__TIMEZONE__" --replace_string=$(cat /etc/timezone) --target_file="../conf/config.php" @@ -208,14 +216,6 @@ ln -s /usr/share/awl/inc/XML* /var/www/$app/include/ #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions to app files -chown -R $app: $final_path - #================================================= # SETUP LOGROTATE #================================================= diff --git a/scripts/remove b/scripts/remove index 710d389..9fd996e 100755 --- a/scripts/remove +++ b/scripts/remove @@ -44,7 +44,7 @@ ynh_secure_remove --file="$final_path" #================================================= ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= @@ -52,7 +52,7 @@ ynh_remove_nginx_config #================================================= ynh_script_progression --message="Removing PHP-FPM configuration..." -# Remove the dedicated php-fpm config +# Remove the dedicated PHP-FPM config ynh_remove_fpm_config #================================================= diff --git a/scripts/restore b/scripts/restore index 1690a70..172258b 100755 --- a/scripts/restore +++ b/scripts/restore @@ -49,23 +49,10 @@ test ! -d $final_path \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Restoring the NGINX configuration..." +ynh_script_progression --message="Restoring the NGINX web server configuration..." ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring the app main directory..." - -ynh_restore_file --origin_path="$final_path" - -# Restore statedir -ynh_restore_file --origin_path="$statedir" - -# Restore logs, data & permissions -ynh_restore_file --origin_path="$final_logpath" - #================================================= # RECREATE THE DEDICATED USER #================================================= @@ -75,14 +62,27 @@ ynh_script_progression --message="Recreating the dedicated system user..." ynh_system_user_create --username=$app #================================================= -# RESTORE USER RIGHTS +# RESTORE THE APP MAIN DIR #================================================= -ynh_script_progression --message="Restoring user rights..." +ynh_script_progression --message="Restoring the app main directory..." -# Restore permissions on app files -chown -R $app: $final_path -chown -R $app: $statedir -chown -R $app: $final_logpath +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" + +mkdir -p $final_logpath +chmod 750 "$final_logpath" +chmod -R o-rwx "$final_logpath" +chown -R root:$app "$final_logpath" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 0fa9dd8..cd409be 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -63,7 +63,7 @@ ynh_script_progression --message="Backing up the app before upgrading (may take # Backup the current version of the app ynh_backup_before_upgrade ynh_clean_setup () { - # restore it if the upgrade fails + # Restore it if the upgrade fails ynh_restore_upgradebackup } # Exit if an error occurs during the execution of the script @@ -71,6 +71,14 @@ ynh_abort_if_errors #================================================= # STANDARD UPGRADE STEPS +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Making sure dedicated system user exists..." + +# Create a dedicated user (if not existing) +ynh_system_user_create --username=$app + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -86,12 +94,16 @@ then ynh_secure_remove --file="$final_path/tmp" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" + #================================================= # NGINX CONFIGURATION #================================================= ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -101,29 +113,21 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Making sure dedicated system user exists..." - -# Create a dedicated user (if not existing) -ynh_system_user_create --username=$app - #================================================= # PHP-FPM CONFIGURATION #================================================= ynh_script_progression --message="Upgrading PHP-FPM configuration..." -# Create a dedicated php-fpm config +# Create a dedicated PHP-FPM config ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies" phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE #================================================= -# MODIFY A CONFIG FILE +# UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Updating a config file..." # Configuration ynh_replace_string --match_string="__TIMEZONE__" --replace_string="$(cat /etc/timezone)" --target_file="../conf/config.php" @@ -214,17 +218,6 @@ $final_path/z-push-admin.php -a fixstates #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R $app: $final_path - -chown -R $app: $statedir -chown -R $app: $final_logpath - #================================================= # SETUP LOGROTATE #================================================= From e5ada15532c6772930d94ce248dcaadbe45c5ed0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:06:20 +0200 Subject: [PATCH 02/14] Update upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index cd409be..0a53c57 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -56,7 +56,7 @@ if ynh_legacy_permissions_exists; then fi #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." From 346c3505d326f298344112f37b666cff1b06cf9a Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:34:23 +0200 Subject: [PATCH 03/14] Update restore --- scripts/restore | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/restore b/scripts/restore index 172258b..e1552e1 100755 --- a/scripts/restore +++ b/scripts/restore @@ -6,7 +6,7 @@ # IMPORT GENERIC HELPERS #================================================= -#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts +# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers @@ -23,7 +23,7 @@ ynh_abort_if_errors #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading settings..." +ynh_script_progression --message="Loading installation settings..." app=$YNH_APP_INSTANCE_NAME From c65b32ae06fc3528d3cbdb41ee26c6ae5073a6db Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 02:06:00 +0200 Subject: [PATCH 04/14] 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 From 543c522611858dab8829a081bc184a1bd24aa339 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 02:21:13 +0200 Subject: [PATCH 05/14] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index ecf5315..cf7a981 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "ActiveSync frontend that helps you synchronize emails, calendar and contacts", "fr": "Frontend ActiveSync qui permet de synchroniser emails, calendrier et contacts" }, - "version": "2.6.1~ynh2", + "version": "2.6.1~ynh3", "url": "https://z-push.org", "license": "AGPL-3.0-or-later", "maintainer": { From 9c46415979dfb3d0b0a2120fdfe76e74f5e830f0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 16:58:06 +0200 Subject: [PATCH 06/14] Update check_process --- check_process | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/check_process b/check_process index 8983981..2f6521a 100644 --- a/check_process +++ b/check_process @@ -16,6 +16,8 @@ upgrade=1 from_commit=a857788c1fb369baa5f0608da12013b003cceed3 # 2.6.1~ynh1 upgrade=1 from_commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b + # 2.6.1~ynh2 + upgrade=1 from_commit=8e99ec37fb90d1ac4f8eb2c838e6d2e1f5b0c905 backup_restore=1 multi_instance=1 port_already_use=0 @@ -30,3 +32,5 @@ Notification=all name=2.5.2~ynh1 ; commit=a05896f0e4f2b015dcf643c644ac6c98c2f6695b name=2.6.1~ynh1 + ; commit=8e99ec37fb90d1ac4f8eb2c838e6d2e1f5b0c905 + name=2.6.1~ynh2 From 84ac84011bb53d9269ef79092b96dffff7bed89c Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 16:59:08 +0200 Subject: [PATCH 07/14] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 2f6521a..75a33fb 100644 --- a/check_process +++ b/check_process @@ -21,7 +21,7 @@ backup_restore=1 multi_instance=1 port_already_use=0 - change_url=0 + change_url=1 ;;; Options Email=yalh@yahoo.com Notification=all From 238bf64b93080ac656a29b2d1841cd48299618b4 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 17:34:33 +0200 Subject: [PATCH 08/14] Update README.md --- README.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/README.md b/README.md index b9da417..ac349e4 100644 --- a/README.md +++ b/README.md @@ -11,17 +11,6 @@ Z-Push is an Exchange ActiveSync fronted written in PHP which lets you synchroni **Shipped version:** 2.6.1 -## Current status -- [x] Z-Push for YunoHost supports IMAP sync and CardDAV/CalDAV sync if Baïkal or Nextcloud is installed -- [x] Ability to send calendar invitations -- [x] Use of push for emails, contacts and calendar -- [x] Sync States are now stored in `/home/yunohost.app/$app` -- [x] Logrotate has been activated as Z-Push can become noisy at times -- [x] Z-Push is now configured to use SMTP to send emails instead of `php_mail()` function. This let us have emails signed by dkim for example. -- [x] The current IMAP backend configuration seems able to handle email addresses different from login (for example login: john and email john.doe@domain.tld instead of john@domain.tld) - Further testing required! -- [x] The sources are based on http://download.z-push.org/final/ -- [x] Autodiscover implemented - ## Documentation * Official documentation: https://wiki.z-hub.io/display/ZP/Documentation From 34e0989347bb2ed8e1623b4a2ee47c8c42157ff8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 17:34:36 +0200 Subject: [PATCH 09/14] Update check_process --- check_process | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/check_process b/check_process index 75a33fb..2f6521a 100644 --- a/check_process +++ b/check_process @@ -21,7 +21,7 @@ backup_restore=1 multi_instance=1 port_already_use=0 - change_url=1 + change_url=0 ;;; Options Email=yalh@yahoo.com Notification=all From 666e50f519c4c425cc6fa0c0f611c48356033832 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 22:16:13 +0200 Subject: [PATCH 10/14] Fix rights --- scripts/install | 6 +++--- scripts/restore | 4 ++-- scripts/upgrade | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index d8aed93..031ede2 100755 --- a/scripts/install +++ b/scripts/install @@ -85,7 +85,7 @@ ynh_secure_remove "$final_path/tmp" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -114,12 +114,12 @@ ynh_script_progression --message="Creating statedir and final_logpath..." mkdir -p $statedir chmod 750 "$statedir" chmod -R o-rwx "$statedir" -chown -R root:$app "$statedir" +chown -R $app:$app "$statedir" mkdir -p $final_logpath chmod 750 "$final_logpath" chmod -R o-rwx "$final_logpath" -chown -R root:$app "$final_logpath" +chown -R $app:$app "$final_logpath" #================================================= # ADD A CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 7c473c5..9ab6b80 100755 --- a/scripts/restore +++ b/scripts/restore @@ -73,14 +73,14 @@ ynh_restore_file --origin_path="$statedir" --not_mandatory mkdir -p $statedir chmod 750 "$statedir" chmod -R o-rwx "$statedir" -chown -R root:$app "$statedir" +chown -R $app:$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" -chown -R root:$app "$final_logpath" +chown -R $app:$app "$final_logpath" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index e43d887..73a2024 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -96,7 +96,7 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION From 750a291ccec87ec30e71bee24732775e1c71a225 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 13 Apr 2021 01:11:15 +0200 Subject: [PATCH 11/14] Fix rights --- scripts/install | 6 +++--- scripts/restore | 4 ++-- scripts/upgrade | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 031ede2..b9c9399 100755 --- a/scripts/install +++ b/scripts/install @@ -85,7 +85,7 @@ ynh_secure_remove "$final_path/tmp" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION @@ -114,12 +114,12 @@ ynh_script_progression --message="Creating statedir and final_logpath..." mkdir -p $statedir chmod 750 "$statedir" chmod -R o-rwx "$statedir" -chown -R $app:$app "$statedir" +chown -R $app:www-data "$statedir" mkdir -p $final_logpath chmod 750 "$final_logpath" chmod -R o-rwx "$final_logpath" -chown -R $app:$app "$final_logpath" +chown -R $app:www-data "$final_logpath" #================================================= # ADD A CONFIGURATION diff --git a/scripts/restore b/scripts/restore index 9ab6b80..b23b13e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -73,14 +73,14 @@ ynh_restore_file --origin_path="$statedir" --not_mandatory mkdir -p $statedir chmod 750 "$statedir" chmod -R o-rwx "$statedir" -chown -R $app:$app "$statedir" +chown -R $app:www-data "$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" -chown -R $app:$app "$final_logpath" +chown -R $app:www-data "$final_logpath" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 73a2024..6883d00 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -96,7 +96,7 @@ fi chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R $app:www-data "$final_path" #================================================= # NGINX CONFIGURATION From 58651503fe0c24b3c7c3ea0d3a671126c79f69e9 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Wed, 14 Apr 2021 20:56:34 +0200 Subject: [PATCH 12/14] Fix cp --- scripts/install | 26 +++++++++++++------------- scripts/upgrade | 26 +++++++++++++------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/scripts/install b/scripts/install index b9c9399..9fbdaae 100755 --- a/scripts/install +++ b/scripts/install @@ -80,7 +80,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src mkdir -p "$final_path/tmp" ynh_setup_source --dest_dir="$final_path/tmp" -cp -a "$final_path/tmp/src/." "$final_path/." +cp -af "$final_path/tmp/src/." "$final_path/." ynh_secure_remove "$final_path/tmp" chmod 750 "$final_path" @@ -160,10 +160,10 @@ if yunohost app list | grep -q 'id: baikal' ; then ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php" # Copy config - cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php - cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php + cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php + cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php + cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php + cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php elif yunohost app list | grep -q 'id: nextcloud' ; then echo "Detected NextCloud" @@ -188,10 +188,10 @@ elif yunohost app list | grep -q 'id: nextcloud' ; then ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php" # Copy config - cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php - cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php + cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php + cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php + cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php + cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php else # Configuration of backend ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/config.php" @@ -202,13 +202,13 @@ else ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="false" --target_file="../conf/backend/config-imap.php" # Copy config - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php + cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php fi # Copy config -cp ../conf/config.php $final_path/config.php -cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php -cp ../conf/backend/config-searchldap.php $final_path/backend/searchldap/config.php +cp -af ../conf/config.php $final_path/config.php +cp -af ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php +cp -af ../conf/backend/config-searchldap.php $final_path/backend/searchldap/config.php #Copy XMLElement.php ln -s /usr/share/awl/inc/XML* /var/www/$app/include/ diff --git a/scripts/upgrade b/scripts/upgrade index 6883d00..947a190 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -90,7 +90,7 @@ then # Download, check integrity, uncompress and patch the source from app.src mkdir "$final_path/tmp" ynh_setup_source --dest_dir="$final_path/tmp" - cp -a "$final_path/tmp/src/." "$final_path/." + cp -af "$final_path/tmp/src/." "$final_path/." ynh_secure_remove --file="$final_path/tmp" fi @@ -163,10 +163,10 @@ if yunohost app list | grep -q 'id: baikal' ; then ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php" # Copy config - cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php - cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php + cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php + cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php + cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php + cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php elif yunohost app list | grep -q 'id: nextcloud' ; then echo "Detected NextCloud" @@ -191,10 +191,10 @@ elif yunohost app list | grep -q 'id: nextcloud' ; then ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="true" --target_file="../conf/backend/config-imap.php" # Copy config - cp ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php - cp ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php - cp ../conf/backend/config-combined.php $final_path/backend/combined/config.php + cp -af ../conf/backend/config-caldav.php $final_path/backend/caldav/config.php + cp -af ../conf/backend/config-carddav.php $final_path/backend/carddav/config.php + cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php + cp -af ../conf/backend/config-combined.php $final_path/backend/combined/config.php else # Configuration of backend ynh_replace_string --match_string="__BACKEND__" --replace_string="BackendIMAP" --target_file="../conf/config.php" @@ -205,13 +205,13 @@ else ynh_replace_string --match_string="__FLAGTOCHANGE__" --replace_string="false" --target_file="../conf/backend/config-imap.php" # Copy config - cp ../conf/backend/config-imap.php $final_path/backend/imap/config.php + cp -af ../conf/backend/config-imap.php $final_path/backend/imap/config.php fi # Copy config -cp ../conf/config.php $final_path/config.php -cp ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php -cp ../conf/backend/config-searchldap.php $final_path/backend/searchldap/config.php +cp -af ../conf/config.php $final_path/config.php +cp -af ../conf/backend/config-autodiscover.php $final_path/autodiscover/config.php +cp -af ../conf/backend/config-searchldap.php $final_path/backend/searchldap/config.php # Fixstates to avoid full resync of devices after version upgrades $final_path/z-push-admin.php -a fixstates From 9339555f785fa9aa7534583e1b4b343ab5035cb7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 20:30:35 +0200 Subject: [PATCH 13/14] Fix chmod --- scripts/install | 6 +++--- scripts/restore | 4 ++-- scripts/upgrade | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 9fbdaae..83c678c 100755 --- a/scripts/install +++ b/scripts/install @@ -83,7 +83,7 @@ ynh_setup_source --dest_dir="$final_path/tmp" cp -af "$final_path/tmp/src/." "$final_path/." ynh_secure_remove "$final_path/tmp" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -112,12 +112,12 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Creating statedir and final_logpath..." mkdir -p $statedir -chmod 750 "$statedir" +chmod -R 750 "$statedir" chmod -R o-rwx "$statedir" chown -R $app:www-data "$statedir" mkdir -p $final_logpath -chmod 750 "$final_logpath" +chmod -R 750 "$final_logpath" chmod -R o-rwx "$final_logpath" chown -R $app:www-data "$final_logpath" diff --git a/scripts/restore b/scripts/restore index b23b13e..cb4ce8c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -71,14 +71,14 @@ ynh_restore_file --origin_path="$final_path" # Restore statedir ynh_restore_file --origin_path="$statedir" --not_mandatory mkdir -p $statedir -chmod 750 "$statedir" +chmod -R 750 "$statedir" chmod -R o-rwx "$statedir" chown -R $app:www-data "$statedir" # Restore logs, data & permissions ynh_restore_file --origin_path="$final_logpath" --not_mandatory mkdir -p $final_logpath -chmod 750 "$final_logpath" +chmod -R 750 "$final_logpath" chmod -R o-rwx "$final_logpath" chown -R $app:www-data "$final_logpath" diff --git a/scripts/upgrade b/scripts/upgrade index 947a190..f5a2814 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -94,7 +94,7 @@ then ynh_secure_remove --file="$final_path/tmp" fi -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" From 05b0b8734f664da423030d22262a3abdab4de819 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 18:32:51 +0200 Subject: [PATCH 14/14] Fix recursive chmod --- scripts/install | 6 +++--- scripts/restore | 4 ++-- scripts/upgrade | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 83c678c..9fbdaae 100755 --- a/scripts/install +++ b/scripts/install @@ -83,7 +83,7 @@ ynh_setup_source --dest_dir="$final_path/tmp" cp -af "$final_path/tmp/src/." "$final_path/." ynh_secure_remove "$final_path/tmp" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -112,12 +112,12 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) ynh_script_progression --message="Creating statedir and final_logpath..." mkdir -p $statedir -chmod -R 750 "$statedir" +chmod 750 "$statedir" chmod -R o-rwx "$statedir" chown -R $app:www-data "$statedir" mkdir -p $final_logpath -chmod -R 750 "$final_logpath" +chmod 750 "$final_logpath" chmod -R o-rwx "$final_logpath" chown -R $app:www-data "$final_logpath" diff --git a/scripts/restore b/scripts/restore index cb4ce8c..b23b13e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -71,14 +71,14 @@ ynh_restore_file --origin_path="$final_path" # Restore statedir ynh_restore_file --origin_path="$statedir" --not_mandatory mkdir -p $statedir -chmod -R 750 "$statedir" +chmod 750 "$statedir" chmod -R o-rwx "$statedir" chown -R $app:www-data "$statedir" # Restore logs, data & permissions ynh_restore_file --origin_path="$final_logpath" --not_mandatory mkdir -p $final_logpath -chmod -R 750 "$final_logpath" +chmod 750 "$final_logpath" chmod -R o-rwx "$final_logpath" chown -R $app:www-data "$final_logpath" diff --git a/scripts/upgrade b/scripts/upgrade index f5a2814..947a190 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -94,7 +94,7 @@ then ynh_secure_remove --file="$final_path/tmp" fi -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path"