1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/civicrm_drupal7_ynh.git synced 2024-09-03 18:16:19 +02:00

Fix chmod

This commit is contained in:
yalh76 2021-04-15 20:24:11 +02:00
parent b7f00004e9
commit 1735a1a3ad
3 changed files with 78 additions and 71 deletions

View file

@ -92,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"
@ -130,6 +130,7 @@ ynh_systemd_action --service_name=mysql --action="restart"
ynh_script_progression --message="Creating Drush alias..."
mkdir -p "$final_path/.drush"
ynh_add_config --template="../conf/yoursite.aliases.drushrc.php" --destination="$final_path/.drush/$app.aliases.drushrc.php"
#=================================================
@ -138,6 +139,7 @@ ynh_add_config --template="../conf/yoursite.aliases.drushrc.php" --destination="
ynh_script_progression --message="Installing Composer..."
mkdir -p "$final_path/.composer"
ynh_add_config --template="../conf/composer.json" --destination="$final_path/.composer/composer.json"
ynh_install_composer --phpversion="$phpversion" --workdir="$final_path/.composer"
@ -149,7 +151,7 @@ export PATH="$final_path/.composer/vendor/bin:$PATH"
#=================================================
ynh_script_progression --message="Installing Drupal and CiviCRM..."
chmod 750 "$final_path"
chmod -R 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
@ -157,7 +159,6 @@ 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
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
@ -176,13 +177,18 @@ ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app core-cron
ynh_setup_source --dest_dir="$final_path/$app/sites/all/modules/civicrm" --source_id="civicrm-drupal"
ynh_setup_source --dest_dir="$final_path/$app/sites/all/modules/civicrm" --source_id="civicrm-l10n"
chown -R $app: $final_path
chmod 755 $final_path/$app/sites/default/
chmod -R 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush --include="$final_path/$app/sites/all/modules/civicrm/drupal/drush" @$app civicrm-install --dbhost="localhost" --dbname="$db_name" --dbpass="$db_pwd" --dbuser="$db_user" --destination="sites/all/modules" --site_url="$domain$path_url" --ssl=on
popd
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
ynh_store_file_checksum --file="$final_path/$app/sites/default/civicrm.settings.php"
#=================================================
# SETUP THE CRON FILE
#=================================================
@ -190,17 +196,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"
chmod 400 "$final_path/$app/sites/default/settings.php"
chown $app:$app "$final_path/$app/sites/default/settings.php"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -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"
@ -86,6 +86,12 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# SPECIFIC RESTORATION
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
@ -103,12 +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_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -68,6 +68,19 @@ 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
#=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
mkdir -p "$final_path/$app"
fi
chmod -R 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -103,6 +116,13 @@ ynh_replace_string --match_string="thread_stack = 128K" --replace_string="thread
ynh_systemd_action --service_name=mysql --action="restart"
#=================================================
# SETUP THE CRON FILE
#=================================================
ynh_script_progression --message="Setuping the cron file"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
#=================================================
# UPGRADE COMPOSER
#=================================================
@ -110,20 +130,23 @@ 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"
ynh_backup_if_checksum_is_different --file="$final_path/$app/sites/default/civicrm.settings.php"
chmod 750 "$final_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
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
@ -137,26 +160,15 @@ ynh_exec_warn_less sudo -u $app env PATH=$PATH drush --include="$final_path/$app
ynh_exec_warn_less sudo -u $app env PATH=$PATH drush @$app variable-set --exact maintenance_mode 0
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
chmod 750 "$final_path"
chmod -R 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
popd
#=================================================
# STORE THE CONFIG FILE CHECKSUM
#=================================================
ynh_script_progression --message="Storing the config file checksum..."
update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION}
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/$app/sites/default/settings.php"
#=================================================
# SETUP THE CRON FILE
#=================================================
ynh_script_progression --message="Setuping the cron file"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
ynh_store_file_checksum --file="$final_path/$app/sites/default/civicrm.settings.php"
#=================================================
# GENERIC FINALIZATION