2022-11-22 04:31:39 +03:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
set -euxo pipefail
|
|
|
|
|
|
2024-09-06 18:09:38 +03:00
|
|
|
DEBIAN_FRONTEND=noninteractive
|
|
|
|
|
export DEBIAN_FRONTEND
|
|
|
|
|
|
2022-11-22 04:31:39 +03:00
|
|
|
apt-get -qq update
|
|
|
|
|
|
|
|
|
|
apt-get -qq install --no-install-recommends -y \
|
|
|
|
|
apt-transport-https \
|
|
|
|
|
gnupg \
|
|
|
|
|
wget \
|
2022-11-29 04:24:20 +03:00
|
|
|
procps vainfo \
|
2022-11-22 04:31:39 +03:00
|
|
|
unzip locales tzdata libxml2 xz-utils \
|
2024-09-06 18:09:38 +03:00
|
|
|
python3 \
|
2023-01-19 02:23:40 +03:00
|
|
|
python3-pip \
|
|
|
|
|
curl \
|
2023-05-18 04:01:56 +03:00
|
|
|
jq \
|
|
|
|
|
nethogs
|
2022-11-22 04:31:39 +03:00
|
|
|
|
2022-12-09 15:39:02 +03:00
|
|
|
mkdir -p -m 600 /root/.gnupg
|
2022-11-22 04:31:39 +03:00
|
|
|
|
|
|
|
|
# add coral repo
|
2023-05-21 15:14:53 +03:00
|
|
|
curl -fsSLo - https://packages.cloud.google.com/apt/doc/apt-key.gpg | \
|
|
|
|
|
gpg --dearmor -o /etc/apt/trusted.gpg.d/google-cloud-packages-archive-keyring.gpg
|
2024-09-06 18:09:38 +03:00
|
|
|
echo "deb https://packages.cloud.google.com/apt coral-edgetpu-stable main" > /etc/apt/sources.list.d/coral-edgetpu.list
|
2022-11-22 04:31:39 +03:00
|
|
|
echo "libedgetpu1-max libedgetpu/accepted-eula select true" | debconf-set-selections
|
|
|
|
|
|
2023-07-26 13:50:41 +03:00
|
|
|
# enable non-free repo in Debian
|
|
|
|
|
if grep -q "Debian" /etc/issue; then
|
2024-09-06 18:09:38 +03:00
|
|
|
sed -i -e's/ main/ main contrib non-free non-free-firmware/g' /etc/apt/sources.list.d/debian.sources
|
|
|
|
|
echo "deb https://cdn-aws.deb.debian.org/debian unstable main contrib non-free non-free-firmware" > /etc/apt/sources.list.d/debian-unstable.list
|
|
|
|
|
{
|
|
|
|
|
echo 'Package: *'
|
|
|
|
|
echo 'Pin: release a=unstable'
|
|
|
|
|
echo 'Pin-Priority: 300'
|
|
|
|
|
} > /etc/apt/preferences.d/unstable
|
2023-07-26 13:50:41 +03:00
|
|
|
fi
|
2022-11-22 04:31:39 +03:00
|
|
|
|
|
|
|
|
# coral drivers
|
|
|
|
|
apt-get -qq update
|
2024-09-06 18:09:38 +03:00
|
|
|
apt-get -y install --no-install-recommends --no-install-suggests libedgetpu1-max python3-numpy
|
2022-11-22 04:31:39 +03:00
|
|
|
|
2024-09-06 18:09:38 +03:00
|
|
|
# Google have abandoned the Coral Edge TPU and the version of pycoral in their repo only works with Python 3.9.
|
|
|
|
|
# The open source community have stepped up and have updated pycoral to work with newer versions of TFLite and Python.
|
|
|
|
|
# See: https://github.com/google-coral/pycoral/issues/85#issuecomment-2282233714
|
2022-11-22 04:31:39 +03:00
|
|
|
|
2024-09-06 18:09:38 +03:00
|
|
|
case "${TARGETARCH}" in
|
|
|
|
|
amd64)
|
|
|
|
|
tflite_wheel=https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp312-cp312-linux_x86_64.whl
|
|
|
|
|
pycoral_wheel=https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp312-cp312-linux_x86_64.whl
|
|
|
|
|
;;
|
|
|
|
|
arm64)
|
|
|
|
|
tflite_wheel=https://github.com/feranick/TFlite-builds/releases/download/v2.17.0/tflite_runtime-2.17.0-cp312-cp312-linux_aarch64.whl
|
|
|
|
|
pycoral_wheel=https://github.com/feranick/pycoral/releases/download/2.0.2TF2.17.0/pycoral-2.0.2-cp312-cp312-linux_aarch64.whl
|
|
|
|
|
;;
|
|
|
|
|
*)
|
|
|
|
|
echo Pycoral is not supported on target architecture "${TARGETARCH}". 1>&2
|
|
|
|
|
exit 1
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2022-11-22 04:31:39 +03:00
|
|
|
|
2024-09-06 18:09:38 +03:00
|
|
|
pip install --break-system-packages "${tflite_wheel}"
|
|
|
|
|
pip install --break-system-packages "${pycoral_wheel}"
|
|
|
|
|
|
2022-11-22 04:31:39 +03:00
|
|
|
# arch specific packages
|
2024-09-06 18:09:38 +03:00
|
|
|
case "${TARGETARCH}" in
|
|
|
|
|
amd64)
|
|
|
|
|
apt -y -qq install --no-install-recommends --no-install-suggests \
|
|
|
|
|
intel-opencl-icd \
|
|
|
|
|
mesa-va-drivers radeontop libva-drm2 intel-media-va-driver-non-free i965-va-driver libmfx1 intel-gpu-tools
|
|
|
|
|
# something about this dependency requires it to be installed in a separate call rather than in the line above
|
|
|
|
|
apt -y -qq install --no-install-recommends --no-install-suggests \
|
|
|
|
|
i965-va-driver-shaders
|
|
|
|
|
;;
|
|
|
|
|
arm64)
|
|
|
|
|
apt -y -qq install --no-install-recommends --no-install-suggests \
|
|
|
|
|
libva-drm2 mesa-va-drivers
|
|
|
|
|
;;
|
|
|
|
|
esac
|
2022-11-22 04:31:39 +03:00
|
|
|
|
2024-09-06 03:27:32 +03:00
|
|
|
# install vulkan
|
|
|
|
|
apt-get -qq install --no-install-recommends --no-install-suggests -y \
|
|
|
|
|
libvulkan1 mesa-vulkan-drivers
|
|
|
|
|
|
2024-09-06 18:09:38 +03:00
|
|
|
apt-get -y purge gnupg apt-transport-https xz-utils
|
|
|
|
|
apt-get -y clean autoclean
|
|
|
|
|
apt-get -y autoremove --purge
|
|
|
|
|
rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
|
2023-04-23 19:35:40 +03:00
|
|
|
|
|
|
|
|
# Install yq, for frigate-prepare and go2rtc echo source
|
|
|
|
|
curl -fsSL \
|
|
|
|
|
"https://github.com/mikefarah/yq/releases/download/v4.33.3/yq_linux_$(dpkg --print-architecture)" \
|
|
|
|
|
--output /usr/local/bin/yq
|
|
|
|
|
chmod +x /usr/local/bin/yq
|