Remove fake service script from moonraker update.

This commit is contained in:
Zach Schimke 2021-12-07 21:02:02 -07:00
parent ff1764102e
commit 57f88531fa
2 changed files with 1 additions and 73 deletions

View File

@ -26,4 +26,4 @@ type: git_repo
path: ~/config
origin: https://github.com/retsamedoc/VoronV0_klipper.git
primary_branch:main
install_script: scripts/install.sh
is_system_service: False

View File

@ -1,72 +0,0 @@
#!/bin/bash
KLIPPER_PATH="${HOME}/klipper"
SYSTEMDDIR="/etc/systemd/system"
# Step 1: Verify Klipper has been installed
check_klipper()
{
if [ "$(sudo systemctl list-units --full -all -t service --no-legend | grep -F "klipper.service")" ]; then
echo "Klipper service found!"
else
echo "Klipper service not found, please install Klipper first"
exit -1
fi
}
# Step 2: Install startup script
install_script()
{
# Create systemd service file
SERVICE_FILE="${SYSTEMDDIR}/klipper_config.service"
[ -f $SERVICE_FILE ] && return
echo "Installing system start script..."
sudo /bin/sh -c "cat > ${SERVICE_FILE}" << EOF
[Unit]
Description=Dummy Service for klipper-config
After=klipper.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/bash -c 'exec -a klipper-config sleep 1'
[Install]
WantedBy=multi-user.target
EOF
# Use systemctl to enable the systemd service script
sudo systemctl daemon-reload
sudo systemctl enable klipper-config.service
}
# Step 3: restarting Klipper
restart_klipper()
{
echo "Restarting Klipper..."
sudo systemctl restart klipper
}
# Helper functions
verify_ready()
{
if [ "$EUID" -eq 0 ]; then
echo "This script must not run as root"
exit -1
fi
}
# Force script to exit if an error occurs
set -e
# Find SRCDIR from the pathname of this script
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/ && pwd )"
# Parse command line arguments
while getopts "k:" arg; do
case $arg in
k) KLIPPER_PATH=$OPTARG;;
esac
done
# Run steps
verify_ready
install_script
restart_klipper