diff --git a/scripts/fluidd.sh b/scripts/fluidd.sh index c59339c..bff2219 100644 --- a/scripts/fluidd.sh +++ b/scripts/fluidd.sh @@ -377,11 +377,11 @@ function patch_fluidd_update_manager(){ local moonraker_configs moonraker_configs=$(find "$(get_klipper_cfg_dir)" -type f -name "moonraker.conf") for conf in ${moonraker_configs}; do - status_msg "Adding Fluidd to update manager in file:\n ${conf}" - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - ### add Fluidds update manager section to moonraker.conf - if grep -Eq "[update_manager fluidd]" "${conf}"; then + if ! grep -Eq "[update_manager fluidd]" "${conf}"; then + ### add new line to conf if it doesn't end with one + [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" + ### add Fluidds update manager section to moonraker.conf + status_msg "Adding Fluidd to update manager in file:\n ${conf}" /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF [update_manager fluidd] diff --git a/scripts/klipperscreen.sh b/scripts/klipperscreen.sh index 50209bd..451efe9 100644 --- a/scripts/klipperscreen.sh +++ b/scripts/klipperscreen.sh @@ -189,11 +189,11 @@ function patch_klipperscreen_update_manager(){ local moonraker_configs moonraker_configs=$(find "$(get_klipper_cfg_dir)" -type f -name "moonraker.conf") for conf in ${moonraker_configs}; do - status_msg "Adding KlipperScreen to update manager in file:\n ${conf}" - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - ### add KlipperScreens update manager section to moonraker.conf - if grep -Eq "[update_manager KlipperScreen]" "${conf}"; then + if ! grep -Eq "[update_manager KlipperScreen]" "${conf}"; then + ### add new line to conf if it doesn't end with one + [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" + ### add KlipperScreens update manager section to moonraker.conf + status_msg "Adding KlipperScreen to update manager in file:\n ${conf}" /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF [update_manager KlipperScreen] diff --git a/scripts/mainsail.sh b/scripts/mainsail.sh index c441651..323311b 100644 --- a/scripts/mainsail.sh +++ b/scripts/mainsail.sh @@ -499,11 +499,11 @@ function patch_mainsail_update_manager(){ local moonraker_configs moonraker_configs=$(find "$(get_klipper_cfg_dir)" -type f -name "moonraker.conf") for conf in ${moonraker_configs}; do - status_msg "Adding Mainsail to update manager in file:\n ${conf}" - ### add new line to conf if it doesn't end with one - [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" - ### add Mainsails update manager section to moonraker.conf - if grep -Eq "[update_manager mainsail]" "${conf}"; then + if ! grep -Eq "[update_manager mainsail]" "${conf}"; then + ### add new line to conf if it doesn't end with one + [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}" + ### add Mainsails update manager section to moonraker.conf + status_msg "Adding Mainsail to update manager in file:\n ${conf}" /bin/sh -c "cat >> ${conf}" << MOONRAKER_CONF [update_manager mainsail]