2019-05-02 01:04:28 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-02-01 22:16:33 +01:00
|
|
|
# INITIALIZE AND STORE SETTINGS
|
2019-05-02 01:04:28 +02:00
|
|
|
#=================================================
|
|
|
|
|
2022-08-14 23:50:32 +02:00
|
|
|
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
|
|
|
|
2019-05-02 01:04:28 +02:00
|
|
|
#=================================================
|
2021-04-10 01:26:34 +02:00
|
|
|
# CREATE FINAL PATH
|
2019-05-02 01:04:28 +02:00
|
|
|
#=================================================
|
2021-04-10 01:26:34 +02:00
|
|
|
ynh_script_progression --message="Creating final path..."
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
mkdir -p "$install_dir/$app/sites/all/modules"
|
2020-06-10 00:18:25 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2020-06-10 00:18:25 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SPECIFIC SETUP
|
2019-05-02 01:04:28 +02:00
|
|
|
#=================================================
|
|
|
|
# CREATE DRUSH ALIAS
|
|
|
|
#=================================================
|
2020-06-10 00:18:25 +02:00
|
|
|
ynh_script_progression --message="Creating Drush alias..."
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
mkdir -p "$install_dir/.drush"
|
2021-04-15 20:24:11 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
ynh_add_config --template="yoursite.aliases.drushrc.php" --destination="$install_dir/.drush/$app.aliases.drushrc.php"
|
2019-05-02 01:04:28 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# INSTALL COMPOSER
|
|
|
|
#=================================================
|
2020-06-10 00:18:25 +02:00
|
|
|
ynh_script_progression --message="Installing Composer..."
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
mkdir -p "$install_dir/.composer"
|
|
|
|
ynh_add_config --template="composer.json" --destination="$install_dir/.composer/composer.json"
|
|
|
|
ynh_install_composer --workdir="$install_dir/.composer"
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
export PATH="$install_dir/.composer/vendor/bin:$PATH"
|
2019-05-02 01:04:28 +02:00
|
|
|
|
|
|
|
#=================================================
|
2019-05-17 03:37:00 +02:00
|
|
|
# INSTALL DRUPAL AND CIVICRM
|
2019-05-02 01:04:28 +02:00
|
|
|
#=================================================
|
2020-06-10 00:18:25 +02:00
|
|
|
ynh_script_progression --message="Installing Drupal and CiviCRM..."
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
|
|
|
|
|
|
|
|
pushd "$install_dir"
|
|
|
|
_ynh_exec_with_drush_php drush pm-download -y drupal-7 --drupal-project-rename="$app"
|
|
|
|
|
|
|
|
_ynh_exec_with_drush_php 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_with_drush_php drush "@$app" pm-download drush_language
|
|
|
|
# _ynh_exec_with_drush_php drush "@$app" pm-download ldap
|
|
|
|
# _ynh_exec_with_drush_php drush "@$app" pm-enable -y ldap_servers ldap_user ldap_authentication ldap_authorization ldap_authorization_drupal_role
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" pm-download l10n_update
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" pm-enable -y l10n_update
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" language-add "$language"
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" language-default "$language"
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" cache-clear drush
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" l10n-update-refresh
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" l10n-update
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" pm-update
|
|
|
|
_ynh_exec_with_drush_php drush "@$app" core-cron
|
|
|
|
|
|
|
|
ynh_setup_source --dest_dir="$install_dir/$app/sites/all/modules/civicrm" --source_id="civicrm-drupal"
|
|
|
|
ynh_setup_source --dest_dir="$install_dir/$app/sites/all/modules/civicrm" --source_id="civicrm-l10n"
|
|
|
|
|
|
|
|
touch "$install_dir/$app/sites/default/civicrm.settings.php"
|
|
|
|
|
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
|
|
|
|
_ynh_exec_with_drush_php drush --include="$install_dir/$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" --ssl=on
|
2021-04-15 20:24:11 +02:00
|
|
|
popd
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
ynh_store_file_checksum --file="$install_dir/$app/sites/default/settings.php"
|
|
|
|
ynh_store_file_checksum --file="$install_dir/$app/sites/default/civicrm.settings.php"
|
2021-04-15 20:24:11 +02:00
|
|
|
|
2019-05-02 01:04:28 +02:00
|
|
|
#=================================================
|
2024-02-01 22:16:33 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2019-05-02 01:04:28 +02:00
|
|
|
#=================================================
|
2024-02-01 22:16:33 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
2019-05-02 01:04:28 +02:00
|
|
|
|
2024-02-01 22:16:33 +01:00
|
|
|
# Create a Cron job
|
|
|
|
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
2019-05-02 01:04:28 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-06-10 00:18:25 +02:00
|
|
|
ynh_script_progression --message="Installation of $app completed"
|