refactor: fix update_manager patch functions
Signed-off-by: Dominik Willner th33xitus@gmail.com
This commit is contained in:
@@ -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}"
|
||||
|
||||
|
||||
@@ -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}"
|
||||
|
||||
|
||||
@@ -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}"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user