1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/redirect_ynh.git synced 2024-09-03 20:16:10 +02:00
redirect_ynh/scripts/upgrade

38 lines
1.1 KiB
Bash

#!/bin/bash
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
if [[ "${redirect_type:-}" == *"proxy"* ]]; then
redirect_type="reverseproxy"
else
redirect_type="redirect"
fi
ynh_app_setting_set --app=$app --key='redirect_type' --value=$redirect_type
if [[ -z "${target:-}" ]] && [[ -n "${redirect_path:-}" ]]; then
target="$redirect_path"
ynh_app_setting_delete --app=$app --key=redirect_path
ynh_app_setting_set --app=$app --key=target --value="$target"
fi
if [[ -z "${ynh_overlay:-}" ]]; then
ynh_overlay=1
ynh_app_setting_set --app=$app --key=ynh_overlay --value="$ynh_overlay"
fi
_set_ynh_overlay
#=================================================
# CONFIGURE NGINX
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
mv ../conf/{nginx-$redirect_type.conf,nginx.conf}
ynh_add_nginx_config
ynh_script_progression --message="Upgrade of $app completed" --last