1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/mygpo_ynh.git synced 2024-09-03 19:55:52 +02:00

Update nginx conf file checksum

This commit is contained in:
Jimmy Monin 2017-09-03 16:39:05 +02:00
parent 54c393cd99
commit 22bc3cc21f

View file

@ -57,17 +57,20 @@ nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the nginx config file # Change the path in the nginx config file
if [ $change_path -eq 1 ] if [ $change_path -eq 1 ]
then then
ynh_backup_if_checksum_is_different "$nginx_conf_path"
# Replace locations starting with old_path # Replace locations starting with old_path
# Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location) # Look for every location possible patterns (see https://nginx.org/en/docs/http/ngx_http_core_module.html#location)
sudo sed --in-place "s@location\( \(=\|~\|~\*\|\^~\)\)\? $old_path@location\1 $new_path@" "$nginx_conf_path" sudo sed --in-place "s@location\( \(=\|~\|~\*\|\^~\)\)\? $old_path@location\1 $new_path@" "$nginx_conf_path"
# Replace path in "return" directives # Replace path in "return" directives
sudo sed --in-place "s@return \([[:digit:]]\{3\}\) $old_path@return \1 $new_path@" "$nginx_conf_path" sudo sed --in-place "s@return \([[:digit:]]\{3\}\) $old_path@return \1 $new_path@" "$nginx_conf_path"
ynh_store_file_checksum "$nginx_conf_path"
fi fi
# Change the domain for nginx # Change the domain for nginx
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
ynh_store_file_checksum "$nginx_conf_path"
fi fi
#================================================= #=================================================