2017-07-12 01:45:37 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
#=================================================
|
|
|
|
|
2023-10-30 09:43:36 +01:00
|
|
|
email=$(ynh_user_get_info --username="$admin" --key="mail")
|
2022-03-23 08:21:02 +01:00
|
|
|
secret=$(ynh_string_random --length="16")
|
2024-02-01 09:11:08 +01:00
|
|
|
db_prefix="$(ynh_string_random --length="5" | tr '[:upper:]' '[:lower:]' | tr -d '0123456789')_"
|
2022-03-23 08:21:02 +01:00
|
|
|
|
2017-07-12 01:45:37 +02:00
|
|
|
#=================================================
|
|
|
|
# STORE SETTINGS FROM MANIFEST
|
|
|
|
#=================================================
|
2023-10-30 09:43:36 +01:00
|
|
|
ynh_script_progression --message="Storing installation settings..."
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2022-03-23 08:21:02 +01:00
|
|
|
ynh_app_setting_set --app=$app --key=secret --value=$secret
|
2024-02-01 08:46:25 +01:00
|
|
|
ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix
|
2017-07-12 01:45:37 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..."
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2023-10-30 09:29:45 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2023-10-30 09:29:45 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2017-07-12 01:45:37 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
# PHP-FPM CONFIGURATION
|
2017-07-12 01:45:37 +02:00
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2022-01-22 20:55:44 +01:00
|
|
|
ynh_add_fpm_config
|
2022-08-27 21:52:03 +02:00
|
|
|
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2017-07-12 01:45:37 +02:00
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
# SPECIFIC SETUP
|
2017-07-12 01:45:37 +02:00
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
# ADD A CONFIGURATION
|
2017-07-12 01:45:37 +02:00
|
|
|
#=================================================
|
2024-02-01 18:13:34 +01:00
|
|
|
# ynh_script_progression --message="Adding a configuration file..."
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2024-02-01 18:13:34 +01:00
|
|
|
# ynh_add_config --template="configuration.php" --destination="$install_dir/configuration.php"
|
2022-01-22 20:55:44 +01:00
|
|
|
|
2024-02-01 18:13:34 +01:00
|
|
|
# chmod 400 "$install_dir/configuration.php"
|
|
|
|
# chown $app:$app "$install_dir/configuration.php"
|
2017-07-12 01:45:37 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
# SETUP DATABASE
|
2017-07-12 01:45:37 +02:00
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
ynh_script_progression --message="Setuping database..."
|
|
|
|
|
2023-12-04 21:06:23 +01:00
|
|
|
pushd "$install_dir"
|
2024-02-01 18:13:34 +01:00
|
|
|
php$phpversion installation/joomla.php install --admin-user="$admin" --admin-username="$admin" --admin-password="$password" --admin-email="$email" --db-type=mysql --db-host=localhost --db-user=$db_user --db-pass=$db_pwd --db-name=$db_name --db-prefix=$db_prefix --site-name="My joomla website" -n
|
2023-12-04 21:06:23 +01:00
|
|
|
popd
|
2022-03-23 08:21:02 +01:00
|
|
|
|
2022-01-22 20:55:44 +01:00
|
|
|
#=================================================
|
|
|
|
# GENERIC FINALIZATION
|
|
|
|
#=================================================
|
|
|
|
# SETUP LOGROTATE
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring log rotation..."
|
|
|
|
|
2022-03-23 08:21:02 +01:00
|
|
|
mkdir -p "/var/log/$app"
|
|
|
|
chmod 750 "/var/log/$app"
|
|
|
|
chmod -R o-rwx "/var/log/$app"
|
|
|
|
chown -R $app:www-data "/var/log/$app"
|
|
|
|
|
2022-01-22 20:55:44 +01:00
|
|
|
# Use logrotate to manage application logfile(s)
|
|
|
|
ynh_use_logrotate
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2022-01-22 20:55:44 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2022-01-22 20:55:44 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed"
|