diff --git a/scripts/moonraker-telegram-bot.sh b/scripts/moonraker-telegram-bot.sh index d10c5e1..9e79ad9 100644 --- a/scripts/moonraker-telegram-bot.sh +++ b/scripts/moonraker-telegram-bot.sh @@ -38,7 +38,7 @@ function telegram_bot_setup_dialog() { local moonraker_count user_input=() moonraker_names=() moonraker_count=$(echo "${moonraker_services}" | wc -w ) for service in ${moonraker_services}; do - moonraker_names+=( "$(get_instance_name "${service}")" ) + moonraker_names+=( "$(get_instance_name "${service}" moonraker)" ) done local telegram_bot_count diff --git a/scripts/moonraker.sh b/scripts/moonraker.sh index 294054c..609fe13 100644 --- a/scripts/moonraker.sh +++ b/scripts/moonraker.sh @@ -17,7 +17,7 @@ set -e function moonraker_systemd() { local services - services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/moonraker(-[0-9a-zA-Z]+)?.service" | sort) + services=$(find "${SYSTEMD}" -maxdepth 1 -regextype posix-extended -regex "${SYSTEMD}/moonraker(-[0-9a-zA-Z]+)?.service" | grep -v "moonraker-obico" | sort) echo "${services}" } @@ -55,7 +55,7 @@ function moonraker_setup_dialog() { local klipper_count user_input=() klipper_names=() klipper_count=$(echo "${klipper_services}" | wc -w ) for service in ${klipper_services}; do - klipper_names+=( "$(get_instance_name "${service}")" ) + klipper_names+=( "$(get_instance_name "${service}" moonraker)" ) done local moonraker_count @@ -572,4 +572,4 @@ function compare_moonraker_versions() { fi echo "${versions}" -} \ No newline at end of file +} diff --git a/scripts/obico.sh b/scripts/obico.sh index 0376ad2..0659284 100644 --- a/scripts/obico.sh +++ b/scripts/obico.sh @@ -51,7 +51,7 @@ function get_moonraker_names() { fi for service in ${moonraker_services}; do - get_instance_name "${service}" + get_instance_name "${service}" moonraker done } @@ -89,7 +89,7 @@ function moonraker_obico_setup_dialog() { moonraker_obico_services=$(moonraker_obico_systemd) existing_moonraker_obico_count=$(echo "${moonraker_obico_services}" | wc -w ) for service in ${moonraker_obico_services}; do - moonraker_obico_names+=( "$(get_instance_name "${service}")" ) + moonraker_obico_names+=( "$(get_instance_name "${service}" moonraker_obico)" ) done local allowed_moonraker_obico_count=$(( moonraker_count - existing_moonraker_obico_count )) @@ -205,7 +205,7 @@ function moonraker_obico_setup_dialog() { ### Step 7: Link to the Obico server if necessary local not_linked_instances=() for service in $(moonraker_obico_systemd); do - local instance_name="$(get_instance_name ${service})" + local instance_name="$(get_instance_name "${service}" moonraker_obico)" if ! is_moonraker_obico_linked "${instance_name}"; then not_linked_instances+=( "${instance_name}" ) fi @@ -367,7 +367,7 @@ function get_moonraker_obico_status() { else status="Installed!" for service in ${moonraker_obico_services}; do - if ! is_moonraker_obico_linked "$(get_instance_name ${service})"; then + if ! is_moonraker_obico_linked "$(get_instance_name "${service}" moonraker_obico)"; then status="Not linked!" fi done diff --git a/scripts/octoprint.sh b/scripts/octoprint.sh index 8bdd9f3..144b033 100644 --- a/scripts/octoprint.sh +++ b/scripts/octoprint.sh @@ -35,7 +35,7 @@ function octoprint_setup_dialog() { local klipper_count user_input=() klipper_names=() klipper_count=$(echo "${klipper_services}" | wc -w ) for service in ${klipper_services}; do - klipper_names+=( "$(get_instance_name "${service}")" ) + klipper_names+=( "$(get_instance_name "${service}" klipper)" ) done local octoprint_count diff --git a/scripts/utilities.sh b/scripts/utilities.sh index 94a4a13..ca22069 100644 --- a/scripts/utilities.sh +++ b/scripts/utilities.sh @@ -679,8 +679,8 @@ function set_hostname() { ### input: /etc/systemd/system/klipper-name.service ### returns: name function get_instance_name() { - local instance=${1} name - name=$(echo "${instance}" | rev | cut -d"/" -f1 | cut -d"-" -f1 | rev | cut -d"." -f1) + local instance=${1} base_name=${2} name + name=$(echo "${instance}" | rev | cut -d"/" -f1 | cut -d"." -f2 | rev | sed -E "s/${base_name}-//") echo "${name}" }