mirror of
https://github.com/PhotonVision/photonvision
synced 2026-07-04 03:11:40 +00:00
* 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:
@@ -1,5 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
|
package_is_installed(){
|
||||||
|
dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "ok installed"
|
||||||
|
}
|
||||||
|
|
||||||
if [ "$(id -u)" != "0" ]; then
|
if [ "$(id -u)" != "0" ]; then
|
||||||
echo "This script must be run as root" 1>&2
|
echo "This script must be run as root" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
@@ -50,13 +54,24 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Installing the JDK..."
|
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
|
then
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install --yes openjdk-11-jdk-headless
|
apt-get install --yes openjdk-11-jdk-headless
|
||||||
fi
|
fi
|
||||||
echo "JDK installation complete."
|
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..."
|
echo "Downloading latest stable release of PhotonVision..."
|
||||||
mkdir -p /opt/photonvision
|
mkdir -p /opt/photonvision
|
||||||
|
|||||||
Reference in New Issue
Block a user