Debug Output

This commit is contained in:
Elizabeth Cray 2024-08-05 20:47:48 -04:00
parent 9e74bf51cd
commit 394d8fae00
2 changed files with 14 additions and 1 deletions

4
.gitmodules vendored
View File

@ -9,3 +9,7 @@
[submodule "dirs/mainsail-config"] [submodule "dirs/mainsail-config"]
path = dirs/mainsail-config path = dirs/mainsail-config
url = https://github.com/mainsail-crew/mainsail-config url = https://github.com/mainsail-crew/mainsail-config
[submodule "ColorEchoForShell"]
path = ColorEchoForShell
url = https://github.com/PeterDaveHello/ColorEchoForShell

View File

@ -16,6 +16,8 @@ RDIR=$( dirname "$SOURCE" )
ROOT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd ) ROOT_DIR=$( cd -P "$( dirname "$SOURCE" )" >/dev/null 2>&1 && pwd )
cd $ROOT_DIR cd $ROOT_DIR
source ./ColorEchoForShell/dist/ColorEcho.bash
# Pull Klipper # Pull Klipper
git submodule update --init --recursive git submodule update --init --recursive
@ -84,16 +86,18 @@ make -j$(nproc)
make flash FLASH_DEVICE=/dev/serial/by-id/$DEVICE make flash FLASH_DEVICE=/dev/serial/by-id/$DEVICE
# Copy over printer config file # Copy over printer config file
echo.Cyan "Setup printer.cfg"
cd $ROOT_DIR/$PRINTER_NAME cd $ROOT_DIR/$PRINTER_NAME
cat $ROOT_DIR/config/macros.gcode >> printer.cfg.tmp cat $ROOT_DIR/config/macros.gcode >> printer.cfg.tmp
cat klipper/printer.cfg >> printer.cfg.tmp 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"
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"
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/$HOME\/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"
@ -102,17 +106,20 @@ cd $ROOT_DIR/config/services
# TODO: Add Crowsnest Support # TODO: Add Crowsnest Support
FILES=(moonraker klipper) FILES=(moonraker klipper)
for f in ${FILES[@]}; do for f in ${FILES[@]}; do
echo.ICyan "Configuring ${f}"
sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "${f}.service" sed -i -e "s/PRINTERNAME/$PRINTER_NAME/g" "${f}.service"
sed -i -e "s/pi/$USER/g" "${f}.service" sed -i -e "s/pi/$USER/g" "${f}.service"
done done
# Download Mainsail # Download Mainsail
cd $ROOT_DIR cd $ROOT_DIR
echo.Cyan "Downloading Mainsail"
wget -q -O mainsail.zip https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip wget -q -O mainsail.zip https://github.com/mainsail-crew/mainsail/releases/latest/download/mainsail.zip
unzip -o mainsail.zip -d $PRINTER_NAME/mainsail unzip -o mainsail.zip -d $PRINTER_NAME/mainsail
rm mainsail.zip rm mainsail.zip
# Copy To Final Location # Copy To Final Location
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
@ -126,12 +133,14 @@ done
cd $ROOT_DIR/config/services cd $ROOT_DIR/config/services
SERVICES=() SERVICES=()
for f in *.service; do for f in *.service; do
echo.Cyan "Setup ${f}"
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}"
done done
# Install System Services # Install System Services
echo.Cyan "Install Services"
sudo cp $ROOT_DIR/$PRINTER_NAME/*.service /etc/systemd/system/ sudo cp $ROOT_DIR/$PRINTER_NAME/*.service /etc/systemd/system/
sudo systemctl daemon-reload sudo systemctl daemon-reload
for svc in ${SERVICES[@]}; do for svc in ${SERVICES[@]}; do