mirror of
https://github.com/YunoHost-Apps/drupal_ynh.git
synced 2024-09-03 18:35:53 +02:00
116 lines
3.8 KiB
Bash
116 lines
3.8 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source ynh_add_swap
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
mkdir -p "$install_dir/$app"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
#=================================================
|
|
# 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
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# ADD SWAP
|
|
#=================================================
|
|
ynh_script_progression --message="Adding swap..." --weight=1
|
|
|
|
if [ "${PACKAGE_CHECK_EXEC:-0}" -eq 0 ]; then
|
|
ynh_add_swap --size=$swap_needed
|
|
fi
|
|
|
|
#=================================================
|
|
# CREATE DRUSH ALIAS
|
|
#=================================================
|
|
ynh_script_progression --message="Creating Drush alias..." --weight=1
|
|
|
|
mkdir -p "$install_dir/drush/sites/"
|
|
ynh_add_config --template="example.site.yml" --destination="$install_dir/drush/sites/$app.site.yml"
|
|
|
|
#=================================================
|
|
# INSTALL COMPOSER
|
|
#=================================================
|
|
ynh_script_progression --message="Installing Composer..." --weight=3
|
|
|
|
mkdir -p "$install_dir/.composer"
|
|
ynh_add_config --template="composer.json" --destination="$install_dir/composer.json"
|
|
|
|
ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir"
|
|
|
|
export PATH="$install_dir/vendor/bin:$PATH"
|
|
|
|
#=================================================
|
|
# INSTALL DRUPAL
|
|
#=================================================
|
|
ynh_script_progression --message="Installing Drupal..." --weight=5
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
pushd "$install_dir"
|
|
_ynh_exec_with_drush_php \
|
|
drush 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
|
|
popd
|
|
|
|
#=================================================
|
|
# SETUP THE CRON FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up the cron file..." --weight=1
|
|
|
|
ynh_add_config --template="cron" --destination="/etc/cron.d/$app"
|
|
|
|
#=================================================
|
|
# STORE THE CONFIG FILE CHECKSUM
|
|
#=================================================
|
|
ynh_script_progression --message="Storing the config file checksum..." --weight=1
|
|
|
|
# Calculate and store the config file checksum into the app settings
|
|
ynh_store_file_checksum --file="$install_dir/$app/sites/default/settings.php"
|
|
|
|
chmod 400 "$install_dir/$app/sites/default/settings.php"
|
|
chown "$app:$app" "$install_dir/$app/sites/default/settings.php"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|