install: fix dbus provider detection

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-10-08 12:10:54 -04:00
parent fd11c08b99
commit b8ce199edd
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 8 additions and 6 deletions

View File

@ -14,7 +14,6 @@ DATA_PATH="${MOONRAKER_DATA_PATH}"
INSTANCE_ALIAS="${MOONRAKER_ALIAS:-moonraker}"
SPEEDUPS="${MOONRAKER_SPEEDUPS:-n}"
SERVICE_VERSION="1"
MACHINE_PROVIDER="systemd_cli"
package_decode_script=$( cat << EOF
import sys
@ -111,6 +110,12 @@ init_data_path()
[ -n "${CONFIG_PATH}" ] && config_file=${CONFIG_PATH}
# Write initial configuration for first time installs
if [ ! -f $SERVICE_FILE ] && [ ! -e "${config_file}" ]; then
# detect machine provider
if [ "$( systemctl is-active dbus )" = "active" ]; then
provider="systemd_dbus"
else
provider="systemd_cli"
fi
report_status "Writing Config File ${config_file}:\n"
/bin/sh -c "cat > ${config_file}" << EOF
# Moonraker Configuration File
@ -123,7 +128,7 @@ port: 7125
klippy_uds_address: /tmp/klippy_uds
[machine]
provider: ${MACHINE_PROVIDER}
provider: ${provider}
EOF
cat ${config_file}
@ -177,7 +182,7 @@ EOF
# Step 7: Validate/Install polkit rules
check_polkit_rules()
{
if [ ! -x "$(command -v pkaction)" ]; then
if [ ! -x "$(command -v pkaction || true)" ]; then
return
fi
POLKIT_VERSION="$( pkaction --version | grep -Po "(\d+\.?\d*)" )"
@ -204,10 +209,7 @@ check_polkit_rules()
else
report_status "Installing PolKit Rules"
${SRCDIR}/scripts/set-policykit-rules.sh -z
MACHINE_PROVIDER="systemd_dbus"
fi
else
MACHINE_PROVIDER="systemd_dbus"
fi
}