From 8e8d4661156cffb811240d991d3e813a9e10b4c7 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Fri, 9 Apr 2021 23:57:50 +0200 Subject: [PATCH 1/8] Apply example_ynh --- README.md | 4 ++-- check_process | 4 ++++ manifest.json | 20 ++------------------ scripts/backup | 2 +- scripts/change_url | 20 ++++++++++---------- scripts/install | 30 +++++++++++++++++------------- scripts/remove | 8 ++++---- scripts/restore | 36 ++++++++++++++++-------------------- scripts/upgrade | 40 ++++++++++++++++++---------------------- 9 files changed, 74 insertions(+), 90 deletions(-) diff --git a/README.md b/README.md index ec285c9..a29096b 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,8 @@ LDAP and HTTP auth are supported through plugins #### Supported architectures -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/osticket%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/osticket/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/osticket%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/osticket/) +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/osticket.svg)](https://ci-apps.yunohost.org/ci/apps/osticket/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/osticket.svg)](https://ci-apps-arm.yunohost.org/ci/apps/osticket/) ## Additional information diff --git a/check_process b/check_process index 37e7990..44ff7c5 100644 --- a/check_process +++ b/check_process @@ -25,6 +25,8 @@ #upgrade=1 from_commit=cadb10e497d938e0e684e43ac870a3807b4b60d9 # 1.14.3 #upgrade=1 from_commit=fe0bd01ffa787713e2b36408abe1e44033aacb69 + # 1.15.2~ynh1 + upgrade=1 from_commit=20349f58ebb98ce87d3a80da18f11a7bafa04985 backup_restore=1 multi_instance=1 port_already_use=0 @@ -39,3 +41,5 @@ Notification=none name=1.14.2 ; commit=fe0bd01ffa787713e2b36408abe1e44033aacb69 name=1.14.3 + ; commit=20349f58ebb98ce87d3a80da18f11a7bafa04985 + name=1.15.2~ynh1 diff --git a/manifest.json b/manifest.json index ebc3481..116c09b 100644 --- a/manifest.json +++ b/manifest.json @@ -6,14 +6,14 @@ "en": "Open source support ticket system", "fr": "Système de ticket de support open source" }, - "version": "1.15.2~ynh1", + "version": "1.15.2~ynh2", "url": "https://osticket.com/", "license": "GPL-2.0-or-later", "maintainer": { "name": "yalh76" }, "requirements": { - "yunohost": ">= 4.1.7.3" + "yunohost": ">= 4.1.3" }, "multi_instance": true, "services": [ @@ -26,38 +26,22 @@ { "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for osTicket", - "fr": "Choisissez un nom de domaine pour osTicket" - }, "example": "example.com" }, { "name": "path", "type": "path", - "ask": { - "en": "Choose a path for osTicket", - "fr": "Choisissez un chemin pour osTicket" - }, "example": "/osticket", "default": "/osticket" }, { "name": "admin", "type": "user", - "ask": { - "en": "Choose an admin user", - "fr": "Choisissez l'administrateur" - }, "example": "johndoe" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public application?", - "fr": "Est-ce une application publique ?" - }, "default": true }, { diff --git a/scripts/backup b/scripts/backup index 73cf595..c4314ac 100644 --- 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 diff --git a/scripts/change_url b/scripts/change_url index a190724..213ce6c 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -35,9 +35,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path) #db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) #================================================= -# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP +# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." # Backup the current version of the app ynh_backup_before_upgrade @@ -45,7 +45,7 @@ ynh_clean_setup () { # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" - # 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 @@ -72,23 +72,23 @@ fi #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating nginx web server configuration..." +ynh_script_progression --message="Updating NGINX web server configuration..." nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf -# Change the path in the nginx config file +# Change the path in the NGINX config file if [ $change_path -eq 1 ] then - # Make a backup of the original nginx config file if modified + # Make a backup of the original NGINX config file if modified ynh_backup_if_checksum_is_different --file="$nginx_conf_path" - # Set global variables for nginx helper + # Set global variables for NGINX helper domain="$old_domain" path_url="$new_path" - # Create a dedicated nginx config + # Create a dedicated NGINX config ynh_add_nginx_config fi -# Change the domain for nginx +# Change the domain for NGINX if [ $change_domain -eq 1 ] then # Delete file checksum for the old conf file location @@ -109,7 +109,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/install b/scripts/install index 1d9eaf0..1742320 100644 --- a/scripts/install +++ b/scripts/install @@ -62,6 +62,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 --home_dir="$final_path" + #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -93,28 +101,24 @@ ynh_setup_source --dest_dir="$final_path/include/plugins/build/microsoft-teams" ynh_setup_source --dest_dir="$final_path/include/plugins/build/slack" --source_id="plugin-slack" ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll" --source_id="plugin-preventautoscroll" +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..." +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 --home_dir=$final_path - #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." +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) @@ -247,7 +251,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/remove b/scripts/remove index 4b9eb04..516968d 100644 --- a/scripts/remove +++ b/scripts/remove @@ -50,17 +50,17 @@ ynh_secure_remove --file="$final_path" #================================================= # REMOVE NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Removing nginx web server configuration..." +ynh_script_progression --message="Removing NGINX web server configuration..." -# Remove the dedicated nginx config +# Remove the dedicated NGINX config ynh_remove_nginx_config #================================================= # REMOVE PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Removing php-fpm configuration..." +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 3148bd6..e4dcf08 100644 --- 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 @@ -49,10 +49,18 @@ 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" +#================================================= +# RECREATE THE DEDICATED USER +#================================================= +ynh_script_progression --message="Recreating the dedicated system user..." + +# Create the dedicated user (if not existing) +ynh_system_user_create --username=$app --home_dir="$final_path" + #================================================= # RESTORE THE APP MAIN DIR #================================================= @@ -60,21 +68,9 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -#================================================= -# RECREATE THE DEDICATED USER -#================================================= -ynh_script_progression --message="Recreating the dedicated system user..." - -# Create the dedicated user (if not existing) -ynh_system_user_create --username=$app - -#================================================= -# RESTORE USER RIGHTS -#================================================= -ynh_script_progression --message="Restoring user rights..." - -# Restore permissions on app files -chown -R $app: $final_path +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R root:$app "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION @@ -83,7 +79,7 @@ ynh_script_progression --message="Restoring PHP-FPM configuration..." ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" -# 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) @@ -118,7 +114,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app" #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." +ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload diff --git a/scripts/upgrade b/scripts/upgrade index fc6739c..16f29bd 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -52,7 +52,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 @@ -60,6 +60,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 --home_dir="$final_path" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -95,12 +103,16 @@ then ynh_secure_remove --file="$tmpdir" 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..." +ynh_script_progression --message="Upgrading NGINX web server configuration..." -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= @@ -110,20 +122,12 @@ 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..." +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) @@ -201,18 +205,10 @@ ynh_store_file_checksum --file="$config_file" #================================================= # GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= -ynh_script_progression --message="Securing files and directories..." - -# Set permissions on app files -chown -R $app: $final_path - #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload From 2956c29989c510d87fee6709169e6a0fad294ec0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 18:07:25 +0200 Subject: [PATCH 2/8] Update manifest.json --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 116c09b..7a087e3 100644 --- a/manifest.json +++ b/manifest.json @@ -13,7 +13,7 @@ "name": "yalh76" }, "requirements": { - "yunohost": ">= 4.1.3" + "yunohost": ">= 4.1.7.3" }, "multi_instance": true, "services": [ From f66f0a9288b1487ccb76d518c2b8c1384f6c5da0 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 10 Apr 2021 20:01:32 +0200 Subject: [PATCH 3/8] Apply example_ynh --- scripts/install | 47 ++++++++--------------------------------------- scripts/restore | 14 +++++++------- scripts/upgrade | 25 +++++++++++-------------- 3 files changed, 26 insertions(+), 60 deletions(-) diff --git a/scripts/install b/scripts/install index 1742320..5a99d22 100644 --- a/scripts/install +++ b/scripts/install @@ -125,16 +125,14 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP #================================================= -# PREPARE INSTALL +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Preparing install..." +ynh_script_progression --message="Adding a config file..." -config_file=$final_path/include/ost-config.php -cp -f ../conf/ost-sampleconfig.php "$config_file" +ynh_add_config --template="../conf/ost-sampleconfig.php" --destination="$final_path/include/ost-config.php" -admin_fname=$(ynh_user_get_info $admin 'firstname') -admin_lname=$(ynh_user_get_info $admin 'lastname') -admin_mail=$(ynh_user_get_info $admin 'mail') +chmod 400 "$final_path/include/ost-config.php" +chown $app:$app "$final_path/include/ost-config.php" #================================================= # BUILD PLUGINS @@ -179,18 +177,14 @@ rsync -a "../conf/i18n" "$final_path/include/." #================================================= ynh_script_progression --message="Setuping application with CURL..." -# Set right permissions for curl install -chown -R $app: $final_path - # Set the app as temporarily public for curl call ynh_script_progression --message="Configuring SSOwat..." # Making the app public for curl ynh_permission_update --permission="main" --add="visitors" -# Reload SSOwat config -yunohost app ssowatconf -# Reload Nginx -ynh_systemd_action --service_name=nginx --action=reload +admin_fname=$(ynh_user_get_info $admin 'firstname') +admin_lname=$(ynh_user_get_info $admin 'lastname') +admin_mail=$(ynh_user_get_info $admin 'mail') # Installation with curl ynh_script_progression --message="Finalizing installation..." @@ -199,17 +193,8 @@ ynh_local_curl "/setup/install.php" "s=install" "name=$app" "email=$app@$domain" # Remove the public access ynh_permission_update --permission="main" --remove="visitors" -#================================================= -# FINALIZE INSTALL -#================================================= -ynh_script_progression --message="Finalizing install..." - -# Removing setup folder ynh_secure_remove --file="$final_path/setup" -# Securing config file -chmod 0644 $config_file - #================================================= # SET THE CRON FILE #================================================= @@ -217,24 +202,8 @@ ynh_script_progression --message="Setting the cron file..." ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -ynh_script_progression --message="Storing the config file checksum..." - -# Calculate and store the config file checksum into the app settings -ynh_store_file_checksum --file="$config_file" - #================================================= # 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 SSOWAT #================================================= diff --git a/scripts/restore b/scripts/restore index e4dcf08..036881c 100644 --- a/scripts/restore +++ b/scripts/restore @@ -85,6 +85,13 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC RESTORATION +#================================================= +# RESTORE THE CRON FILE +#================================================= +ynh_script_progression --message="Restoring the cron file..." + +ynh_restore_file --origin_path="/etc/cron.d/$app" + #================================================= # REINSTALL DEPENDENCIES #================================================= @@ -102,13 +109,6 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql -#================================================= -# RESTORE THE CRON FILE -#================================================= -ynh_script_progression --message="Restoring the cron file..." - -ynh_restore_file --origin_path="/etc/cron.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 16f29bd..4eebc48 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -133,6 +133,16 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC UPGRADE +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a config file..." + +ynh_add_config --template="../conf/ost-sampleconfig.php" --destination="$final_path/include/ost-config.php" + +chmod 400 "$final_path/include/ost-config.php" +chown $app:$app "$final_path/include/ost-config.php" + #================================================= # BUILD PLUGINS #================================================= @@ -164,6 +174,7 @@ then #cp -f *.phar $final_path/include/plugins/. popd ynh_secure_remove --file="$final_path/include/plugins/build" + ynh_secure_remove --file="$final_path/setup" fi #================================================= @@ -173,20 +184,6 @@ ynh_script_progression --message="UPGRADING language..." rsync -a "../conf/i18n" "$final_path/include/." -#================================================= -# FINALIZE UPGRADE -#================================================= -ynh_script_progression --message="Finalizing install..." - -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - # Removing setup folder - ynh_secure_remove --file="$final_path/setup" - - # Securing config file - chmod 0644 $config_file -fi - #================================================= # SET THE CRON FILE #================================================= From 01c9f34d56d15f5d1986bd29e98684cf28069a00 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sun, 11 Apr 2021 22:26:11 +0200 Subject: [PATCH 4/8] Fix rights --- scripts/install | 16 ++++++++-------- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/install b/scripts/install index 5a99d22..894359c 100644 --- a/scripts/install +++ b/scripts/install @@ -103,7 +103,7 @@ ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # NGINX CONFIGURATION @@ -124,6 +124,13 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # SPECIFIC SETUP +#================================================= +# SET THE CRON FILE +#================================================= +ynh_script_progression --message="Setting the cron file..." + +ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" + #================================================= # ADD A CONFIGURATION #================================================= @@ -195,13 +202,6 @@ ynh_permission_update --permission="main" --remove="visitors" ynh_secure_remove --file="$final_path/setup" -#================================================= -# SET THE CRON FILE -#================================================= -ynh_script_progression --message="Setting the cron file..." - -ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index 036881c..f0df46e 100644 --- a/scripts/restore +++ b/scripts/restore @@ -70,7 +70,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R root:$app "$final_path" +chown -R $app:$app "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 4eebc48..32704e1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -105,7 +105,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 9fe117ddde3c245f9bd8596dc8ee68b836c11de1 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Tue, 13 Apr 2021 01:07:39 +0200 Subject: [PATCH 5/8] Fix rights --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 894359c..9c87473 100644 --- a/scripts/install +++ b/scripts/install @@ -103,7 +103,7 @@ ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll 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 diff --git a/scripts/restore b/scripts/restore index f0df46e..feeee23 100644 --- a/scripts/restore +++ b/scripts/restore @@ -70,7 +70,7 @@ ynh_restore_file --origin_path="$final_path" chmod 750 "$final_path" chmod -R o-rwx "$final_path" -chown -R $app:$app "$final_path" +chown -R $app:www-data "$final_path" #================================================= # RESTORE THE PHP-FPM CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index 32704e1..58f15c2 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -105,7 +105,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 9f07cb4eb975c907060c9313e40e7367894db0f8 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 02:34:35 +0200 Subject: [PATCH 6/8] Fix install --- scripts/install | 10 +++++++--- scripts/upgrade | 4 +--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/install b/scripts/install index 9c87473..874883c 100644 --- a/scripts/install +++ b/scripts/install @@ -136,10 +136,10 @@ ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app" #================================================= ynh_script_progression --message="Adding a config file..." -ynh_add_config --template="../conf/ost-sampleconfig.php" --destination="$final_path/include/ost-config.php" +cp -f "../conf/ost-sampleconfig.php" "$final_path/include/ost-config.php" -chmod 400 "$final_path/include/ost-config.php" -chown $app:$app "$final_path/include/ost-config.php" +chmod 666 "$final_path/include/ost-config.php" +chown $app:www-data "$final_path/include/ost-config.php" #================================================= # BUILD PLUGINS @@ -170,6 +170,7 @@ pushd "$final_path/include/plugins/build" #php${phpversion} -dphar.readonly=0 make.php build preventautoscroll #cp *.phar $final_path/include/plugins/. popd + ynh_secure_remove --file="$final_path/include/plugins/build" #================================================= @@ -202,6 +203,9 @@ ynh_permission_update --permission="main" --remove="visitors" ynh_secure_remove --file="$final_path/setup" +chmod 400 "$final_path/include/ost-config.php" +chown $app:www-data "$final_path/include/ost-config.php" + #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 58f15c2..25d21fb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -138,10 +138,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= ynh_script_progression --message="Updating a config file..." -ynh_add_config --template="../conf/ost-sampleconfig.php" --destination="$final_path/include/ost-config.php" - chmod 400 "$final_path/include/ost-config.php" -chown $app:$app "$final_path/include/ost-config.php" +chown $app:www-data "$final_path/include/ost-config.php" #================================================= # BUILD PLUGINS From d97baa06881d13ff3bb9341d654561eb4ecca449 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 20:28:43 +0200 Subject: [PATCH 7/8] Fix chmod --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 874883c..6e593f5 100644 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ ynh_setup_source --dest_dir="$final_path/include/plugins/build/microsoft-teams" ynh_setup_source --dest_dir="$final_path/include/plugins/build/slack" --source_id="plugin-slack" ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll" --source_id="plugin-preventautoscroll" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" diff --git a/scripts/restore b/scripts/restore index feeee23..fcb6849 100644 --- a/scripts/restore +++ b/scripts/restore @@ -68,7 +68,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index 25d21fb..c47c393 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,7 +103,7 @@ then ynh_secure_remove --file="$tmpdir" fi -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" From 712c401c18f4e76718e1582574dfc36436f06160 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Sat, 17 Apr 2021 18:31:44 +0200 Subject: [PATCH 8/8] Fix recursive chmod --- scripts/install | 2 +- scripts/restore | 2 +- scripts/upgrade | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install b/scripts/install index 6e593f5..874883c 100644 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ ynh_setup_source --dest_dir="$final_path/include/plugins/build/microsoft-teams" ynh_setup_source --dest_dir="$final_path/include/plugins/build/slack" --source_id="plugin-slack" ynh_setup_source --dest_dir="$final_path/include/plugins/build/preventautoscroll" --source_id="plugin-preventautoscroll" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" diff --git a/scripts/restore b/scripts/restore index fcb6849..feeee23 100644 --- a/scripts/restore +++ b/scripts/restore @@ -68,7 +68,7 @@ ynh_script_progression --message="Restoring the app main directory..." ynh_restore_file --origin_path="$final_path" -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" diff --git a/scripts/upgrade b/scripts/upgrade index c47c393..25d21fb 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -103,7 +103,7 @@ then ynh_secure_remove --file="$tmpdir" fi -chmod -R 750 "$final_path" +chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path"