-
Notifications
You must be signed in to change notification settings - Fork 66
Expand file tree
/
Copy path01_copy_klipper.sh
More file actions
executable file
·55 lines (42 loc) · 1.37 KB
/
01_copy_klipper.sh
File metadata and controls
executable file
·55 lines (42 loc) · 1.37 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/bash
if [[ -z "$CREATE_FIRMWARE" ]]; then
echo "Error: This script should be run within the create_firmware.sh environment."
exit 1
fi
if [[ $# -ne 1 ]]; then
echo "Usage: $0 <rootfs-dir>"
exit 1
fi
ROOT_DIR="$(realpath "$(dirname "$0")/../../../..")"
ROOTFS_DIR="$(realpath "$1")"
ORG_ROOTFS_DIR="${ROOTFS_DIR}.org"
set -e
mkdir_chroot() {
for dir; do
echo ">> Creating directory $dir in chroot..."
mkdir -p "$ROOTFS_DIR/$dir"
done
}
copy_chroot() {
local target="$1"
shift
echo ">> Copying to $target the $@..."
for src; do
cp -rv -L --remove-destination "$ORG_ROOTFS_DIR/$src" "$ROOTFS_DIR/$target"
done
}
in_chroot() {
"$ROOT_DIR/scripts/helpers/chroot_firmware.sh" "$ROOTFS_DIR" bash -c "$@"
}
echo ">> Copying Klipper from /home/lava/klipper to /opt/klipper..."
mkdir_chroot /opt/klipper
copy_chroot /opt/klipper/ /home/lava/klipper/.
echo ">> Installing klipper requirements..."
in_chroot '/opt/venv/bin/pip3 install --upgrade pip'
in_chroot '/opt/venv/bin/pip3 install -r /opt/klipper/scripts/klippy-requirements.txt'
# Additional modules not included in klippy-requirements.txt
echo ">> Installing additional klipper requirements..."
in_chroot '/opt/venv/bin/pip3 install paho-mqtt spidev cryptography "numpy<2.0"'
echo ">> Setting ownership to lava:lava..."
in_chroot 'chown -R lava:lava /opt/klipper'
echo ">> Klipper installation complete"