2017-04-24 04:16:02 +02:00
|
|
|
#!/bin/bash
|
2015-09-28 22:13:34 +02:00
|
|
|
|
2018-01-16 17:09:27 +01:00
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2019-06-16 00:06:51 +02:00
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
#=================================================
|
2018-01-16 17:09:27 +01:00
|
|
|
|
2023-05-22 08:30:20 +02:00
|
|
|
member=0
|
2023-05-22 08:35:38 +02:00
|
|
|
fpm_footprint="medium"
|
|
|
|
fpm_usage="medium"
|
2017-04-24 04:16:02 +02:00
|
|
|
|
2019-06-16 00:06:51 +02:00
|
|
|
#=================================================
|
|
|
|
# STORE SETTINGS FROM MANIFEST
|
|
|
|
#=================================================
|
2023-05-22 08:30:20 +02:00
|
|
|
ynh_script_progression --message="Storing installation settings..." --weight=2
|
2017-04-24 04:16:02 +02:00
|
|
|
|
2024-03-25 15:21:41 +01:00
|
|
|
ynh_app_setting_set --app="$app" --key="member" --value="$member"
|
|
|
|
ynh_app_setting_set --app="$app" --key="fpm_footprint" --value="$fpm_footprint"
|
|
|
|
ynh_app_setting_set --app="$app" --key="fpm_usage" --value="$fpm_usage"
|
2019-06-16 00:06:51 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# CREATE A MYSQL DATABASE
|
|
|
|
#=================================================
|
2024-03-25 15:21:41 +01:00
|
|
|
ynh_script_progression --message="Configuring $app's MySQL database..." --weight=1
|
2017-04-24 04:16:02 +02:00
|
|
|
|
2021-07-12 18:16:15 +02:00
|
|
|
ynh_mysql_execute_as_root --sql="ALTER DATABASE $db_name charset=utf8"
|
|
|
|
|
2019-06-16 00:06:51 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2019-07-05 22:34:21 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
2017-04-24 04:16:02 +02:00
|
|
|
|
2019-06-16 00:06:51 +02:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-05-22 08:21:08 +02:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2017-05-18 20:42:22 +02:00
|
|
|
|
2024-03-25 16:17:52 +01:00
|
|
|
chmod 750 "$install_dir"
|
2024-01-24 16:26:05 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
2024-03-25 15:23:23 +01:00
|
|
|
chown -R "$app:www-data" "$install_dir"
|
|
|
|
|
2019-06-16 00:06:51 +02:00
|
|
|
#=================================================
|
|
|
|
# PREPARE AND INSTALL APP
|
|
|
|
#=================================================
|
2024-01-24 16:26:05 +01:00
|
|
|
ynh_script_progression --message="Adding $app's configuration file..." --weight=1
|
2019-06-16 00:06:51 +02:00
|
|
|
|
2024-01-24 16:26:05 +01:00
|
|
|
ynh_add_config --template="../conf/conf.php" --destination="$install_dir/htdocs/conf/conf.php"
|
2022-11-30 08:31:35 +01:00
|
|
|
|
2023-10-02 16:19:14 +02:00
|
|
|
chmod 644 "$install_dir/htdocs/conf/conf.php"
|
2024-03-25 15:21:41 +01:00
|
|
|
chown "$app:$app" "$install_dir/htdocs/conf/conf.php"
|
2021-09-25 13:16:23 +02:00
|
|
|
|
2019-06-16 00:06:51 +02:00
|
|
|
#=================================================
|
2024-03-25 15:21:41 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2019-06-16 00:06:51 +02:00
|
|
|
#=================================================
|
2024-03-25 15:21:41 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
|
|
|
|
# Create a dedicated php-fpm config
|
|
|
|
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
|
|
|
|
|
|
|
|
# Create a dedicated nginx config
|
|
|
|
ynh_add_nginx_config
|
2019-06-16 00:06:51 +02:00
|
|
|
|
|
|
|
# Use logrotate to manage application logfile(s)
|
2023-05-22 08:21:08 +02:00
|
|
|
ynh_use_logrotate --logfile="$install_dir/documents/dolibarr.log"
|
2019-06-16 00:06:51 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2019-07-05 22:34:21 +02:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|