mirror of
https://github.com/YunoHost-Apps/horde_ynh.git
synced 2024-09-03 19:16:08 +02:00
157 lines
5.8 KiB
Bash
Executable file
157 lines
5.8 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
|
|
#REMOVEME? app=$YNH_APP_INSTANCE_NAME
|
|
|
|
#REMOVEME? domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
#REMOVEME? path=$(ynh_app_setting_get --app=$app --key=path)
|
|
#REMOVEME? admin=$(ynh_app_setting_get --app=$app --key=admin)
|
|
#REMOVEME? service_autodiscovery=$(ynh_app_setting_get --app=$app --key=service_autodiscovery)
|
|
#REMOVEME? #REMOVEME? install_dir=$(ynh_app_setting_get --app=$app --key=install_dir)
|
|
#REMOVEME? port=$(ynh_app_setting_get --app=$app --key=port)
|
|
#REMOVEME? secret_key=$(ynh_app_setting_get --app=$app --key=secret_key)
|
|
#REMOVEME? db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
#REMOVEME? db_user=$db_name
|
|
#REMOVEME? db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
|
#REMOVEME? gollem_data_dir=$(ynh_app_setting_get --app=$app --key=gollem_data_dir)
|
|
|
|
#=================================================
|
|
# CHECK VERSION
|
|
#=================================================
|
|
ynh_script_progression --message="Checking version..."
|
|
|
|
upgrade_type=$(ynh_check_app_version_changed)
|
|
|
|
#=================================================
|
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
|
|
|
# Backup the current version of the app
|
|
#REMOVEME? ynh_backup_before_upgrade
|
|
#REMOVEME? ynh_clean_setup () {
|
|
# Restore it if the upgrade fails
|
|
#REMOVEME? ynh_restore_upgradebackup
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
#REMOVEME? ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# STANDARD UPGRADE STEPS
|
|
#=================================================
|
|
# ENSURE DOWNWARD COMPATIBILITY
|
|
#=================================================
|
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
|
|
# Cleaning legacy permissions
|
|
#REMOVEME? if ynh_legacy_permissions_exists; then
|
|
#REMOVEME? ynh_legacy_permissions_delete_all
|
|
|
|
ynh_app_setting_delete --app=$app --key=is_public
|
|
fi
|
|
|
|
# If install_dir doesn't exist, create it
|
|
if [ -z "$gollem_data_dir" ]; then
|
|
gollem_data_dir=/home/yunohost.app/$app
|
|
ynh_app_setting_set --app=$app --key=gollem_data_dir --value=$gollem_data_dir
|
|
fi
|
|
|
|
#=================================================
|
|
# CREATE DEDICATED USER
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
|
|
# Create a dedicated user (if not existing)
|
|
#REMOVEME? ynh_system_user_create --username=$app --home_dir="$install_dir"
|
|
|
|
#=================================================
|
|
# UPGRADE DEPENDENCIES
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
|
|
|
#REMOVEME? ynh_install_app_dependencies $pkg_dependencies
|
|
|
|
#=================================================
|
|
# PHP-FPM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config
|
|
|
|
#=================================================
|
|
# NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
config_nginx
|
|
|
|
#=================================================
|
|
# SPECIFIC UPGRADE
|
|
#=================================================
|
|
# UPGRADE SOURCE FILE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading source files..." --weight=6
|
|
|
|
pear_cmd="$install_dir/pear/pear -c $install_dir/pear.conf"
|
|
$pear_cmd channel-update pear.horde.org
|
|
$pear_cmd upgrade -R $install_dir -a -B -c pear.horde.org || true
|
|
|
|
#=================================================
|
|
# PATCH APPLICATION
|
|
#=================================================
|
|
ynh_script_progression --message="Patching application..." --weight=7
|
|
|
|
patch_app
|
|
|
|
#=================================================
|
|
# CONFIGURE HORDE
|
|
#=================================================
|
|
ynh_script_progression --message="Configuring application..." --weight=3
|
|
|
|
config_horde
|
|
|
|
#=================================================
|
|
# SECURE FILES AND DIRECTORIES
|
|
#=================================================
|
|
ynh_script_progression --message="Protecting directory..."
|
|
|
|
set_permission
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# SETUP LOGROTATE
|
|
#=================================================
|
|
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
|
|
|
ynh_use_logrotate --logfile="$install_dir/horde" --nonappend --specific_user www-data/horde
|
|
ynh_use_logrotate --logfile="$install_dir/horde/services" --specific_user www-data/horde
|
|
ynh_use_logrotate --logfile="$install_dir/horde/services/portal" --specific_user www-data/horde
|
|
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
#REMOVEME? ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
|
|
#REMOVEME? ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|