-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
36 lines (31 loc) · 1.2 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
#!/bin/bash
KDIR="${HOME}/klipper"
KENV="${HOME}/klippy-env"
BKDIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
if [ ! -d "$KDIR" ] || [ ! -d "$KENV" ]; then
echo "idm: klipper or klippy env doesn't exist"
exit 1
fi
# install idm requirements to env
echo "idm: installing python requirements to env, this may take 10+ minutes."
sudo apt-get install g++ gfortran
"${KENV}/bin/pip" install -r "${BKDIR}/requirements.txt"
# update link to idm.py
echo "idm: linking klippy to idm.py."
sudo apt-get install g++ gfortran libopenblas-dev
if [ -e "${KDIR}/klippy/extras/idm.py" ]; then
rm "${KDIR}/klippy/extras/idm.py"
fi
if [ -e "${KDIR}/klippy/extras/idm_accel.py" ]; then
rm "${KDIR}/klippy/extras/idm_accel.py"
fi
ln -s "${BKDIR}/idm.py" "${KDIR}/klippy/extras/idm.py"
ln -s "${BKDIR}/idm_accel.py" "${KDIR}/klippy/extras/idm_accel.py"
# exclude idm.py from klipper git tracking
if ! grep -q "klippy/extras/idm.py" "${KDIR}/.git/info/exclude"; then
echo "klippy/extras/idm.py" >> "${KDIR}/.git/info/exclude"
fi
if ! grep -q "klippy/extras/idm_accel.py" "${KDIR}/.git/info/exclude"; then
echo "klippy/extras/idm_accel.py" >> "${KDIR}/.git/info/exclude"
fi
echo "idm: installation successful."