forked from hawkeyexp/auto_offset_z
-
Notifications
You must be signed in to change notification settings - Fork 2
/
install.sh
executable file
·40 lines (36 loc) · 1 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
if [ ${UID} == '0' ]; then
echo -e "Don't run this script as root! - aborting ..."
exit 1
fi
if [ ! -d ~/klipper ]; then
echo -e "Klipper must be installed on your system - aborting ..."
exit 1
else
echo "Klipper detected - let's go ..."
fi
if [ ! -d ~/Auto_Z_Offset ]; then
echo -e "Directory Auto_Z_Offset is missing - aborting ..."
exit 1
else
echo -e "AUTO_OFFSET_Z - let's go ..."
rm -f ~/klipper/klippy/extras/auto_offset_z.py 2>&1>/dev/null
ln -s ~/Auto_Z_Offset/auto_offset_z.py ~/klipper/klippy/extras/auto_offset_z.py
sudo /bin/sh -c "cat > /etc/systemd/system/auto_offset_z.service" << EOF
[Unit]
Description=Dummy Service for auto_offset_z plugin
After=klipper.service
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sleep 1
ExecStartPost=/usr/sbin/service klipper restart
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable auto_offset_z
sudo systemctl restart auto_offset_z
echo -e "done."
fi
exit 0