mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Improve change-url script
This commit is contained in:
parent
a050beb920
commit
eb1059bfe2
2 changed files with 18 additions and 9 deletions
|
@ -48,15 +48,13 @@ fi
|
|||
# Update nginx config
|
||||
if [ "$old_domain" != "$domain" ]
|
||||
then
|
||||
old_file_path="/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
||||
new_file_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
mv "$old_file_path" "$new_file_path"
|
||||
# Delete file checksum for the old conf file location
|
||||
ynh_delete_file_checksum "/etc/nginx/conf.d/$old_domain.d/$app.conf"
|
||||
|
||||
# Change the checksum setting name
|
||||
checksum_setting_old_name=checksum_${old_file_path//[\/ ]/_}
|
||||
checksum_setting_new_name=checksum_${new_file_path//[\/ ]/_}
|
||||
checksum_value=$(ynh_app_setting_get $app $checksum_setting_old_name)
|
||||
ynh_app_setting_set $app $checksum_setting_new_name $checksum_value
|
||||
mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
# Store file checksum for the new config file location
|
||||
ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
fi
|
||||
ynh_add_nginx_config 'seahub_port fileserver_port webdav_port'
|
||||
|
||||
|
|
|
@ -115,4 +115,15 @@ ynh_add_nginx_config () {
|
|||
ynh_store_file_checksum "$finalnginxconf"
|
||||
|
||||
sudo systemctl reload nginx
|
||||
}
|
||||
}
|
||||
|
||||
# Delete a file checksum from the app settings
|
||||
#
|
||||
# $app should be defined when calling this helper
|
||||
#
|
||||
# usage: ynh_remove_file_checksum file
|
||||
# | arg: file - The file for which the checksum will be deleted
|
||||
ynh_delete_file_checksum () {
|
||||
local checksum_setting_name=checksum_${1//[\/ ]/_} # Replace all '/' and ' ' by '_'
|
||||
ynh_app_setting_delete $app $checksum_setting_name
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue