From 8d284179d8a21f7ef6720d5c9388a27e7fce58c5 Mon Sep 17 00:00:00 2001 From: Kenneth Jiang Date: Sat, 13 Aug 2022 20:53:37 -0700 Subject: [PATCH] Bugs primarily caused by the confusion between space-separated vars and arrays --- scripts/obico.sh | 15 +++++++++------ scripts/utilities.sh | 2 +- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/obico.sh b/scripts/obico.sh index 400b391..5183cbc 100644 --- a/scripts/obico.sh +++ b/scripts/obico.sh @@ -35,8 +35,11 @@ function moonraker_obico_needs_linking() { if [[ ! -f "${moonraker_obico_cfg}" ]]; then return 1 fi - grep -s -E "^[^#]" "${moonraker_obico_cfg}" | grep -vq 'auth_token' - return $? + if grep -s -E "^[^#]" "${moonraker_obico_cfg}" | grep -q 'auth_token'; then + return 1 + else + return 0 + fi } function obico_server_url_prompt() { @@ -91,8 +94,8 @@ function moonraker_obico_setup_dialog() { blank_line if (( existing_moonraker_obico_count > 0 )); then printf "|${green}%-55s${white}|\n" " ${existing_moonraker_obico_count} Moonraker-obico instances already installed!" - for svc in "${moonraker_obico_services}"; do - printf "|${cyan}%-57s${white}|\n" " ● moonraker-obco-$(get_instance_name "${service}" moonraker-obico)" + for svc in ${moonraker_obico_services}; do + printf "|${cyan}%-57s${white}|\n" " ● moonraker-obco-$(get_instance_name "${svc}" moonraker-obico)" done fi blank_line @@ -202,7 +205,7 @@ function moonraker_obico_setup_dialog() { else printf "|${green}%-55s${white}|\n" " ${#not_linked_instances[@]} Moonraker-obico instances not linked to the server!" for i in "${not_linked_instances[@]}"; do - printf "|${cyan}%-57s${white}|\n" " ● moonraker-obico-{moonraker_names[i]}" + printf "|${cyan}%-57s${white}|\n" " ● moonraker-obico-${moonraker_names[${i}]}" done fi blank_line @@ -251,7 +254,7 @@ function clone_moonraker_obico() { status_msg "Cloning Moonraker-obico from ${repo} ..." ### force remove existing Moonraker-obico dir - [[ -d ${repo} ]] && rm -rf "${MOONRAKER_OBICO_DIR}" + [[ -d "${MOONRAKER_OBICO_DIR}" ]] && rm -rf "${MOONRAKER_OBICO_DIR}" cd "${HOME}" || exit 1 if ! git clone "${repo}" "${MOONRAKER_OBICO_DIR}"; then diff --git a/scripts/utilities.sh b/scripts/utilities.sh index 3e46b3a..301cef0 100644 --- a/scripts/utilities.sh +++ b/scripts/utilities.sh @@ -771,7 +771,7 @@ function get_config_folders() { instance_names=$(get_multi_instance_names) if [[ -n ${instance_names} ]]; then - for name in "${instance_names}"; do + for name in ${instance_names}; do ### # by KIAUH convention, all instance names of only numbers # need to be prefixed with 'printer_'