#!/bin/bash #================================================= # GENERIC START #================================================= # IMPORT GENERIC HELPERS #================================================= source _common.sh source /usr/share/yunohost/helpers #================================================= # INITIALIZE AND STORE SETTINGS #================================================= # Password is required to regen the files... ynh_app_setting_set --app="$app" --key=password --value="$password" password_sha1=$(python -c 'import hashlib; import sys; a=str(sys.argv[1]); print(hashlib.sha512(a.encode("UTF-8")).hexdigest())' "$password") # Validate, fix and set default value for color color="$(_validate_color)" ynh_app_setting_set --app="$app" --key=color --value="$color" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=4 # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R "$app:www-data" "$install_dir" #================================================= # SPECIFIC SETUP #================================================= # ADD A CONFIGURATION #================================================= ynh_script_progression --message="Adding a configuration file..." # Workaround for php code containing __FILE__ and __DIR__ file=__FILE__ dir=__DIR__ ynh_add_config --template="config.php" --destination="$install_dir/config.php" ynh_add_config --template="pheditor.php" --destination="$install_dir/pheditor.php" 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" mkdir -p "$install_dir/templates/mimoza/" ynh_add_config --template="mimoza.css" --destination="$install_dir/templates/mimoza/mimoza.css" ynh_store_file_checksum --file="$install_dir/config.t2t" ynh_store_file_checksum --file="$install_dir/menu.php" #================================================= # SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 # Create a dedicated PHP-FPM config ynh_add_fpm_config # Create a dedicated NGINX config ynh_add_nginx_config # chmod again to fix unaccessible templates / css files chmod -R 755 "$install_dir" # don't allow read access to config.php and pages/ for everyone chmod 750 "$install_dir"/config.php chmod -R 750 "$install_dir"/var/pages/ # chmod root folder chmod 750 "$install_dir" #================================================= # END OF SCRIPT #================================================= ynh_script_progression --message="Installation of $app completed" --last