2014-06-12 13:28:57 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2017-07-16 10:19:13 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
#=================================================
|
|
|
|
|
2023-03-05 12:50:26 +01:00
|
|
|
password="$YNH_APP_ARG_PASSWORD"
|
2022-02-26 20:48:10 +01:00
|
|
|
random=$(ynh_string_random --length=24)
|
2017-07-16 10:19:13 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# STORE SETTINGS FROM MANIFEST
|
|
|
|
#=================================================
|
2023-03-05 12:50:26 +01:00
|
|
|
ynh_script_progression --message="Storing installation settings..." --weight=1
|
2020-04-07 17:13:07 +02:00
|
|
|
|
2022-02-27 08:34:36 +01:00
|
|
|
ynh_app_setting_set --app=$app --key=random --value=$random
|
2023-03-05 12:50:26 +01:00
|
|
|
ynh_app_setting_set --app=$app --key=password --value="$password"
|
2017-07-16 10:19:13 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2020-09-25 18:53:18 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=4
|
2017-07-16 10:19:13 +02:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-03-05 12:42:46 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2014-06-12 13:28:57 +02:00
|
|
|
|
2022-02-28 16:41:12 +01:00
|
|
|
# Install French language
|
2023-03-05 12:42:46 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir/user/languages" --source_id="fr"
|
2022-02-27 11:14:34 +01:00
|
|
|
|
2022-02-26 21:24:21 +01:00
|
|
|
# copy index file
|
2023-03-05 12:42:46 +01:00
|
|
|
cp ../conf/index.php $install_dir/
|
2022-02-26 21:24:21 +01:00
|
|
|
|
2023-03-05 12:42:46 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2022-02-26 20:24:27 +01:00
|
|
|
|
2018-06-04 21:28:11 +02:00
|
|
|
#=================================================
|
|
|
|
# NGINX CONFIGURATION
|
|
|
|
#=================================================
|
2020-09-25 18:53:18 +02:00
|
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
2020-04-07 17:13:07 +02:00
|
|
|
|
2022-02-26 20:24:27 +01:00
|
|
|
# Create a dedicated NGINX config
|
2018-06-04 21:28:11 +02:00
|
|
|
ynh_add_nginx_config
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# PHP-FPM CONFIGURATION
|
|
|
|
#=================================================
|
2020-09-25 18:53:18 +02:00
|
|
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
|
2020-04-07 17:13:07 +02:00
|
|
|
|
2022-02-28 16:44:29 +01:00
|
|
|
# Create a dedicated PHP-FPM config
|
2022-02-26 20:26:50 +01:00
|
|
|
ynh_add_fpm_config
|
2014-06-12 18:16:54 +02:00
|
|
|
|
2020-10-09 13:51:09 +02:00
|
|
|
#=================================================
|
2022-02-26 20:24:27 +01:00
|
|
|
# ADD A CONFIGURATION
|
2020-10-09 13:51:09 +02:00
|
|
|
#=================================================
|
2022-02-26 20:24:27 +01:00
|
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
2020-10-09 13:51:09 +02:00
|
|
|
|
2023-03-05 12:42:46 +01:00
|
|
|
ynh_add_config --template="../conf/config-sample.php" --destination="$install_dir/user/config.php"
|
2022-02-26 20:24:27 +01:00
|
|
|
|
2023-03-05 12:42:46 +01:00
|
|
|
chmod 600 "$install_dir/user/config.php"
|
|
|
|
chown $app:$app "$install_dir/user/config.php"
|
2014-06-13 07:30:00 +02:00
|
|
|
|
2020-04-07 17:13:07 +02:00
|
|
|
#=================================================
|
2022-02-26 20:35:40 +01:00
|
|
|
# SETUP APPLICATION WITH CURL
|
2020-04-07 17:13:07 +02:00
|
|
|
#=================================================
|
|
|
|
|
2022-02-26 21:14:01 +01:00
|
|
|
# Set the app as temporarily public for curl call
|
|
|
|
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
|
|
|
# Making the app public for curl
|
2023-03-05 12:42:46 +01:00
|
|
|
#REMOVEME? ynh_permission_update --permission="main" --add="visitors"
|
2014-07-01 20:51:36 +02:00
|
|
|
|
2022-02-26 21:14:01 +01:00
|
|
|
# Installation with curl
|
|
|
|
ynh_script_progression --message="Finalizing installation..." --weight=1
|
|
|
|
ynh_local_curl "admin/install.php" "install=dummy"
|
2017-07-16 10:19:13 +02:00
|
|
|
|
2020-04-07 17:13:07 +02:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2022-02-26 20:31:18 +01:00
|
|
|
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|