2022-02-28 00:31:44 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2022-02-28 03:36:19 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..."
|
2022-02-28 00:31:44 +01:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-12-28 19:16:22 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2022-02-28 00:31:44 +01:00
|
|
|
|
2023-12-28 19:16:22 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2022-02-28 00:31:44 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2022-02-28 03:36:19 +01:00
|
|
|
ynh_script_progression --message="Configuring PHP-FPM..."
|
2022-02-28 00:31:44 +01:00
|
|
|
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config
|
|
|
|
|
2022-06-17 02:05:45 +02:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2022-02-28 00:31:44 +01:00
|
|
|
#=================================================
|
|
|
|
# SETUP APPLICATION WITH CURL
|
|
|
|
#=================================================
|
2022-02-28 03:36:19 +01:00
|
|
|
ynh_script_progression --message="Setuping application with CURL..."
|
2022-02-28 00:31:44 +01:00
|
|
|
|
|
|
|
# Installation with curl
|
2022-02-28 03:36:19 +01:00
|
|
|
ynh_script_progression --message="Finalizing installation..."
|
|
|
|
ynh_local_curl "/backend/config/login.php?database_type=mysql&database_host=localhost&database_name=$db_name&database_user=$db_user&action=writeDatabaseConfig" "database_password=$db_pwd"
|
2022-06-17 02:05:45 +02:00
|
|
|
ynh_local_curl "/backend/admin/settings.php?action=createUser" "username=$admin" "password=$password"
|
|
|
|
ynh_local_curl "/backend/admin/settings.php?action=createUser" "email=$(ynh_user_get_info --username=$admin --key=mail)" "first_name=$(ynh_user_get_info --username=$admin --key=firstname)" "last_name=$(ynh_user_get_info --username=$admin --key=lastname)" "password=$password" "username=$admin"
|
2022-02-28 00:31:44 +01:00
|
|
|
|
2024-01-16 22:38:04 +01:00
|
|
|
chmod -R o-rwx "$data_dir"
|
|
|
|
chown -R $app: "$data_dir"
|
|
|
|
|
2022-02-28 00:31:44 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2022-02-28 03:36:19 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed"
|