2018-04-23 22:40:01 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2024-01-03 21:39:54 +01:00
|
|
|
# Default settings for php-fpm
|
|
|
|
fpm_footprint="low"
|
|
|
|
fpm_free_footprint=0
|
|
|
|
fpm_usage="medium"
|
2021-10-08 23:01:16 +02:00
|
|
|
|
2018-04-23 22:40:01 +02:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2019-06-01 19:22:51 +02:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=3
|
2018-04-23 22:40:01 +02:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2024-01-03 21:39:54 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2018-04-29 10:32:06 +02:00
|
|
|
|
2024-01-03 21:39:54 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2018-04-23 22:40:01 +02:00
|
|
|
|
|
|
|
#=================================================
|
2024-01-03 21:39:54 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2018-04-23 22:40:01 +02:00
|
|
|
#=================================================
|
2024-01-03 21:39:54 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2018-04-23 22:40:01 +02:00
|
|
|
|
2021-05-01 12:12:35 +02:00
|
|
|
# Create a dedicated PHP-FPM config
|
2022-03-25 13:55:27 +01:00
|
|
|
ynh_add_fpm_config
|
2022-06-26 18:01:41 +02:00
|
|
|
|
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2018-04-23 22:40:01 +02:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC SETUP
|
|
|
|
#=================================================
|
2019-06-01 19:22:51 +02:00
|
|
|
# INSTALL AND INITIALIZE COMPOSER
|
2018-04-23 22:40:01 +02:00
|
|
|
#=================================================
|
2019-06-01 19:22:51 +02:00
|
|
|
ynh_script_progression --message="Installing composer..." --weight=6
|
|
|
|
|
2024-01-03 21:39:54 +01:00
|
|
|
ynh_install_composer --phpversion="$phpversion" --workdir="$install_dir"
|
2018-04-23 22:40:01 +02:00
|
|
|
|
|
|
|
#=================================================
|
2022-06-26 18:01:41 +02:00
|
|
|
# ADD A CONFIGURATION
|
2018-04-23 22:40:01 +02:00
|
|
|
#=================================================
|
2022-06-26 18:01:41 +02:00
|
|
|
ynh_script_progression --message="Adding a configuration file..."
|
2018-04-23 22:40:01 +02:00
|
|
|
|
2024-01-03 21:39:54 +01:00
|
|
|
mkdir -p "$install_dir/sites/$domain"
|
|
|
|
ynh_add_config --template="../conf/config.json" --destination="$install_dir/sites/$domain/config.json"
|
2019-06-01 19:22:51 +02:00
|
|
|
|
|
|
|
# Set permissions to app files
|
2024-01-03 21:39:54 +01:00
|
|
|
chmod 750 "$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2018-04-23 22:40:01 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# SETUP APPLICATION WITH CURL
|
|
|
|
#=================================================
|
2022-06-26 18:01:41 +02:00
|
|
|
ynh_script_progression --message="Setuping application with CURL..."
|
2018-04-23 22:40:01 +02:00
|
|
|
|
2022-06-26 18:01:41 +02:00
|
|
|
# Set the app as temporarily public for curl call
|
|
|
|
ynh_script_progression --message="Configuring SSOwat..."
|
2018-04-23 22:40:01 +02:00
|
|
|
|
|
|
|
# Installation with curl
|
2019-06-01 19:22:51 +02:00
|
|
|
ynh_script_progression --message="Finalizing installation..." --weight=2
|
|
|
|
ynh_local_curl "/signIn" "username=$admin" "password=$password" "repeatPassword=$password"
|
2018-04-23 22:40:01 +02:00
|
|
|
|
|
|
|
# Calculate and store the config file checksum into the app settings
|
2024-01-03 21:39:54 +01:00
|
|
|
ynh_store_file_checksum --file="$install_dir/sites/$domain/config.json"
|
2019-06-01 19:22:51 +02:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
2018-04-23 22:40:01 +02:00
|
|
|
|
2019-06-01 19:22:51 +02:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|