From a04c55f2768f345424ce11d7d391fc17ffa6e2c2 Mon Sep 17 00:00:00 2001 From: yalh76 Date: Thu, 15 Apr 2021 20:23:54 +0200 Subject: [PATCH] Fix chmod --- scripts/install | 47 ++++++++++++++++++++++------------------------- scripts/restore | 2 +- scripts/upgrade | 35 ++++++++++++++++++++++------------- 3 files changed, 45 insertions(+), 39 deletions(-) diff --git a/scripts/install b/scripts/install index a4e59af..0655915 100644 --- a/scripts/install +++ b/scripts/install @@ -54,7 +54,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=admin --value=$admin -ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=install_profil --value=$install_profil @@ -93,7 +92,7 @@ ynh_script_progression --message="Creating final path..." ynh_app_setting_set --app=$app --key=final_path --value=$final_path mkdir -p "$final_path/$app" -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -143,7 +142,7 @@ export PATH="$final_path/.composer/vendor/bin:$PATH" #================================================= ynh_script_progression --message="Installing Drupal..." -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -151,24 +150,30 @@ update-alternatives --set php /usr/bin/php$phpversion pushd "$final_path" ynh_exec_warn_less sudo -u $app env PATH=$PATH drush pm-download -y drupal-7 --drupal-project-rename=$app + + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app site-install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download drush_language + #ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download ldap + #ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download l10n_update + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-enable -y l10n_update + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-add $language + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-default $language + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear drush + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app core-cron + + chmod -R 750 "$final_path" + chmod -R o-rwx "$final_path" + chown -R $app:www-data "$final_path" popd -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app site-install $install_profil --account-name=$admin --account-pass=$password --account-mail=$admin_mail --db-url=mysql://$db_user:$db_pwd@localhost/$db_name --site-name="$app" --locale=$language --yes -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download drush_language -#ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download ldap -#ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-download l10n_update -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-enable -y l10n_update -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-add $language -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app language-default $language -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear drush -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app core-cron - update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} +ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php" + #================================================= # SETUP THE CRON FILE #================================================= @@ -176,14 +181,6 @@ ynh_script_progression --message="Setuping 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="$final_path/$app/sites/default/settings.php" - #================================================= # GENERIC FINALIZATION #================================================= diff --git a/scripts/restore b/scripts/restore index c91e732..75a1bc0 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 110269a..b3193a0 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -23,6 +23,7 @@ admin=$(ynh_app_setting_get --app=$app --key=admin) final_path=$(ynh_app_setting_get --app=$app --key=final_path) language=$(ynh_app_setting_get --app=$app --key=language) db_name=$(ynh_app_setting_get --app=$app --key=db_name) +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) #================================================= # CHECK VERSION @@ -76,7 +77,7 @@ then mkdir -p "$final_path/$app" fi -chmod 750 "$final_path" +chmod -R 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -120,32 +121,40 @@ ynh_script_progression --message="Upgrading Composer..." ynh_install_composer --phpversion="$phpversion" --workdir="$final_path/.composer" +export PATH="$final_path/.composer/vendor/bin:$PATH" + #================================================= # UPGRADE DRUPAL #================================================= ynh_script_progression --message="Upgrading Drupal..." ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/settings.php" -export PATH="$final_path/.composer/vendor/bin:$PATH" + +chmod -R 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" update-alternatives --set php /usr/bin/php$phpversion -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1 -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update -ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0 +pushd "$final_path" + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 1 + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app pm-update -y drupal + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app cache-clear all + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update-refresh + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app l10n-update + + ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0 + + chmod -R 750 "$final_path" + chmod -R o-rwx "$final_path" + chown -R $app:www-data "$final_path" +popd update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php" -chmod 750 "$final_path" -chmod -R o-rwx "$final_path" -chown -R $app:www-data "$final_path" - #================================================= # GENERIC FINALIZATION #=================================================