1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/drupal7_ynh.git synced 2024-09-03 18:26:19 +02:00
drupal7_ynh/scripts/install
2024-05-23 10:11:51 +02:00

92 lines
3.3 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
#=================================================
# INSTALL COMPOSER
#=================================================
ynh_script_progression --message="Installing Composer..." --weight=1
mkdir -p "$install_dir/.composer"
ynh_add_config --template="composer.json" --destination="$install_dir/.composer/composer.json"
ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir/.composer"
#=================================================
# CREATE DRUSH ALIAS
#=================================================
ynh_script_progression --message="Creating Drush alias..." --weight=1
mkdir -p "$install_dir/.drush"
ynh_add_config --template="yoursite.aliases.drushrc.php" --destination="$install_dir/.drush/$app.aliases.drushrc.php"
#=================================================
# INSTALL DRUPAL
#=================================================
ynh_script_progression --message="Installing Drupal..." --weight=1
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
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
popd
ynh_store_file_checksum --file="$install_dir/$app/sites/default/settings.php"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
# Create a dedicated NGINX config
ynh_add_nginx_config
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last