Created
July 10, 2023 20:37
-
-
Save srd424/9b000a8d3beebe4cb7840acf284b3a19 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
set -e | |
#DEFBUILDARCHS="amd64 armhf" | |
build () { | |
local _arch=$1; shift | |
export ARCH="${_arch}" | |
modules="net/mvlan" | |
contname="nuc-birdnetpi" | |
ifrom debian:bullseye | |
icopy_files | |
imacro standard_init | |
iinstall systemd unattended-upgrades dbus sudo | |
iinstall udev ca-certificates #dbus-user-session | |
# for debugging / easier admin | |
iinstall less iproute2 vim-tiny iputils-ping net-tools | |
iinstall mlocate aptitude | |
ienable systemd-resolved | |
# curl -s https://johnvansickle.com/ffmpeg/releases/ffmpeg-release-amd64-static.tar.xz | \ | |
# irun tar -C /usr/local/lib -xJvf - | |
# irun ln -s /usr/local/lib/ffmpeg-6.0-amd64-static/ffmpeg /usr/local/bin | |
irun adduser --disabled-login --gecos "" pi | |
irun adduser pi sudo | |
irun su -l pi -c 'd=/home/pi/.cache; mkdir $d; chown pi:pi $d' | |
irun su -l pi -c "ln -s /vol/pip-cache /home/pi/.cache/pip" | |
iinstall curl git jq python3-venv patch cron | |
irun su -l pi -c "git clone -b debian --depth=1 https://github.com/MatthewBCooke/BirdNET-Pi.git /home/pi/BirdNET-Pi" | |
for p in $(cd patches; ls 2>/dev/null *.diff *.url | sort -n); do | |
if echo "$p" | grep -q '.url$'; then | |
local url=$(cat patches/$p) | |
echo "applying $url" | |
curl -s "$url" | irun su -l pi -c "patch -d /home/pi/BirdNET-Pi -p1" | |
else | |
echo "applying patches/$p" | |
cat patches/$p | irun su -l pi -c "patch -d /home/pi/BirdNET-Pi -p1" | |
fi | |
done | |
irun bash -c "cat >/home/pi/BirdNET-Pi/birdnet.conf.override" <<-EOM | |
INSTALL_PULSEAUDIO=false | |
INSTALL_FFMPEG=static | |
EOM | |
ORIG_BAH_OPTS="$CB_BAH_OPTS" | |
export CB_BAH_OPTS="${ORIG_BAH_OPTS} --mount=type=bind,source=/vol/pip-cache/birdnet,destination=/vol/pip-cache" | |
irun su -l pi -c "/home/pi/BirdNET-Pi/scripts/install_birdnet.sh" | |
export CB_BAH_OPTS="${ORIG_BAH_OPTS}" | |
for f in BirdDB.txt apprise.txt birdnet.conf exclude_species_list.txt include_species_list.txt; do | |
irun su -l pi -c "d=/home/pi/BirdNET-Pi; rm -f \$d/$f && ln -s /state/$f \$d/$f" | |
done | |
irun su -l pi -c 'd=/home/pi/BirdNET-Pi/scripts; f=birds.db; rm -f $d/$f && ln -s /state/$f $d/$f' | |
ifinish | |
} | |
build amd64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment