Compare commits
No commits in common. "6d046cd394d7175a3195eb275ef582e19f61192f" and "df8fdc37cc783cc1233dfbb0cdac5a7b942a7242" have entirely different histories.
6d046cd394
...
df8fdc37cc
28
setup.sh
28
setup.sh
@ -1,8 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# TODO: Add Crowsnest Support
|
# TODO: Add Crowsnest Support
|
||||||
|
# TODO: Avoid duplicate printer names
|
||||||
# TODO: Dry run
|
# TODO: Dry run
|
||||||
# TODO: Printer Directory Page in NGINX
|
# TODO: Printer Directory Page in NGINX
|
||||||
|
# TODO: Fix PolicyKit issues "klippy_uds_address"
|
||||||
|
|
||||||
# Handle arguments
|
# Handle arguments
|
||||||
ARG_HELP=0
|
ARG_HELP=0
|
||||||
@ -51,14 +53,6 @@ if [[ "$ARG_HELP" == 1 ]]; then
|
|||||||
echo.Rainbow "-p/--port Specify printer port (skips popup)"
|
echo.Rainbow "-p/--port Specify printer port (skips popup)"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$ARG_NAME" != 0 ]]; then
|
|
||||||
if [ -d $HOME/$ARG_NAME ]; then
|
|
||||||
echo.Red "UNABLE TO COMPLY: Printer name already exists"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Pull Klipper
|
# Pull Klipper
|
||||||
git submodule update --init --recursive
|
git submodule update --init --recursive
|
||||||
|
|
||||||
@ -76,21 +70,11 @@ fi
|
|||||||
PRINTER_NAME=""
|
PRINTER_NAME=""
|
||||||
if [[ "$ARG_NAME" == 0 ]]; then
|
if [[ "$ARG_NAME" == 0 ]]; then
|
||||||
NAME_NOT_VALID=true
|
NAME_NOT_VALID=true
|
||||||
DISPLAY_MSG="Name This Printer"
|
|
||||||
while $NAME_NOT_VALID ; do
|
while $NAME_NOT_VALID ; do
|
||||||
PRINTER_NAME=$(dialog --backtitle 'drwho@hackers.town' --inputbox "$DISPLAY_MSG" 8 40 "${PRINTER_NAME}" 3>&1 1>&2 2>&3)
|
PRINTER_NAME=$(dialog --backtitle 'drwho@hackers.town' --inputbox 'Name This Printer' 8 40 "${PRINTER_NAME}" 3>&1 1>&2 2>&3)
|
||||||
if [[ $PRINTER_NAME =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
if [[ $PRINTER_NAME =~ ^[a-zA-Z0-9_-]+$ ]]; then
|
||||||
NAME_NOT_VALID=false
|
NAME_NOT_VALID=false
|
||||||
fi
|
fi
|
||||||
if [ -d $HOME/$PRINTER_NAME ]; then
|
|
||||||
DISPLAY_MSG="Printer name already exists"
|
|
||||||
NAME_NOT_VALID=true
|
|
||||||
fi
|
|
||||||
if [[ "$PRINTER_NAME" == "" ]]; then
|
|
||||||
echo ""
|
|
||||||
echo.Yellow "Cancelled or no input, closing script"
|
|
||||||
exit 4
|
|
||||||
fi
|
|
||||||
done
|
done
|
||||||
else
|
else
|
||||||
echo.ICyan "Using passed printer name: $ARG_NAME"
|
echo.ICyan "Using passed printer name: $ARG_NAME"
|
||||||
@ -256,7 +240,6 @@ echo.Cyan "Setup Klipper Python Virtual Environment"
|
|||||||
cd $ROOT_DIR/$PRINTER_NAME
|
cd $ROOT_DIR/$PRINTER_NAME
|
||||||
/usr/bin/virtualenv klippy-env
|
/usr/bin/virtualenv klippy-env
|
||||||
$ROOT_DIR/$PRINTER_NAME/klippy-env/bin/pip install -r $ROOT_DIR/$PRINTER_NAME/klipper/scripts/klippy-requirements.txt
|
$ROOT_DIR/$PRINTER_NAME/klippy-env/bin/pip install -r $ROOT_DIR/$PRINTER_NAME/klipper/scripts/klippy-requirements.txt
|
||||||
touch $ROOT_DIR/$PRINTER_NAME/printer_data/comms/klippy.sock
|
|
||||||
|
|
||||||
# Setup moonraker python env
|
# Setup moonraker python env
|
||||||
echo.Cyan "Setup Moonraker Python Virtual Environment"
|
echo.Cyan "Setup Moonraker Python Virtual Environment"
|
||||||
@ -309,10 +292,7 @@ for svc in ${SERVICES[@]}; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Cleanup
|
# Cleanup
|
||||||
$HOME/$PRINTER_NAME/moonraker/scripts/set-policykit-rules.sh -z
|
$HOME/$PRINTER_NAME/moonraker/scripts/set-policykit-rules.sh
|
||||||
ln -s $HOME/$PRINTER_NAME/mainsail-config/client.cfg $HOME/$PRINTER_NAME/printer_data/config/mainsail.cfg
|
|
||||||
sudo systemctl restart $PRINTER_NAME-klipper.service
|
|
||||||
sudo systemctl restart $PRINTER_NAME-moonraker.service
|
|
||||||
echo.BoldCyan "${PRINTER_NAME} is setup with moonraker on port ${NEW_PORT}"
|
echo.BoldCyan "${PRINTER_NAME} is setup with moonraker on port ${NEW_PORT}"
|
||||||
sudo nginx -t
|
sudo nginx -t
|
||||||
if [ ! -f /etc/nginx/sites-enabled/site.conf ]; then
|
if [ ! -f /etc/nginx/sites-enabled/site.conf ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user