mirror of
https://github.com/YunoHost-Apps/joomla_ynh.git
synced 2024-09-03 19:26:34 +02:00
1cba3919fb
new cli from 4.3 allows install, no need for config file
87 lines
3 KiB
Bash
87 lines
3 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
email=$(ynh_user_get_info --username="$admin" --key="mail")
|
|
secret=$(ynh_string_random --length="16")
|
|
db_prefix="$(ynh_string_random --length="5" | tr '[:upper:]' '[:lower:]' | tr -d '0123456789')_"
|
|
|
|
#=================================================
|
|
# STORE SETTINGS FROM MANIFEST
|
|
#=================================================
|
|
ynh_script_progression --message="Storing installation settings..."
|
|
|
|
ynh_app_setting_set --app=$app --key=secret --value=$secret
|
|
ynh_app_setting_set --app=$app --key=db_prefix --value=$db_prefix
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..."
|
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
|
|
|
ynh_add_fpm_config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
# ynh_script_progression --message="Adding a configuration file..."
|
|
|
|
# ynh_add_config --template="configuration.php" --destination="$install_dir/configuration.php"
|
|
|
|
# chmod 400 "$install_dir/configuration.php"
|
|
# chown $app:$app "$install_dir/configuration.php"
|
|
|
|
#=================================================
|
|
# SETUP DATABASE
|
|
#=================================================
|
|
ynh_script_progression --message="Setuping database..."
|
|
|
|
pushd "$install_dir"
|
|
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
|
|
popd
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# SETUP LOGROTATE
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring log rotation..."
|
|
|
|
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"
|
|
|
|
# Use logrotate to manage application logfile(s)
|
|
ynh_use_logrotate
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed"
|