2016-06-20 23:43:51 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-05-26 10:27:01 +02:00
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
2016-06-20 23:43:51 +02:00
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
source _common.sh
|
2018-05-26 10:27:01 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# MANAGE SCRIPT FAILURE
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
# Exit if an error occurs during the execution of the script
|
|
|
|
ynh_abort_if_errors
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
|
|
#=================================================
|
2016-06-20 23:43:51 +02:00
|
|
|
|
|
|
|
# Retrieve arguments
|
2019-05-15 18:42:44 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
2016-06-20 23:43:51 +02:00
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
2019-05-09 19:57:27 +02:00
|
|
|
path_url=$YNH_APP_ARG_PATH
|
2023-01-08 14:33:31 +01:00
|
|
|
proxy_path=$YNH_APP_ARG_PROXY_PATH
|
|
|
|
assets_path=$YNH_APP_ARG_ASSETS_PATH
|
|
|
|
[[ "$assets_path" = "" ]] && assets_path="/dev/null"
|
|
|
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
|
|
|
|
|
|
|
#=================================================
|
2023-01-08 14:46:10 +01:00
|
|
|
# REVERSEPROXY_YNH
|
2023-01-08 14:33:31 +01:00
|
|
|
#=================================================
|
2016-06-20 23:43:51 +02:00
|
|
|
|
|
|
|
# Check domain/path availability
|
2021-01-23 15:21:17 +01:00
|
|
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
2016-06-20 23:43:51 +02:00
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
# Validate reverse proxy destination
|
|
|
|
rp_validate_proxy_path "$proxy_path"
|
2019-09-14 19:58:58 +02:00
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
# Save extra settings
|
|
|
|
ynh_app_setting_set --app=$app --key=proxy_path --value=$proxy_path
|
|
|
|
ynh_app_setting_set --app=$app --key=assets_path --value=$assets_path
|
2016-06-20 23:43:51 +02:00
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
# Configure nginx
|
|
|
|
rp_make_webconfig
|
2018-05-26 10:27:01 +02:00
|
|
|
|
2016-06-20 23:43:51 +02:00
|
|
|
# Make app public if necessary
|
2023-01-08 14:33:31 +01:00
|
|
|
rp_make_permissions $is_public
|
2016-06-20 23:43:51 +02:00
|
|
|
|
2023-01-08 14:33:31 +01:00
|
|
|
# Reload nginx
|
|
|
|
rp_reload_web
|
2021-01-23 15:21:17 +01:00
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|