mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Fix change url
This commit is contained in:
parent
30566e3743
commit
75142432de
1 changed files with 42 additions and 6 deletions
|
@ -11,12 +11,8 @@ source ./_common.sh
|
||||||
# Source YunoHost helpers
|
# Source YunoHost helpers
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
path=$new_path
|
||||||
# STANDARD MODIFICATIONS
|
domain=$new_domain
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
|
||||||
ynh_change_url_nginx_config
|
|
||||||
|
|
||||||
# Create special path with / at the end
|
# Create special path with / at the end
|
||||||
if [[ $path == '/' ]]
|
if [[ $path == '/' ]]
|
||||||
|
@ -26,6 +22,42 @@ else
|
||||||
path2=$path"/"
|
path2=$path"/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Patch helper
|
||||||
|
|
||||||
|
ynh_change_url_nginx_config() {
|
||||||
|
local old_nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
local new_nginx_conf_path=/etc/nginx/conf.d/$new_domain.d/$app.conf
|
||||||
|
|
||||||
|
# Change the domain for NGINX
|
||||||
|
if [ $change_domain -eq 1 ]
|
||||||
|
then
|
||||||
|
ynh_delete_file_checksum --file="$old_nginx_conf_path"
|
||||||
|
mv "$old_nginx_conf_path" "$new_nginx_conf_path"
|
||||||
|
ynh_store_file_checksum --file="$new_nginx_conf_path"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Change the path in the NGINX config file
|
||||||
|
if [ $change_path -eq 1 ]
|
||||||
|
then
|
||||||
|
# Make a backup of the original NGINX config file if modified
|
||||||
|
ynh_backup_if_checksum_is_different --file="$new_nginx_conf_path"
|
||||||
|
# Set global variables for NGINX helper
|
||||||
|
path="$new_path"
|
||||||
|
path_url="$new_path"
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
fi
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=nginx --action=reload
|
||||||
|
}
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# STANDARD MODIFICATIONS
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
||||||
|
ynh_change_url_nginx_config
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC MODIFICATIONS
|
# SPECIFIC MODIFICATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -49,6 +81,10 @@ ynh_add_config --template=ccnet.conf --destination=$install_dir/conf/ccnet.conf
|
||||||
ynh_add_config --template=gunicorn.conf.py --destination=$install_dir/conf/gunicorn.conf.py
|
ynh_add_config --template=gunicorn.conf.py --destination=$install_dir/conf/gunicorn.conf.py
|
||||||
ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.conf
|
ynh_add_config --template=seafdav.conf --destination=$install_dir/conf/seafdav.conf
|
||||||
|
|
||||||
|
# Update permissions
|
||||||
|
ynh_permission_url --permission=file_server --url=$domain/seafhttp
|
||||||
|
ynh_permission_url --permission=webdav --url=$domain/seafdav
|
||||||
|
|
||||||
# Clean url in config in DB
|
# Clean url in config in DB
|
||||||
clean_url_in_db_config
|
clean_url_in_db_config
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue