mirror of
https://github.com/YunoHost-Apps/paheko_ynh.git
synced 2024-09-03 19:56:22 +02:00
70 lines
2.5 KiB
Bash
70 lines
2.5 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# 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"
|
|
|
|
#=================================================
|
|
# PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring PHP-FPM..." --weight=5
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding a configuration file..." --weight=5
|
|
|
|
# create a key for the secret key CSFR:
|
|
secret_key=$(ynh_string_random --length=50)
|
|
ynh_app_setting_set --app=$app --key=secret_key --value=$secret_key
|
|
|
|
# Install configuration files
|
|
ynh_add_config --template="config.local.php" --destination="$install_dir/config.local.php"
|
|
ynh_add_config --template="config.local.yunohost.php" --destination="$install_dir/config.local.yunohost.php"
|
|
ynh_add_config --template="config.local.user.php" --destination="$install_dir/config.local.user.php"
|
|
|
|
# Permissions on files and directories
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
find "$install_dir" -type d -exec chmod 550 {} +
|
|
find "$install_dir" -type f -exec chmod 440 {} +
|
|
find "$install_dir/data" -type d -exec chmod 770 {} +
|
|
find "$install_dir/data" -type f -exec chmod 660 {} +
|
|
chmod 440 "$install_dir/config.local.php"
|
|
chmod 440 "$install_dir/config.local.yunohost.php"
|
|
chmod 660 "$install_dir/config.local.user.php"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|