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/upgrade
2024-05-21 11:19:51 +02:00

80 lines
2.6 KiB
Bash

#!/bin/bash
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
#ynh_script_progression --message="Ensuring downward compatibility..."
#=================================================
# CONFIGURING RIGHTS
#=================================================
ynh_script_progression --message="Configuring permissions..."
_jeedom_set_permission
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="/core/config/common.config.php"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
# Create tmp required by Jeedom
mkdir -p /tmp/jeedom
chmod 750 /tmp/jeedom
chown "$app:www-data" -R /tmp/jeedom
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating $app's configuration files..."
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"
#=================================================
# UPGRADE JEEDOM
#=================================================
ynh_script_progression --message="Upgrading Jeedom..."
# Upgrade Jeedom
"php$phpversion" "$install_dir/install/install.php" mode=force
# Check
# "php$phpversion" "$install_dir/install/sick.php"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading 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="Upgrade of $app completed"