Fix #748 - add libopencv-core4.5 for aarch64 systems. (#749)

* Add and use a function in install.sh to determine if package is installed.

Move the "is a package installed" code into a function.

* Install libopencv-core4.5 on aarch64, which is likely raspberry pi.

The libphotonvision.so on Raspberry pi depends on libopencv-core4.5.
The code here installs that package on all aarch64 systems, as
there was not an obvious way to install on only Raspberry pi systems.

Fixes #748.

Co-authored-by: Scott Moser <smoser@brickies.net>
This commit is contained in:
smoser-frc
2023-01-18 09:25:10 -05:00
committed by GitHub
parent 167a4661ca
commit a985c6cf3a

View File

@@ -1,5 +1,9 @@
#!/bin/bash
package_is_installed(){
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "ok installed"
}
if [ "$(id -u)" != "0" ]; then
echo "This script must be run as root" 1>&2
exit 1
@@ -50,13 +54,24 @@ else
fi
echo "Installing the JDK..."
if [ $(dpkg-query -W -f='${Status}' openjdk-11-jdk-headless 2>/dev/null | grep -c "ok installed") -eq 0 ];
if ! package_is_installed openjdk-11-jdk-headless
then
apt-get update
apt-get install --yes openjdk-11-jdk-headless
fi
echo "JDK installation complete."
if [ "$ARCH" == "aarch64" ]
then
if package_is_installed libopencv-core4.5
then
echo "libopencv-core4.5 already installed"
else
# libphotonlibcamera.so on raspberry pi has dep on libopencv_core
echo "Installing libopencv-core4.5 on aarch64"
apt-get install --yes libopencv-core4.5
fi
fi
echo "Downloading latest stable release of PhotonVision..."
mkdir -p /opt/photonvision