From 1edc1f0169574635b76c002becb0f45a8f8335e9 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sun, 30 Oct 2022 18:10:25 +0100 Subject: [PATCH] fix(telegram-bot): allow for any amount of whitespaces after config section in update manager Signed-off-by: Dominik Willner --- scripts/moonraker-telegram-bot.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/moonraker-telegram-bot.sh b/scripts/moonraker-telegram-bot.sh index eeec94a..423e8a3 100644 --- a/scripts/moonraker-telegram-bot.sh +++ b/scripts/moonraker-telegram-bot.sh @@ -522,8 +522,9 @@ function patch_telegram_bot_update_manager() { regex="\/home\/${USER}\/([A-Za-z0-9_]+)\/config\/moonraker\.conf" moonraker_configs=$(find "${HOME}" -maxdepth 3 -type f -regextype posix-extended -regex "${regex}" | sort) + patched="false" for conf in ${moonraker_configs}; do - if ! grep -Eq "^\[update_manager moonraker-telegram-bot\]$" "${conf}"; then + if ! grep -Eq "^\[update_manager moonraker-telegram-bot\]\s*$" "${conf}"; then ### add new line to conf if it doesn't end with one [[ $(tail -c1 "${conf}" | wc -l) -eq 0 ]] && echo "" >> "${conf}"