mirror of
https://github.com/YunoHost-Apps/xwiki_ynh.git
synced 2024-09-03 20:36:11 +02:00
94 lines
3.1 KiB
Bash
Executable file
94 lines
3.1 KiB
Bash
Executable file
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
upgrade_type="$(ynh_check_app_version_changed)"
|
|
|
|
if ynh_compare_current_package_version --comparison=le --version='14.10.8~ynh1'; then
|
|
ynh_die --mesage='Upgrade from this version is not supported. Please backup and restore manually the data after a clean new install'
|
|
fi
|
|
|
|
#=================================================
|
|
# STOP SYSTEMD SERVICE
|
|
#=================================================
|
|
ynh_script_progression --message='Stopping a systemd service..' --weight=1
|
|
|
|
ynh_systemd_action --service_name="$app" --action=stop --log_path="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
|
|
if [ "$upgrade_type" == UPGRADE_APP ]
|
|
then
|
|
ynh_script_progression --message='Setting up source files...'
|
|
install_source
|
|
fi
|
|
|
|
#=================================================
|
|
# REAPPLY SYSTEM CONFIGURATIONS
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config using the conf/nginx.conf template
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated systemd config
|
|
ynh_add_systemd_config
|
|
|
|
yunohost service add "$app" --description=XWiki --log="/var/log/$app/$app.log"
|
|
|
|
ynh_use_logrotate --logfile="/var/log/$app"
|
|
|
|
#=================================================
|
|
# ADD A CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message='Adding configuration files...' --weight=1
|
|
|
|
add_config
|
|
set_permissions
|
|
|
|
#=================================================
|
|
# UPGRADE EXTENSIONS
|
|
#=================================================
|
|
enable_super_admin
|
|
|
|
# Start a systemd service
|
|
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
|
|
|
if [ "$install_standard_flavor" -eq 1 ]; then
|
|
ynh_script_progression --message='Upgrading flavor...'
|
|
wait_for_flavor_install
|
|
fi
|
|
|
|
ynh_script_progression --message='Upgrading LDAP extension...' --weight=1
|
|
install_exension 'org.xwiki.contrib.ldap:ldap-authenticator' "$ldap_version"
|
|
|
|
# Disable super admin
|
|
ynh_systemd_action --service_name="$app" --action=stop
|
|
disable_super_admin
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
|
|
ynh_script_progression --message='Starting a systemd service...' --weight=1
|
|
ynh_systemd_action --service_name="$app" --action=start --log_path=systemd --line_match="$systemd_match_start_line"
|
|
wait_xwiki_started
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Upgrade of $app completed" --last
|