1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/jeedom_ynh.git synced 2024-09-03 19:26:26 +02:00
jeedom_ynh/scripts/install
2024-06-02 15:03:17 +02:00

79 lines
2.6 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# CONFIGURING RIGHTS
#=================================================
ynh_script_progression --message="Configuring permissions..."
_jeedom_set_permission
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
# 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"
# FIXME: is it used?? It's not even reboot persistent…
# Create tmp required by Jeedom
mkdir -p /tmp/jeedom
chmod 750 /tmp/jeedom
chown "$app:www-data" -R /tmp/jeedom
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding $app's configuration files..." --weight=1
ynh_add_config --template="common.config.php" --destination="$install_dir/core/config/common.config.php"
chmod 400 "$install_dir/core/config/common.config.php"
chown "$app:$app" "$install_dir/core/config/common.config.php"
#=================================================
# INSTALL JEEDOM
#=================================================
ynh_script_progression --message="Installing $app..."
# Install Jeedom
"php$phpversion" "$install_dir/install/install.php" mode=force
# Configure LDAP and the Admin User and access settings
ynh_add_config --template="config.sql" --destination="$install_dir/config.sql"
ynh_mysql_execute_file_as_root --file="$install_dir/config.sql" --database="$db_name"
ynh_secure_remove --file="$install_dir/config.sql"
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
# Cron
ynh_add_config --template="cronjeedom" --destination="/etc/cron.d/${app}"
ynh_add_config --template="cronjeedom_watchdog" --destination="/etc/cron.d/${app}_watchdog"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed"