1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/xwiki_ynh.git synced 2024-09-03 20:36:11 +02:00
xwiki_ynh/scripts/upgrade
2024-09-02 00:14:23 +02:00

85 lines
2.8 KiB
Bash
Executable file

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
if ynh_app_upgrading_from_version_before_or_equal_to '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 'Stopping $app's systemd service...
ynh_systemctl --service="$app" --action=stop
#=================================================
# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...)
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
# FIXME: this is still supported but the recommendation is now to *always* re-setup the app sources wether or not the upstream sources changed
if ynh_app_upstream_version_changed
then
ynh_script_progression 'Setting up source files...'
install_source
fi
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression "Adding system configurations related to $app..."
# Create a dedicated NGINX config using the conf/nginx.conf template
ynh_config_add_nginx
# Create a dedicated systemd config
ynh_config_add_systemd
yunohost service add "$app" --description=XWiki --log="/var/log/$app/$app.log"
ynh_config_add_logrotate "/var/log/$app"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression 'Adding configuration files...'
add_config
set_permissions
#=================================================
# UPGRADE EXTENSIONS
#=================================================
enable_super_admin
# Start a systemd service
ynh_systemctl --service="$app" --action=start --log_path=systemd --wait_until="$systemd_match_start_line"
if [ "$install_standard_flavor" -eq 1 ]; then
ynh_script_progression 'Upgrading flavor...'
wait_for_flavor_install
fi
ynh_script_progression 'Upgrading LDAP extension...'
install_exension 'org.xwiki.contrib.ldap:ldap-authenticator' "$ldap_version"
# Disable super admin
ynh_systemctl --service="$app" --action=stop
disable_super_admin
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
ynh_systemctl --service="$app" --action=start --log_path=systemd --wait_until="$systemd_match_start_line"
wait_xwiki_started
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression "Upgrade of $app completed"