1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monitorix_ynh.git synced 2024-09-03 19:46:06 +02:00

Update change_url

This commit is contained in:
Josué Tille 2018-05-19 20:44:15 +02:00
parent 0dd44b1c15
commit 0c4b51713f
2 changed files with 17 additions and 8 deletions

View file

@ -31,15 +31,13 @@ dbpass=$(ynh_app_setting_get "$app" mysqlpwd)
# Update nginx config # Update nginx config
if [ "$old_domain" != "$domain" ] if [ "$old_domain" != "$domain" ]
then then
old_file_path="/etc/nginx/conf.d/$old_domain.d/$app.conf" # Delete file checksum for the old conf file location
new_file_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_delete_file_checksum "/etc/nginx/conf.d/$old_domain.d/$app.conf"
mv "$old_file_path" "$new_file_path"
# Change the checksum setting name mv "/etc/nginx/conf.d/$old_domain.d/$app.conf" "/etc/nginx/conf.d/$domain.d/$app.conf"
checksum_setting_old_name=checksum_${old_file_path//[\/ ]/_}
checksum_setting_new_name=checksum_${new_file_path//[\/ ]/_} # Store file checksum for the new config file location
checksum_value=$(ynh_app_setting_get $app $checksum_setting_old_name) ynh_store_file_checksum "/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_app_setting_set $app $checksum_setting_new_name $checksum_value
fi fi
config_nginx config_nginx

View file

@ -93,3 +93,14 @@ ynh_check_starting () {
echo "" echo ""
ynh_clean_check_starting ynh_clean_check_starting
} }
# 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
}