refactor: fix update_manager patch functions

Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
th33xitus
2022-05-26 10:07:31 +02:00
parent 4bc35f55dd
commit 3f0f560646
3 changed files with 6 additions and 6 deletions

View File

@@ -399,10 +399,10 @@ function select_fluidd_port() {
function patch_fluidd_update_manager() {
local moonraker_configs
moonraker_configs=$(find "$(get_klipper_cfg_dir)" -type f -name "moonraker.conf" | sort)
moonraker_configs=$(find "${KLIPPER_CONFIG}" -type f -name "moonraker.conf" | sort)
for conf in ${moonraker_configs}; do
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}"

View File

@@ -201,10 +201,10 @@ function compare_klipperscreen_versions() {
function patch_klipperscreen_update_manager() {
local moonraker_configs
moonraker_configs=$(find "$(get_klipper_cfg_dir)" -type f -name "moonraker.conf" | sort)
moonraker_configs=$(find "${KLIPPER_CONFIG}" -type f -name "moonraker.conf" | sort)
for conf in ${moonraker_configs}; do
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}"

View File

@@ -527,10 +527,10 @@ function enable_mainsail_remotemode() {
function patch_mainsail_update_manager() {
local moonraker_configs
moonraker_configs=$(find "$(get_klipper_cfg_dir)" -type f -name "moonraker.conf" | sort)
moonraker_configs=$(find "${KLIPPER_CONFIG}" -type f -name "moonraker.conf" | sort)
for conf in ${moonraker_configs}; do
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}"