From a985c6cf3a9a90a1b1df52a05dd34319b646700a Mon Sep 17 00:00:00 2001 From: smoser-frc <122906107+smoser-frc@users.noreply.github.com> Date: Wed, 18 Jan 2023 09:25:10 -0500 Subject: [PATCH] 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 --- scripts/install.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 7be1776ec..8e00390c0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -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