-
Notifications
You must be signed in to change notification settings - Fork 24
/
install.sh
executable file
·43 lines (36 loc) · 1.23 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
41
42
43
#!/bin/bash
# automatically calculate your printer's maximum acceleration/velocity
#
# Copyright (C) 2024 Anonoei <[email protected]>
#
# This file may be distributed under the terms of the MIT license.
# Force script to exit if an error occurs
set -e
KLIPPER_PATH="${HOME}/klipper"
SYSTEMDDIR="/etc/systemd/system"
SRCDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )"/ && pwd )"
# Verify we're running as root
if [ "$(id -u)" -eq 0 ]; then
echo "This script must not run as root"
exit -1
fi
# Check if Klipper is installed
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
# Link auto speed to klipper
echo "Linking auto speed to Klipper..."
ln -sf "${SRCDIR}/auto_speed.py" "${KLIPPER_PATH}/klippy/extras/auto_speed.py"
mkdir -p "${KLIPPER_PATH}/klippy/extras/autospeed"
for file in `ls autospeed/*.py`; do
ln -sf "${SRCDIR}/${file}" "${KLIPPER_PATH}/klippy/extras/${file}"
done
# Install matplotlib
echo "Installing matplotlib in klippy..."
~/klippy-env/bin/python -m pip install matplotlib
# Restart klipper
echo "Restarting Klipper..."
sudo systemctl restart klipper