mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-13 18:44:29 +05:00
add: support to install klipper as systemd service
This commit is contained in:
@@ -13,17 +13,24 @@ check_euid(){
|
||||
|
||||
locate_printer_cfg(){
|
||||
unset PRINTER_CFG
|
||||
status_msg "Locating printer.cfg via /etc/default/klipper ..."
|
||||
if [ -f $KLIPPER_SERVICE2 ]; then
|
||||
if [ -e $KLIPPER_SERVICE2 ]; then
|
||||
status_msg "Locating printer.cfg via $KLIPPER_SERVICE2 ..."
|
||||
#reads /etc/default/klipper and gets the default printer.cfg location
|
||||
KLIPPY_ARGS_LINE="$(grep "KLIPPY_ARGS=" /etc/default/klipper)"
|
||||
KLIPPY_ARGS_COUNT="$(grep -o " " <<< "$KLIPPY_ARGS_LINE" | wc -l)"
|
||||
i=1
|
||||
PRINTER_CFG=$(while [ "$i" != "$KLIPPY_ARGS_COUNT" ]; do grep -E "(\/[A-Za-z0-9\_-]+)+\/printer\.cfg" /etc/default/klipper | cut -d" " -f"$i"; i=$(( $i + 1 )); done | grep "printer.cfg")
|
||||
ok_msg "printer.cfg location: '$PRINTER_CFG'"
|
||||
elif [ -e $KLIPPER_SERVICE3 ]; then
|
||||
#reads /etc/systemd/system/klipper.service and gets the default printer.cfg location
|
||||
KLIPPY_ARGS_LINE="$(grep "ExecStart=" /etc/systemd/system/klipper.service)"
|
||||
KLIPPY_ARGS_COUNT="$(grep -o " " <<< "$KLIPPY_ARGS_LINE" | wc -l)"
|
||||
i=1
|
||||
PRINTER_CFG=$(while [ "$i" != "$KLIPPY_ARGS_COUNT" ]; do grep -E "(\/[A-Za-z0-9\_-]+)+\/printer\.cfg" /etc/systemd/system/klipper.service | cut -d" " -f"$i"; i=$(( $i + 1 )); done | grep "printer.cfg")
|
||||
ok_msg "printer.cfg location: '$PRINTER_CFG'"
|
||||
else
|
||||
PRINTER_CFG=""
|
||||
warn_msg "Can't read /etc/default/klipper - File not found!"
|
||||
warn_msg "Can't read printer.cfg location!"
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user