fix: bug in order of operations

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-04-21 23:12:12 +02:00
parent 60d36e8182
commit 6688029ba3
3 changed files with 15 additions and 15 deletions

View File

@@ -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]

View File

@@ -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]

View File

@@ -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]