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")
|
|
|
|
|
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
|
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
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
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
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config
|
2022-08-27 21:52:03 +02:00
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
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
|
|
|
#=================================================
|
2022-01-22 20:55:44 +01:00
|
|
|
ynh_script_progression --message="Adding a configuration file..."
|
2017-07-12 01:45:37 +02:00
|
|
|
|
2023-10-30 09:43:36 +01:00
|
|
|
ynh_add_config --template="configuration.php" --destination="$install_dir/configuration.php"
|
2022-01-22 20:55:44 +01:00
|
|
|
|
2023-10-30 09:29:45 +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-10-30 10:24:12 +01:00
|
|
|
pushd "$install_dir"
|
|
|
|
php$phpversion cli/joomla.php user:add --username "$admin" --name "$admin" --password "$password" --email "$email" --usergroup "Super Users" -n
|
2022-03-23 08:21:02 +01:00
|
|
|
popd
|
2023-10-30 10:24:12 +01:00
|
|
|
INSERT INTO `js_users` (`name`, `username`, `password`, `params`, `registerDate`, `lastvisitDate`, `lastResetTime`) VALUES ('Administrator2', 'admin2', 'd2064d358136996bd22421584a7cb33e:trd7TvKHx6dMeoMmBVxYmg0vuXEA4199', '', NOW(), NOW(), NOW());
|
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"
|