76 lines
2.1 KiB
Bash
76 lines
2.1 KiB
Bash
# this should only contain functions and assignments, ie source install.sh should not have side effects.
|
|
|
|
get_tf_whl () {
|
|
BASE_URL=https://github.com/Nachtzuster/BirdNET-Pi/releases/download/v0.1/
|
|
|
|
ARCH=$(uname -m)
|
|
PY_VERSION=$(python3 -c "import sys; print(f'{sys.version_info[0]}{sys.version_info[1]}')")
|
|
case "${ARCH}-${PY_VERSION}" in
|
|
aarch64-39)
|
|
WHL=tflite_runtime-2.11.0-cp39-none-linux_aarch64.whl
|
|
;;
|
|
aarch64-311)
|
|
WHL=tflite_runtime-2.17.1-cp311-cp311-linux_aarch64.whl
|
|
;;
|
|
aarch64-312)
|
|
WHL=tflite_runtime-2.17.1-cp312-cp312-linux_aarch64.whl
|
|
;;
|
|
aarch64-313)
|
|
WHL=tflite_runtime-2.17.1-cp313-cp313-linux_aarch64.whl
|
|
;;
|
|
x86_64-39)
|
|
WHL=tflite_runtime-2.11.0-cp39-cp39-linux_x86_64.whl
|
|
;;
|
|
x86_64-311)
|
|
WHL=tflite_runtime-2.17.1-cp311-cp311-linux_x86_64.whl
|
|
;;
|
|
x86_64-312)
|
|
WHL=tflite_runtime-2.17.1-cp312-cp312-linux_x86_64.whl
|
|
;;
|
|
x86_64-313)
|
|
WHL=tflite_runtime-2.17.1-cp313-cp313-linux_x86_64.whl
|
|
;;
|
|
*)
|
|
echo "No tflite version found for ${ARCH}-${PY_VERSION}"
|
|
WHL=''
|
|
;;
|
|
esac
|
|
if [ -n "$WHL" ]; then
|
|
{
|
|
curl -L -o $HOME/BirdNET-Pi/$WHL $BASE_URL$WHL
|
|
sed "s/tflite_runtime.*/$WHL/" $HOME/BirdNET-Pi/requirements.txt > requirements_custom.txt
|
|
}
|
|
fi
|
|
}
|
|
|
|
install_birdnet_mount() {
|
|
TMP_MOUNT=$(systemd-escape -p --suffix=mount "$RECS_DIR/StreamData")
|
|
cat << EOF > $HOME/BirdNET-Pi/templates/$TMP_MOUNT
|
|
[Unit]
|
|
Description=Birdnet tmpfs for transient files
|
|
ConditionPathExists=$RECS_DIR/StreamData
|
|
|
|
[Mount]
|
|
What=tmpfs
|
|
Where=$RECS_DIR/StreamData
|
|
Type=tmpfs
|
|
Options=mode=1777,nosuid,nodev
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
ln -sf $HOME/BirdNET-Pi/templates/$TMP_MOUNT /usr/lib/systemd/system
|
|
}
|
|
|
|
install_tmp_mount() {
|
|
STATE=$(systemctl is-enabled tmp.mount 2>&1 | grep -E '(enabled|disabled|static)')
|
|
! [ -f /usr/share/systemd/tmp.mount ] && echo "Warning: no /usr/share/systemd/tmp.mount found"
|
|
if [ -z $STATE ]; then
|
|
cp -f /usr/share/systemd/tmp.mount /etc/systemd/system/tmp.mount
|
|
systemctl daemon-reload
|
|
systemctl enable tmp.mount
|
|
else
|
|
echo "tmp.mount is $STATE, skipping"
|
|
fi
|
|
}
|