1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/galette_ynh.git synced 2024-09-03 18:36:28 +02:00
galette_ynh/scripts/install
Éric Gaspar 91c8a6764c fix
2023-11-16 20:01:32 +01:00

87 lines
3.1 KiB
Bash

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
timezone="$(cat /etc/timezone)"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# 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"
#=================================================
# 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
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
# SPECIFIC SETUP
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="config.inc.php" --destination="$install_dir/galette/config/config.inc.php"
chmod 400 "$install_dir/galette/config/config.inc.php"
chown $app:$app "$install_dir/galette/config/config.inc.php"
#=================================================
# SETUP APPLICATION WITH CURL
#=================================================
ynh_script_progression --message="Setuping application with CURL..."
# Installation with curl
ynh_script_progression --message="Finalizing installation..."
ynh_local_curl "/installer.php" "install_permsok=1"
ynh_local_curl "/installer.php" "install_type=i"
ynh_local_curl "/installer.php" "install_dbtype=pgsql" "install_dbhost=localhost" "install_dbport=5432" "install_dbuser=$db_user" "install_dbpass=$db_pwd" "install_dbname=$db_name" "install_dbprefix=galette_"
ynh_local_curl "/installer.php" "install_dbperms_ok=1"
ynh_local_curl "/installer.php" "install_dbwrite_ok=1"
ynh_local_curl "/installer.php" "install_adminlogin=$admin" "install_adminpass=$password" "install_adminpass_verif=$password"
ynh_local_curl "/installer.php" "install_prefs_ok=1"
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
chown $app $install_dir/galette/config
chmod g+rwx $install_dir/galette/config
for folder in attachments cache exports files imports logs photos templates_c tempimages
do
chown $app $install_dir/galette/data/$folder
chmod g+rwx $install_dir/galette/data/$folder
done
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last