From ed9b8d844b1ed1c244e1e389fed6964856b2aa77 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Wed, 18 Nov 2020 17:48:19 +0100 Subject: [PATCH] fix: must restart moonraker after changes to moonraker.conf --- scripts/install_klipper_webui.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/scripts/install_klipper_webui.sh b/scripts/install_klipper_webui.sh index b9b5275..8a3b7dd 100755 --- a/scripts/install_klipper_webui.sh +++ b/scripts/install_klipper_webui.sh @@ -255,6 +255,7 @@ patch_moonraker(){ #find trusted_clients line number and subtract one, to insert cors_domains later line="$(grep -n "trusted_clients:" $mr_conf | cut -d":" -f1)i" sed -i "$line cors_domains:" $mr_conf + mr_restart="true" fi if [ "$(grep "^cors_domains:$" $mr_conf)" ]; then hostname=$(hostname -I | cut -d" " -f1) @@ -264,9 +265,10 @@ patch_moonraker(){ url4="\ \ \ \ http://$hostname:*" #find cors_domains line number and add one, to insert urls later line="$(expr $(grep -n "cors_domains:" $mr_conf | cut -d":" -f1) + 1)i" - [ ! "$(grep -E '^\s+http:\/\/\*\.local$' $mr_conf)" ] && sed -i "$line $url1" $mr_conf - [ ! "$(grep -E '^\s+http:\/\/app\.fluidd\.xyz$' $mr_conf)" ] && sed -i "$line $url2" $mr_conf - [ ! "$(grep -E '^\s+https:\/\/app\.fluidd\.xyz$' $mr_conf)" ] && sed -i "$line $url3" $mr_conf - [ ! "$(grep -E '^\s+http:\/\/([0-9]{1,3}\.){3}[0-9]{1,3}' $mr_conf)" ] && sed -i "$line $url4" $mr_conf + [ ! "$(grep -E '^\s+http:\/\/\*\.local$' $mr_conf)" ] && sed -i "$line $url1" $mr_conf && mr_restart="true" + [ ! "$(grep -E '^\s+http:\/\/app\.fluidd\.xyz$' $mr_conf)" ] && sed -i "$line $url2" $mr_conf && mr_restart="true" + [ ! "$(grep -E '^\s+https:\/\/app\.fluidd\.xyz$' $mr_conf)" ] && sed -i "$line $url3" $mr_conf && mr_restart="true" + [ ! "$(grep -E '^\s+http:\/\/([0-9]{1,3}\.){3}[0-9]{1,3}' $mr_conf)" ] && sed -i "$line $url4" $mr_conf && mr_restart="true" fi + [ "$mr_restart" == "true" ] && restart_moonraker } \ No newline at end of file