diff --git a/setup.sh b/setup.sh index db3f6da..52baab4 100755 --- a/setup.sh +++ b/setup.sh @@ -11,6 +11,7 @@ ARG_SKIP_APT=0 ARG_NAME=0 ARG_CONFIG=0 ARG_PORT=0 +ARG_FIRM=0 while [[ "$#" -gt 0 ]]; do case $1 in -h|--help) ARG_HELP=1 ;; @@ -18,6 +19,7 @@ while [[ "$#" -gt 0 ]]; do -n|--name) ARG_NAME="$2" ; shift ;; -c|--config) ARG_CONFIG="$2" ; shift ;; -p|--port) ARG_PORT="$2" ; shift ;; + -f|--skip-firmware) ARG_FIRM=1 ;; *) echo "Unknown Parameter"; exit 3 ;; esac shift @@ -41,12 +43,13 @@ cd $ROOT_DIR source ./ColorEchoForShell/dist/ColorEcho.bash if [[ "$ARG_HELP" == 1 ]]; then - echo.Cyan "HacDC Printewr Setup Script Usage" + echo.Cyan "HacDC Printer Setup Script Usage" echo.Yellow "./setup.sh [options]" echo "" echo.BoldPurple "Option Description" echo.Rainbow "-h/--help Display this help msg" echo.Rainbow "-a/--skip-apt Skip installing apt packages" + echo.Rainbow "-f/--skip-firmware Skip firmware build/install" echo.Rainbow "-n/--name Specify printer name (skips popup)" echo.Rainbow "-c/--config Specify printer config (skips popup)" echo.Rainbow "-p/--port Specify printer port (skips popup)" @@ -102,7 +105,10 @@ cp -r $ROOT_DIR/dirs $ROOT_DIR/$PRINTER_NAME # Select Klipper Config cd $ROOT_DIR/$PRINTER_NAME/klipper -make menuconfig +if [[ "$ARG_FIRM" == 0]]; then + make menuconfig +fi + CONFIG_FILE="" if [[ "$ARG_CONFIG" == 0 ]]; then CONFIG_FILES=(`ls config`) @@ -159,17 +165,20 @@ else fi # Build Klipper -echo.Cyan "Compile Klipper Firmware" -cp $CONFIG_FILE $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg -sed -i -e "s/^serial: .\+$/LINEHERE/g" "$ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg" -cat $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg | replace "LINEHERE" "serial: $DEVICE" > $ROOT_DIR/$PRINTER_NAME/klipper/tmp.cfg -rm $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg -mv $ROOT_DIR/$PRINTER_NAME/klipper/tmp.cfg $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg -make -j$(nproc) - -# Flash Firmware -echo.Cyan "Flash Device" -make flash FLASH_DEVICE=$DEVICE +if [[ "$ARG_FIRM" == 0 ]]; then + echo.Cyan "Compile Klipper Firmware" + cp $CONFIG_FILE $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg + sed -i -e "s/^serial: .\+$/LINEHERE/g" "$ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg" + cat $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg | replace "LINEHERE" "serial: $DEVICE" > $ROOT_DIR/$PRINTER_NAME/klipper/tmp.cfg + rm $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg + mv $ROOT_DIR/$PRINTER_NAME/klipper/tmp.cfg $ROOT_DIR/$PRINTER_NAME/klipper/printer.cfg + make -j$(nproc) + # Flash Firmware + echo.Cyan "Flash Device" + make flash FLASH_DEVICE=$DEVICE +else + echo.ICyan "Skipping firmware build" +fi # Copy over printer config file echo.Cyan "Setup printer.cfg"