mirror of
https://github.com/dw-0/kiauh.git
synced 2025-12-14 11:04:29 +05:00
fix: create cfg directories if they are missing for whatever reason.
This commit is contained in:
@@ -114,6 +114,8 @@ MULTI_STARTSCRIPT
|
|||||||
|
|
||||||
create_minimal_printer_cfg(){
|
create_minimal_printer_cfg(){
|
||||||
/bin/sh -c "cat > $1" << MINIMAL_CFG
|
/bin/sh -c "cat > $1" << MINIMAL_CFG
|
||||||
|
[include kiauh_macros.cfg]
|
||||||
|
|
||||||
[mcu]
|
[mcu]
|
||||||
serial: /dev/serial/by-id/
|
serial: /dev/serial/by-id/
|
||||||
pin_map: arduino
|
pin_map: arduino
|
||||||
@@ -174,7 +176,13 @@ create_single_klipper_instance(){
|
|||||||
status_msg "Creating single Klipper instance ..."
|
status_msg "Creating single Klipper instance ..."
|
||||||
status_msg "Installing system start script ..."
|
status_msg "Installing system start script ..."
|
||||||
create_single_klipper_startscript
|
create_single_klipper_startscript
|
||||||
|
|
||||||
|
### create printer config directory if missing
|
||||||
|
[ ! -d $PRINTER_CFG_LOC ] && mkdir -p $PRINTER_CFG_LOC
|
||||||
|
|
||||||
|
### create basic configs if missing
|
||||||
[ ! -f $PRINTER_CFG ] && create_minimal_printer_cfg "$PRINTER_CFG"
|
[ ! -f $PRINTER_CFG ] && create_minimal_printer_cfg "$PRINTER_CFG"
|
||||||
|
[ ! -f $PRINTER_CFG_LOC/kiauh_macros.cfg ] && cp ${SRCDIR}/kiauh/resources/kiauh_macros.cfg $PRINTER_CFG_LOC/kiauh_macros.cfg
|
||||||
|
|
||||||
### enable instance
|
### enable instance
|
||||||
sudo systemctl enable klipper.service
|
sudo systemctl enable klipper.service
|
||||||
@@ -198,14 +206,17 @@ create_multi_klipper_instance(){
|
|||||||
TMP_PRINTER=/tmp/printer-$INSTANCE
|
TMP_PRINTER=/tmp/printer-$INSTANCE
|
||||||
PRINTER_CFG="$PRINTER_CFG_LOC/printer_$INSTANCE/printer.cfg"
|
PRINTER_CFG="$PRINTER_CFG_LOC/printer_$INSTANCE/printer.cfg"
|
||||||
|
|
||||||
### create printer config folder and write a minimal printer.cfg to it
|
|
||||||
[ ! -d $PRINTER_CFG_LOC/printer_$INSTANCE ] && mkdir -p $PRINTER_CFG_LOC/printer_$INSTANCE
|
|
||||||
[ ! -f $PRINTER_CFG ] && create_minimal_printer_cfg "$PRINTER_CFG"
|
|
||||||
|
|
||||||
### create instance
|
### create instance
|
||||||
status_msg "Creating instance #$INSTANCE ..."
|
status_msg "Creating instance #$INSTANCE ..."
|
||||||
create_multi_klipper_startscript
|
create_multi_klipper_startscript
|
||||||
|
|
||||||
|
### create printer config directory if missing
|
||||||
|
[ ! -d $PRINTER_CFG_LOC/printer_$INSTANCE ] && mkdir -p $PRINTER_CFG_LOC/printer_$INSTANCE
|
||||||
|
|
||||||
|
### create basic configs if missing
|
||||||
|
[ ! -f $PRINTER_CFG ] && create_minimal_printer_cfg "$PRINTER_CFG"
|
||||||
|
[ ! -f $PRINTER_CFG_LOC/printer_$INSTANCE/kiauh_macros.cfg ] && cp ${SRCDIR}/kiauh/resources/kiauh_macros.cfg $PRINTER_CFG_LOC/printer_$INSTANCE/kiauh_macros.cfg
|
||||||
|
|
||||||
### enable instance
|
### enable instance
|
||||||
sudo systemctl enable klipper-$INSTANCE.service
|
sudo systemctl enable klipper-$INSTANCE.service
|
||||||
ok_msg "Klipper instance $INSTANCE created!"
|
ok_msg "Klipper instance $INSTANCE created!"
|
||||||
|
|||||||
Reference in New Issue
Block a user