Skip to content

Commit

Permalink
better handle moonraker not being started
Browse files Browse the repository at this point in the history
  • Loading branch information
pellcorp committed Apr 20, 2024
1 parent e755e58 commit 60e26a0
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ if [ ! -f /lib/ld-2.29.so ]; then
fi

echo "Checking for a working Moonraker"
MRK_KPY_OK=`curl localhost:7125/server/info | jq .result.klippy_connected`
MRK_KPY_OK=`curl localhost:7125/server/info 2> /dev/null | jq .result.klippy_connected`
if [ "$MRK_KPY_OK" != "true" ]; then
printf "${yellow}Moonraker is not properly setup at port 7125. Continue anyways? (y/n) ${white}\n"
read confirm
echo

if [ "$confirm" = "y" -o "$confirm" = "Y" ]; then
echo "Continuing to install GuppyScreen"
echo "Continuing to install GuppyScreen"
else
echo "Please fix Moonraker and restart this script."
exit 1
echo "Please fix Moonraker and restart this script."
exit 1
fi
fi

KLIPPER_PATH=`curl localhost:7125/printer/info | jq -r .result.klipper_path`
if [ x"$KLIPPER_PATH" == x"null" ]; then
KLIPPER_PATH=`curl localhost:7125/printer/info 2> /dev/null | jq -r .result.klipper_path`
if [ -z "$KLIPPER_PATH" -o x"$KLIPPER_PATH" == x"null" ]; then
KLIPPER_PATH=/usr/share/klipper
printf "${green} Falling back to klipper path: $KLIPPER_PATH ${white}\n"
fi
Expand All @@ -66,16 +66,15 @@ KLIPPY_EXTRA_DIR=$KLIPPER_PATH/klippy/extras
GCODE_SHELL_CMD=$KLIPPY_EXTRA_DIR/gcode_shell_command.py
SHAPER_CONFIG=$KLIPPY_EXTRA_DIR/calibrate_shaper_config.py


K1_CONFIG_FILE=`curl localhost:7125/printer/info | jq -r .result.config_file`
if [ x"$K1_CONFIG_FILE" == x"null" ]; then
K1_CONFIG_FILE=`curl localhost:7125/printer/info 2> /dev/null | jq -r .result.config_file`
if [ -z "$K1_CONFIG_FILE" -o x"$K1_CONFIG_FILE" == x"null" ]; then
K1_CONFIG_DIR=/usr/data/printer_data/config
printf "${green} Falling back to config dir: $K1_CONFIG_DIR ${white}\n"
else
K1_CONFIG_DIR=$(dirname "$K1_CONFIG_FILE")
printf "${green} Found config dir: $K1_CONFIG_DIR ${white}\n"
fi

K1_CONFIG_DIR=$(dirname "$K1_CONFIG_FILE")
printf "${green} Found config dir: $K1_CONFIG_DIR ${white}\n"

# kill pip cache to free up overlayfs
rm -rf /root/.cache

Expand Down

0 comments on commit 60e26a0

Please sign in to comment.