2020-03-01 11:28:28 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
source _common.sh
|
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
2024-01-17 11:23:28 +01:00
|
|
|
# INITIALIZE AND STORE SETTINGS
|
2020-03-01 11:28:28 +01:00
|
|
|
#=================================================
|
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Password is required to regen the files...
|
|
|
|
ynh_app_setting_set --app="$app" --key=password --value="$password"
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
password_sha1=$(python -c 'import hashlib; import sys; a=str(sys.argv[1]); print(hashlib.sha512(a.encode("UTF-8")).hexdigest())' $password)
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Remove eventual '#' prefix from color
|
|
|
|
color=${color#"#"}
|
|
|
|
# Check if the format is valid, put #555555 instead
|
|
|
|
if [[ ! "$color" =~ ^[A-Fa-f0-9]{6}$ ]]; then
|
|
|
|
color=555555
|
|
|
|
fi
|
|
|
|
# Save color back
|
|
|
|
ynh_app_setting_set --app="$app" --key=color --value="$color"
|
2020-03-01 11:28:28 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2020-11-27 10:49:00 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=4
|
2020-03-01 11:28:28 +01:00
|
|
|
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R "$app:www-data" "$install_dir"
|
2022-07-17 03:21:03 +02:00
|
|
|
|
2020-03-01 11:28:28 +01:00
|
|
|
#=================================================
|
|
|
|
# SPECIFIC SETUP
|
|
|
|
#=================================================
|
2022-07-17 03:21:03 +02:00
|
|
|
# ADD A CONFIGURATION
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Adding a configuration file..."
|
2020-03-01 13:21:59 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Workaround for php code containing __FILE__ and __DIR__
|
|
|
|
file=__FILE__
|
|
|
|
dir=__DIR__
|
2020-04-06 01:28:35 +02:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_add_config --template="config.php" --destination="$install_dir/config.php"
|
|
|
|
ynh_add_config --template="pheditor.php" --destination="$install_dir/pheditor.php"
|
2023-03-17 12:29:40 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
mkdir -p "$install_dir/templates/minimaxing/"
|
|
|
|
ynh_add_config --template="minimaxing.less" --destination="$install_dir/templates/minimaxing/minimaxing.less"
|
|
|
|
ynh_add_config --template="minimaxing.css" --destination="$install_dir/templates/minimaxing/minimaxing.css"
|
2020-04-06 09:49:53 +02:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
mkdir -p "$install_dir/templates/mimoza/"
|
|
|
|
ynh_add_config --template="mimoza.css" --destination="$install_dir/templates/mimoza/mimoza.css"
|
2020-05-14 20:56:58 +02:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_store_file_checksum --file="$install_dir/config.t2t"
|
|
|
|
ynh_store_file_checksum --file="$install_dir/menu.php"
|
2020-04-28 08:57:06 +02:00
|
|
|
|
2020-03-01 11:28:28 +01:00
|
|
|
#=================================================
|
2024-01-17 11:23:28 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2020-03-01 11:28:28 +01:00
|
|
|
#=================================================
|
2024-01-17 11:23:28 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Create a dedicated PHP-FPM config
|
|
|
|
ynh_add_fpm_config
|
2020-03-01 11:28:28 +01:00
|
|
|
|
2024-01-17 11:23:28 +01:00
|
|
|
# Create a dedicated NGINX config
|
|
|
|
ynh_add_nginx_config
|
2020-03-01 11:28:28 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2020-11-27 10:49:00 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|