get_instance_name takes base_name now so that it won't confuse moonraker-obico as an instance of Moonraker
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user