Don't modify template services

This commit is contained in:
Elizabeth Cray 2024-08-05 20:56:06 -04:00
parent 394d8fae00
commit b551aee9ee

View File

@ -93,24 +93,15 @@ cat klipper/printer.cfg >> printer.cfg.tmp
mv printer.cfg.tmp printer_data/config/printer.cfg mv printer.cfg.tmp printer_data/config/printer.cfg
# Apply Edits to Configs # Apply Edits to Configs
echo.cyan "Setup Moonraker" echo.Cyan "Setup Moonraker"
cd $ROOT_DIR/$PRINTER_NAME/printer_data/config cd $ROOT_DIR/$PRINTER_NAME/printer_data/config
sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "moonraker.conf" sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "moonraker.conf"
sed -i -e "s/pi/$USER/g" "moonraker.conf" sed -i -e "s/pi/$USER/g" "moonraker.conf"
echo.Cyan "Setup Mainsail Config" echo.Cyan "Setup Mainsail Config"
cd $ROOT_DIR/$PRINTER_NAME/mainsail-config cd $ROOT_DIR/$PRINTER_NAME/mainsail-config
sed -i -e "s/$HOME\/printer_data/$HOME\/$PRINTER_NAME\/printer_data/g" "client.cfg" sed -i -e "s/~\/printer_data/$HOME\/$PRINTER_NAME\/printer_data/g" "client.cfg"
sed -i -e "s/pi/$USER/g" "client.cfg" sed -i -e "s/pi/$USER/g" "client.cfg"
cd $ROOT_DIR/config/services
# TODO: Add Crowsnest Support
FILES=(moonraker klipper)
for f in ${FILES[@]}; do
echo.ICyan "Configuring ${f}"
sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "${f}.service"
sed -i -e "s/pi/$USER/g" "${f}.service"
done
# Download Mainsail # Download Mainsail
cd $ROOT_DIR cd $ROOT_DIR
echo.Cyan "Downloading Mainsail" echo.Cyan "Downloading Mainsail"
@ -123,13 +114,23 @@ echo.Cyan "Run Copy"
mkdir -p $HOME/$PRINTER_NAME mkdir -p $HOME/$PRINTER_NAME
cp -r $PRINTER_NAME/* $HOME/$PRINTER_NAME cp -r $PRINTER_NAME/* $HOME/$PRINTER_NAME
# Create Empty $PRINTER_NAME # Create Empty dirs
$PRINTER_NAME=(logs gcodes certs backup mainsail-config) dirs=(logs gcodes certs backup mainsail-config)
for d in ${$PRINTER_NAME[@]}; do for d in ${dirs[@]}; do
mkdir -p "$HOME/$PRINTER_NAME/$d" mkdir -p "$HOME/$PRINTER_NAME/$d"
done done
# Configure System Services # Configure System Services
# cd $ROOT_DIR/config/services
# TODO: Add Crowsnest Support
# FILES=(moonraker klipper)
# for f in ${FILES[@]}; do
# echo.ICyan "Configuring ${f}"
# sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "${f}.service"
# sed -i -e "s/pi/$USER/g" "${f}.service"
# done
cd $ROOT_DIR/config/services cd $ROOT_DIR/config/services
SERVICES=() SERVICES=()
for f in *.service; do for f in *.service; do
@ -137,6 +138,7 @@ for f in *.service; do
SERVICES+=($f) SERVICES+=($f)
cp "${f}" "${ROOT_DIR}/${PRINTER_NAME}/${PRINTER_NAME}-${f}" cp "${f}" "${ROOT_DIR}/${PRINTER_NAME}/${PRINTER_NAME}-${f}"
sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "${ROOT_DIR}/${PRINTER_NAME}/${PRINTER_NAME}-${f}" sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "${ROOT_DIR}/${PRINTER_NAME}/${PRINTER_NAME}-${f}"
sed -i -e "s/pi/$USER/g" "${ROOT_DIR}/${PRINTER_NAME}/${PRINTER_NAME}-${f}"
done done
# Install System Services # Install System Services