2020-12-16 19:56:57 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
2023-01-12 09:28:16 +01:00
|
|
|
fpm_footprint="low"
|
|
|
|
fpm_free_footprint=0
|
|
|
|
fpm_usage="low"
|
2020-12-16 19:56:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STORE SETTINGS FROM MANIFEST
|
|
|
|
#=================================================
|
|
|
|
|
2023-01-12 09:28:16 +01:00
|
|
|
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
|
|
|
|
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
|
2020-12-16 19:56:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# 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
|
2023-03-23 15:26:20 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2020-12-16 19:56:57 +01:00
|
|
|
|
2023-03-23 15:26:20 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-05-27 13:19:07 +02:00
|
|
|
|
2020-12-16 19:56:57 +01:00
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=10
|
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=3
|
|
|
|
|
|
|
|
# Create a dedicated PHP-FPM config
|
2023-01-12 09:28:16 +01:00
|
|
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
2020-12-16 19:56:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MODIFY A CONFIG FILE
|
|
|
|
#=================================================
|
2021-11-16 10:39:20 +01:00
|
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
2020-12-16 19:56:57 +01:00
|
|
|
|
2023-03-23 15:26:20 +01:00
|
|
|
ynh_add_config --template="../conf/config-dist.php" --destination="$install_dir/data/config.php"
|
2020-12-16 19:56:57 +01:00
|
|
|
|
2023-03-23 15:26:20 +01:00
|
|
|
chmod 400 "$install_dir/data/config.php"
|
|
|
|
chown $app "$install_dir/data/config.php"
|
2020-12-16 19:56:57 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|