From 6cb51838570cd3b2c451a67bd20988c8bfb757f8 Mon Sep 17 00:00:00 2001 From: Prateek Machiraju Date: Sat, 1 Aug 2020 22:52:19 -0400 Subject: [PATCH 01/59] Add install script (#67) --- scripts/install.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 scripts/install.sh diff --git a/scripts/install.sh b/scripts/install.sh new file mode 100755 index 0000000..eb249c9 --- /dev/null +++ b/scripts/install.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi + +echo "This is the installation script for PhotonVision." + +echo "Installing the JDK..." +if [ $(dpkg-query -W -f='${Status}' openjdk-11-jdk-headless 2>/dev/null | grep -c "ok installed") -eq 0 ]; +then + apt update + apt-get install openjdk-11-jdk-headless; +fi +echo "JDK installation complete." + + +echo "Downloading latest stable release of PhotonVision..." +mkdir -p /opt/photonvision +cd /opt/photonvision +curl -s https://api.github.com/repos/photonvision/photonvision/releases/latest | + grep "browser_download_url.*jar" | + cut -d : -f 2,3 | + tr -d '"' | + wget -qi - -O photonvision.jar +echo "Downloaded latest stable release of PhotonVision." + +echo "Creating the PhotonVision systemd service..." +cd /lib/systemd/system/ +touch photonvision.service +printf \ +"[Unit] +Description=Service that runs PhotonVision + +[Service] +WorkingDirectory=/opt/photonvision +ExecStart=/usr/bin/java -jar /opt/photonvision/photonvision.jar + +[Install] +WantedBy=multi-user.target" >> photonvision.service +cp photonvision.service /etc/systemd/system/photonvision.service +chmod 644 /etc/systemd/system/photonvision.service +systemctl daemon-reload +systemctl enable photonvision.service + +echo "Created PhotonVision systemd service." + +echo "PhotonVision installation successful." From d7cec05fddd4ef118be4d4dd97d3849666853105 Mon Sep 17 00:00:00 2001 From: Prateek Machiraju Date: Thu, 6 Aug 2020 15:52:54 -0400 Subject: [PATCH 02/59] Remove photonvision service if it already exists (#76) --- scripts/install.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index eb249c9..5f54506 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -27,6 +27,16 @@ curl -s https://api.github.com/repos/photonvision/photonvision/releases/latest | echo "Downloaded latest stable release of PhotonVision." echo "Creating the PhotonVision systemd service..." + +if service --status-all | grep -Fq 'photonvision'; then + systemctl stop photonvision + systemctl disable photonvision + rm /lib/systemd/system/photonvision.service + rm /etc/systemd/system/photonvision.service + systemctl dameon-relaod + systemctl reset-failed +fi + cd /lib/systemd/system/ touch photonvision.service printf \ From 77865dedf37c415eb657cd0473ee41c000411de0 Mon Sep 17 00:00:00 2001 From: Prateek Machiraju Date: Sat, 5 Sep 2020 16:28:17 -0400 Subject: [PATCH 03/59] Fix spelling error in install script (#113) --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 5f54506..b105f69 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -33,7 +33,7 @@ if service --status-all | grep -Fq 'photonvision'; then systemctl disable photonvision rm /lib/systemd/system/photonvision.service rm /etc/systemd/system/photonvision.service - systemctl dameon-relaod + systemctl daemon-reload systemctl reset-failed fi From 7297064a8485b4bd89940da5078584343e1c42c9 Mon Sep 17 00:00:00 2001 From: Banks T Date: Fri, 18 Sep 2020 21:37:56 -0400 Subject: [PATCH 04/59] Fix curl error, update service unit file (#129) --- scripts/install.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index b105f69..df36092 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -19,7 +19,7 @@ echo "JDK installation complete." echo "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision cd /opt/photonvision -curl -s https://api.github.com/repos/photonvision/photonvision/releases/latest | +curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest | grep "browser_download_url.*jar" | cut -d : -f 2,3 | tr -d '"' | @@ -46,6 +46,10 @@ Description=Service that runs PhotonVision [Service] WorkingDirectory=/opt/photonvision ExecStart=/usr/bin/java -jar /opt/photonvision/photonvision.jar +ExecStop=/bin/systemctl kill photonvision +Type=simple +Restart=on-failure +RestartSec=1 [Install] WantedBy=multi-user.target" >> photonvision.service From cc3a5382833cf274c969a3b46c90ed6ccc398a38 Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Sun, 21 Nov 2021 17:22:56 -0800 Subject: [PATCH 05/59] Upgrade to Gradle 7.2 and WPILib 2022 (#316) --- scripts/install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index df36092..67dc442 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -19,16 +19,16 @@ echo "JDK installation complete." echo "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision cd /opt/photonvision -curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest | - grep "browser_download_url.*jar" | - cut -d : -f 2,3 | - tr -d '"' | +curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest | + grep "browser_download_url.*jar" | + cut -d : -f 2,3 | + tr -d '"' | wget -qi - -O photonvision.jar echo "Downloaded latest stable release of PhotonVision." echo "Creating the PhotonVision systemd service..." -if service --status-all | grep -Fq 'photonvision'; then +if service --status-all | grep -Fq 'photonvision'; then systemctl stop photonvision systemctl disable photonvision rm /lib/systemd/system/photonvision.service @@ -50,7 +50,7 @@ ExecStop=/bin/systemctl kill photonvision Type=simple Restart=on-failure RestartSec=1 - + [Install] WantedBy=multi-user.target" >> photonvision.service cp photonvision.service /etc/systemd/system/photonvision.service From 4067a934fafb7ed86617df8ef88d9ac004570619 Mon Sep 17 00:00:00 2001 From: Mohammad Durrani <46766905+mdurrani808@users.noreply.github.com> Date: Thu, 1 Dec 2022 19:24:57 -0500 Subject: [PATCH 06/59] Add curl (#618) * Add curl * goofy wording Co-authored-by: shueja-personal <32416547+shueja-personal@users.noreply.github.com> --- scripts/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index 67dc442..1a3e086 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -7,6 +7,10 @@ fi echo "This is the installation script for PhotonVision." +echo "Installing curl..." +apt-get install curl +echo "curl installation complete." + echo "Installing the JDK..." if [ $(dpkg-query -W -f='${Status}' openjdk-11-jdk-headless 2>/dev/null | grep -c "ok installed") -eq 0 ]; then From 75c41905e2379f719c31226286d3daf548290a46 Mon Sep 17 00:00:00 2001 From: Mohammad Durrani <46766905+mdurrani808@users.noreply.github.com> Date: Thu, 1 Dec 2022 19:25:29 -0500 Subject: [PATCH 07/59] Update heap size for install script (#622) --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 1a3e086..b94aba0 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -49,7 +49,7 @@ Description=Service that runs PhotonVision [Service] WorkingDirectory=/opt/photonvision -ExecStart=/usr/bin/java -jar /opt/photonvision/photonvision.jar +ExecStart=/usr/bin/java -jar /opt/photonvision/photonvision.jar -Xmx512m ExecStop=/bin/systemctl kill photonvision Type=simple Restart=on-failure From 92d1d352deb02898a450a6dad6f104139d5c3aea Mon Sep 17 00:00:00 2001 From: Mohammad Durrani <46766905+mdurrani808@users.noreply.github.com> Date: Thu, 8 Dec 2022 19:23:02 -0500 Subject: [PATCH 08/59] Add avahi daemon to install script (#625) --- scripts/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index b94aba0..38009e8 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -11,6 +11,10 @@ echo "Installing curl..." apt-get install curl echo "curl installation complete." +echo "Installing avahi-daemon..." +apt-get install avahi-daemon +echo "avahi-daemon installation complete." + echo "Installing the JDK..." if [ $(dpkg-query -W -f='${Status}' openjdk-11-jdk-headless 2>/dev/null | grep -c "ok installed") -eq 0 ]; then From a962a77186ccf4fab5450e7a662560a37efec846 Mon Sep 17 00:00:00 2001 From: Paul Rensing Date: Mon, 26 Dec 2022 23:04:46 -0500 Subject: [PATCH 09/59] Cpu performance mode & BIG.little tweaks (#633) * Add nice value to service file, and give example CPU selection for those who need it. * Use cpufrequtils package to set CPUs into performance mode * Add comment about nice value * Need to say "yes" to installing cpufrequtils, and safer to do so for all installs. Co-authored-by: Matt --- scripts/install.sh | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 38009e8..d386b4e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -8,18 +8,29 @@ fi echo "This is the installation script for PhotonVision." echo "Installing curl..." -apt-get install curl +apt-get install --yes curl echo "curl installation complete." echo "Installing avahi-daemon..." -apt-get install avahi-daemon +apt-get install --yes avahi-daemon echo "avahi-daemon installation complete." +echo "Installing cpufrequtils..." +apt-get install --yes cpufrequtils +echo "cpufrequtils installation complete." + +echo "Setting cpufrequtils to performance mode" +if [ -f /etc/default/cpufrequtils ]; then + sed -i -e 's/^#\?GOVERNOR=.*$/GOVERNOR=performance/' /etc/default/cpufrequtils +else + echo 'GOVERNOR=performance' > /etc/default/cpufrequtils +fi + echo "Installing the JDK..." if [ $(dpkg-query -W -f='${Status}' openjdk-11-jdk-headless 2>/dev/null | grep -c "ok installed") -eq 0 ]; then - apt update - apt-get install openjdk-11-jdk-headless; + apt-get update + apt-get install --yes openjdk-11-jdk-headless fi echo "JDK installation complete." @@ -45,14 +56,18 @@ if service --status-all | grep -Fq 'photonvision'; then systemctl reset-failed fi -cd /lib/systemd/system/ -touch photonvision.service -printf \ -"[Unit] +cat > /lib/systemd/system/photonvision.service <> photonvision.service -cp photonvision.service /etc/systemd/system/photonvision.service +WantedBy=multi-user.target +EOF + +cp /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service chmod 644 /etc/systemd/system/photonvision.service systemctl daemon-reload systemctl enable photonvision.service From 3d21443626144e693a455464d84664b5763f8afe Mon Sep 17 00:00:00 2001 From: Matt Date: Wed, 28 Dec 2022 11:21:41 -0800 Subject: [PATCH 10/59] Replace MMAL driver with Libcamera (#491) Co-authored-by: Chris Gerth --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index d386b4e..e988eae 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -68,7 +68,7 @@ Nice=-10 # look up the right values for your CPU # AllowCPUs=4-7 -ExecStart=/usr/bin/java -jar /opt/photonvision/photonvision.jar -Xmx512m +ExecStart=/usr/bin/java -Xmx512m -jar /opt/photonvision/photonvision.jar ExecStop=/bin/systemctl kill photonvision Type=simple Restart=on-failure From dccede94671b4addb8585a83efdebc82e1270f9b Mon Sep 17 00:00:00 2001 From: Matt Date: Mon, 2 Jan 2023 07:12:10 -0800 Subject: [PATCH 11/59] Make install script auto-detect arch (#679) * Make install script auto-detect arch #679 Tested on linux x64 and aarch64 * Fix arm32 uname string Co-authored-by: Chris Gerth --- scripts/install.sh | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index e988eae..7be1776 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -5,7 +5,30 @@ if [ "$(id -u)" != "0" ]; then exit 1 fi +ARCH=$(uname -m) +ARCH_NAME="" +if [ "$ARCH" = "aarch64" ]; then + ARCH_NAME="linuxarm64" +elif [ "$ARCH" = "armv7l" ]; then + ARCH_NAME="linuxarm32" +elif [ "$ARCH" = "x86_64" ]; then + ARCH_NAME="linuxx64" +else + if [ "$#" -ne 1 ]; then + echo "Can't determine current arch; please provide it (one of):" + echo "" + echo "- linuxarm32 (32-bit Linux ARM)" + echo "- linuxarm64 (64-bit Linux ARM)" + echo "- linuxx64 (64-bit Linux)" + exit 1 + else + echo "Can't detect arch (got $ARCH) -- using user-provided $1" + ARCH_NAME=$1 + fi +fi + echo "This is the installation script for PhotonVision." +echo "Installing for platform $ARCH_NAME" echo "Installing curl..." apt-get install --yes curl @@ -39,7 +62,7 @@ echo "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision cd /opt/photonvision curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest | - grep "browser_download_url.*jar" | + grep "browser_download_url.*$ARCH_NAME.jar" | cut -d : -f 2,3 | tr -d '"' | wget -qi - -O photonvision.jar From 9cb3447f7c0c88c40d8879cbeabfee295af946a7 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 12/59] 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 7be1776..8e00390 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 From 84a7644300a47764a485b515b91de9479bc9efea Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 21 Jul 2023 06:13:36 -0700 Subject: [PATCH 13/59] Install JRE instead of JDK in install script (#883) Should reduce the size of packages needed to be downloaded --- scripts/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 8e00390..61cb52f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -53,11 +53,11 @@ else echo 'GOVERNOR=performance' > /etc/default/cpufrequtils fi -echo "Installing the JDK..." -if ! package_is_installed openjdk-11-jdk-headless +echo "Installing the JRE..." +if ! package_is_installed openjre-11-jre-headless then apt-get update - apt-get install --yes openjdk-11-jdk-headless + apt-get install --yes openjre-11-jre-headless fi echo "JDK installation complete." From 753cab5c5e9455a31b74cc83d70638b7feb70815 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Thu, 27 Jul 2023 09:24:12 -0500 Subject: [PATCH 14/59] Use correct package name (#891) --- scripts/install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 61cb52f..cfbaa2f 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -54,12 +54,12 @@ else fi echo "Installing the JRE..." -if ! package_is_installed openjre-11-jre-headless +if ! package_is_installed openjdk-11-jre-headless then apt-get update - apt-get install --yes openjre-11-jre-headless + apt-get install --yes openjdk-11-jre-headless fi -echo "JDK installation complete." +echo "JRE installation complete." if [ "$ARCH" == "aarch64" ] then From 39222f104fd18eaaa149523de758853b5096a949 Mon Sep 17 00:00:00 2001 From: Matt Date: Tue, 19 Dec 2023 19:38:55 -0500 Subject: [PATCH 15/59] Install script use Java 17 --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index cfbaa2f..14fa346 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -54,10 +54,10 @@ else fi echo "Installing the JRE..." -if ! package_is_installed openjdk-11-jre-headless +if ! package_is_installed openjdk-17-jre-headless then apt-get update - apt-get install --yes openjdk-11-jre-headless + apt-get install --yes openjdk-17-jre-headless fi echo "JRE installation complete." From a2566ea2ba5a63930a42db1f2cf9c8ecdddf6748 Mon Sep 17 00:00:00 2001 From: Paul Rensing Date: Mon, 1 Jan 2024 12:51:02 -0500 Subject: [PATCH 16/59] Fix typo in systemd parameter (#1099) --- scripts/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 14fa346..c2634db 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -104,7 +104,7 @@ WorkingDirectory=/opt/photonvision Nice=-10 # for non-uniform CPUs, like big.LITTLE, you want to select the big cores # look up the right values for your CPU -# AllowCPUs=4-7 +# AllowedCPUs=4-7 ExecStart=/usr/bin/java -Xmx512m -jar /opt/photonvision/photonvision.jar ExecStop=/bin/systemctl kill photonvision From e7ebc1b61b4835624ab8eaf03be191ea6b35e026 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 6 Jan 2024 08:45:56 -0600 Subject: [PATCH 17/59] Install NetworkManager on Ubuntu distributions (fixes #1052) (#1070) Add the following args to the install script: Syntax: sudo ./install.sh [-h|m|n|q] options: -h Display this help message. -m Install and configure NetworkManager (Ubuntu only). -n Disable networking. This will also prevent installation of NetworkManager. -q Silent install, automatically accepts all defaults. For non-interactive use. --- scripts/install.sh | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index c2634db..4a5e0e3 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -4,6 +4,42 @@ package_is_installed(){ dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "ok installed" } +help() { + echo "This script installs Photonvision." + echo "It must be run as root." + echo + echo "Syntax: sudo ./install.sh [-h|m|n|q]" + echo " options:" + echo " -h Display this help message." + echo " -m Install and configure NetworkManager (Ubuntu only)." + echo " -n Disable networking. This will also prevent installation of NetworkManager." + echo " -q Silent install, automatically accepts all defaults. For non-interactive use." + echo +} + +INSTALL_NETWORK_MANAGER="false" + +while getopts ":hmnq" name; do + case "$name" in + h) + help + exit 0 + ;; + m) INSTALL_NETWORK_MANAGER="true" + ;; + n) DISABLE_NETWORKING="true" + ;; + q) QUIET="true" + ;; + \?) + echo "Error: Invalid option -- '$OPTARG'" + echo "Try './install.sh -h' for more information." + exit 1 + esac +done + +shift $(($OPTIND -1)) + if [ "$(id -u)" != "0" ]; then echo "This script must be run as root" 1>&2 exit 1 @@ -34,6 +70,16 @@ fi echo "This is the installation script for PhotonVision." echo "Installing for platform $ARCH_NAME" +DISTRO=$(lsb_release -is) +if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET" && -z "$DISABLE_NETWORKING" ]]; then + echo "" + echo "Photonvision uses NetworkManager to control networking on your device." + read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response + if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then + INSTALL_NETWORK_MANAGER="true" + fi +fi + echo "Installing curl..." apt-get install --yes curl echo "curl installation complete." @@ -53,6 +99,16 @@ else echo 'GOVERNOR=performance' > /etc/default/cpufrequtils fi +if [[ "$INSTALL_NETWORK_MANAGER" == "true" ]]; then + echo "Installing network-manager..." + apt-get install --yes network-manager + cat > /etc/netplan/00-default-nm-renderer.yaml < Date: Sun, 7 Jan 2024 20:18:48 -0500 Subject: [PATCH 18/59] Add mrcal packges to install script (#1128) Closes #1124 Also bumps opencv to 4.6 to match our libcamera driver --- scripts/install.sh | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 4a5e0e3..cf02dea 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -119,16 +119,19 @@ echo "JRE installation complete." if [ "$ARCH" == "aarch64" ] then - if package_is_installed libopencv-core4.5 + if package_is_installed libopencv-core4.6 then - echo "libopencv-core4.5 already installed" + echo "libopencv-core4.6 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 + echo "Installing libopencv-core4.6 on aarch64" + apt-get install --yes libopencv-core4.6 fi fi +echo "Installing additional math packages" +apt-get install --yes libcholmod3 liblapack3 libsuitesparseconfig5 + echo "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision cd /opt/photonvision From f1a881f2b037346b5acfe83a3aca13f39007c389 Mon Sep 17 00:00:00 2001 From: Gautam Date: Sat, 27 Jan 2024 06:46:50 -0800 Subject: [PATCH 19/59] Add v4l-utils to install script (#1201) adds about 2kb to our image --- scripts/install.sh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index cf02dea..985b61e 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -132,6 +132,10 @@ fi echo "Installing additional math packages" apt-get install --yes libcholmod3 liblapack3 libsuitesparseconfig5 +echo "Installing v4l-utils..." +apt-get install --yes v4l-utils +echo "v4l-utils installation complete." + echo "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision cd /opt/photonvision From 3674df66bdfd0d6f913a68b4f76c50810366ae30 Mon Sep 17 00:00:00 2001 From: Vasista Vovveti Date: Mon, 19 Feb 2024 18:37:55 -0800 Subject: [PATCH 20/59] Run apt update and install sqlite3 (#1247) --- scripts/install.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/install.sh b/scripts/install.sh index 985b61e..fe845d8 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -80,6 +80,9 @@ if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET fi fi +echo "Update package list" +apt-get update + echo "Installing curl..." apt-get install --yes curl echo "curl installation complete." @@ -136,6 +139,9 @@ echo "Installing v4l-utils..." apt-get install --yes v4l-utils echo "v4l-utils installation complete." +echo "Installing sqlite3" +apt-get install --yes sqlite3 + echo "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision cd /opt/photonvision From 5b46b4a8a8b99b7410708dd4cb35373818b2ab45 Mon Sep 17 00:00:00 2001 From: Matt Date: Fri, 10 May 2024 12:09:01 -0400 Subject: [PATCH 21/59] Bump libcamera to fix picam v1, remove duplicate opencv (#1263) --- scripts/install.sh | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index fe845d8..5289563 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -120,18 +120,6 @@ then fi echo "JRE installation complete." -if [ "$ARCH" == "aarch64" ] -then - if package_is_installed libopencv-core4.6 - then - echo "libopencv-core4.6 already installed" - else - # libphotonlibcamera.so on raspberry pi has dep on libopencv_core - echo "Installing libopencv-core4.6 on aarch64" - apt-get install --yes libopencv-core4.6 - fi -fi - echo "Installing additional math packages" apt-get install --yes libcholmod3 liblapack3 libsuitesparseconfig5 From d0cd5791d6806824a40511cca720bbd1f20fe6e4 Mon Sep 17 00:00:00 2001 From: Craftzman7 Date: Sun, 19 May 2024 17:35:40 -0700 Subject: [PATCH 22/59] Disable Arm32 Builds (#1325) Disables Arm32 builds and removes mention of the build option in the README. --- scripts/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 5289563..4727155 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -50,14 +50,14 @@ ARCH_NAME="" if [ "$ARCH" = "aarch64" ]; then ARCH_NAME="linuxarm64" elif [ "$ARCH" = "armv7l" ]; then - ARCH_NAME="linuxarm32" + echo "ARM32 is not supported by PhotonVision. Exiting." + exit 1 elif [ "$ARCH" = "x86_64" ]; then ARCH_NAME="linuxx64" else if [ "$#" -ne 1 ]; then echo "Can't determine current arch; please provide it (one of):" echo "" - echo "- linuxarm32 (32-bit Linux ARM)" echo "- linuxarm64 (64-bit Linux ARM)" echo "- linuxx64 (64-bit Linux)" exit 1 From cad8925607a683819ccaa91f34cc9ad62f479f31 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Tue, 13 Aug 2024 09:54:26 -0500 Subject: [PATCH 23/59] Update install.sh for OPi5 Ubuntu 24.04 (#1390) This updates the install script to work correctly on Ubuntu 24.04 versions of the Orange Pi 5 images. Changes include: - installing libatomic1 - disabling networkd-wait-online if using Network Manager - using systemctl instead of service to detect if photonvision is running - detecting if this is a RK3588 cpu and enabling all cores --- scripts/install.sh | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 4727155..ba9cb69 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -102,9 +102,14 @@ else echo 'GOVERNOR=performance' > /etc/default/cpufrequtils fi +echo "Installing libatomic" +apt-get install --yes libatomic1 +echo "libatomic installation complete." + if [[ "$INSTALL_NETWORK_MANAGER" == "true" ]]; then echo "Installing network-manager..." - apt-get install --yes network-manager + apt-get install --yes network-manager net-tools + systemctl disable systemd-networkd-wait-online.service cat > /etc/netplan/00-default-nm-renderer.yaml < Date: Fri, 11 Oct 2024 11:25:37 -0700 Subject: [PATCH 24/59] Add debug function to respect quiet --- scripts/install.sh | 70 ++++++++++++++++++++++++++-------------------- 1 file changed, 39 insertions(+), 31 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index ba9cb69..7a6220a 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,5 +1,13 @@ #!/bin/bash +debug() { + if [ -z "$QUIET" ] ; then + for arg in "$@"; do + echo "$arg" + done + fi +} + package_is_installed(){ dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "ok installed" } @@ -62,84 +70,84 @@ else echo "- linuxx64 (64-bit Linux)" exit 1 else - echo "Can't detect arch (got $ARCH) -- using user-provided $1" + debug "Can't detect arch (got $ARCH) -- using user-provided $1" ARCH_NAME=$1 fi fi -echo "This is the installation script for PhotonVision." -echo "Installing for platform $ARCH_NAME" +debug "This is the installation script for PhotonVision." +debug "Installing for platform $ARCH_NAME" DISTRO=$(lsb_release -is) if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET" && -z "$DISABLE_NETWORKING" ]]; then - echo "" - echo "Photonvision uses NetworkManager to control networking on your device." + debug "" + debug "Photonvision uses NetworkManager to control networking on your device." read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then INSTALL_NETWORK_MANAGER="true" fi fi -echo "Update package list" +debug "Update package list" apt-get update -echo "Installing curl..." +debug "Installing curl..." apt-get install --yes curl -echo "curl installation complete." +debug "curl installation complete." -echo "Installing avahi-daemon..." +debug "Installing avahi-daemon..." apt-get install --yes avahi-daemon -echo "avahi-daemon installation complete." +debug "avahi-daemon installation complete." -echo "Installing cpufrequtils..." +debug "Installing cpufrequtils..." apt-get install --yes cpufrequtils -echo "cpufrequtils installation complete." +debug "cpufrequtils installation complete." -echo "Setting cpufrequtils to performance mode" +debug "Setting cpufrequtils to performance mode" if [ -f /etc/default/cpufrequtils ]; then sed -i -e 's/^#\?GOVERNOR=.*$/GOVERNOR=performance/' /etc/default/cpufrequtils else echo 'GOVERNOR=performance' > /etc/default/cpufrequtils fi -echo "Installing libatomic" +debug "Installing libatomic" apt-get install --yes libatomic1 -echo "libatomic installation complete." +debug "libatomic installation complete." if [[ "$INSTALL_NETWORK_MANAGER" == "true" ]]; then - echo "Installing network-manager..." + debug "Installing network-manager..." apt-get install --yes network-manager net-tools systemctl disable systemd-networkd-wait-online.service cat > /etc/netplan/00-default-nm-renderer.yaml < Date: Fri, 11 Oct 2024 11:36:48 -0700 Subject: [PATCH 25/59] Add die function to simplify error returns --- scripts/install.sh | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 7a6220a..565e514 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,5 +1,12 @@ #!/bin/bash +die() { + for arg in "$@"; do + echo "$arg" 1>&2 + done + exit 1 +} + debug() { if [ -z "$QUIET" ] ; then for arg in "$@"; do @@ -40,17 +47,15 @@ while getopts ":hmnq" name; do q) QUIET="true" ;; \?) - echo "Error: Invalid option -- '$OPTARG'" - echo "Try './install.sh -h' for more information." - exit 1 + die "Error: Invalid option -- '$OPTARG'" \ + "Try './install.sh -h' for more information." esac done shift $(($OPTIND -1)) if [ "$(id -u)" != "0" ]; then - echo "This script must be run as root" 1>&2 - exit 1 + die "This script must be run as root" fi ARCH=$(uname -m) @@ -58,17 +63,15 @@ ARCH_NAME="" if [ "$ARCH" = "aarch64" ]; then ARCH_NAME="linuxarm64" elif [ "$ARCH" = "armv7l" ]; then - echo "ARM32 is not supported by PhotonVision. Exiting." - exit 1 + die "ARM32 is not supported by PhotonVision. Exiting." elif [ "$ARCH" = "x86_64" ]; then ARCH_NAME="linuxx64" else if [ "$#" -ne 1 ]; then - echo "Can't determine current arch; please provide it (one of):" - echo "" - echo "- linuxarm64 (64-bit Linux ARM)" - echo "- linuxx64 (64-bit Linux)" - exit 1 + die "Can't determine current arch; please provide it (one of):" \ + "" \ + "- linuxarm64 (64-bit Linux ARM)" \ + "- linuxx64 (64-bit Linux)" else debug "Can't detect arch (got $ARCH) -- using user-provided $1" ARCH_NAME=$1 From 3fd59d30a2da2c19e12df8aec6ec9969cf2c1bb8 Mon Sep 17 00:00:00 2001 From: EmDash00 Date: Fri, 11 Oct 2024 11:40:26 -0700 Subject: [PATCH 26/59] Edit NetworkManager install debug to be clearer --- scripts/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 565e514..09db4de 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -118,8 +118,10 @@ apt-get install --yes libatomic1 debug "libatomic installation complete." if [[ "$INSTALL_NETWORK_MANAGER" == "true" ]]; then - debug "Installing network-manager..." + debug "NetworkManager installation specified. Installing components..." apt-get install --yes network-manager net-tools + + debug "Configuring..." systemctl disable systemd-networkd-wait-online.service cat > /etc/netplan/00-default-nm-renderer.yaml < Date: Fri, 11 Oct 2024 11:40:44 -0700 Subject: [PATCH 27/59] Edit debug output for apt-get update --- scripts/install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 09db4de..8b291f6 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -91,8 +91,9 @@ if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET fi fi -debug "Update package list" +debug "Updating package list..." apt-get update +debug "Updated package list." debug "Installing curl..." apt-get install --yes curl From 36d76d3c820bf85fbaae83d9b327c246e684a63c Mon Sep 17 00:00:00 2001 From: EmDash00 Date: Fri, 11 Oct 2024 11:42:20 -0700 Subject: [PATCH 28/59] Simplify installation by skipping installed packages --- scripts/install.sh | 55 ++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 31 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 8b291f6..75c4e24 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -19,6 +19,17 @@ package_is_installed(){ dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "ok installed" } +install_if_missing() { + if package_is_installed "$1" ; then + debug "Found existing $1. Skipping..." + return + fi + + debug "Installing $1..." + apt-get install --yes $1 + debug "$1 installation complete." +} + help() { echo "This script installs Photonvision." echo "It must be run as root." @@ -95,17 +106,13 @@ debug "Updating package list..." apt-get update debug "Updated package list." -debug "Installing curl..." -apt-get install --yes curl -debug "curl installation complete." - -debug "Installing avahi-daemon..." -apt-get install --yes avahi-daemon -debug "avahi-daemon installation complete." - -debug "Installing cpufrequtils..." -apt-get install --yes cpufrequtils -debug "cpufrequtils installation complete." +install_if_missing curl +install_if_missing avahi-daemon +install_if_missing cpufrequtils +install_if_missing libatomic1 +install_if_missing v4l-utils +install_if_missing sqlite3 +install_if_missing openjdk-17-jre-headless debug "Setting cpufrequtils to performance mode" if [ -f /etc/default/cpufrequtils ]; then @@ -114,13 +121,10 @@ else echo 'GOVERNOR=performance' > /etc/default/cpufrequtils fi -debug "Installing libatomic" -apt-get install --yes libatomic1 -debug "libatomic installation complete." - if [[ "$INSTALL_NETWORK_MANAGER" == "true" ]]; then debug "NetworkManager installation specified. Installing components..." - apt-get install --yes network-manager net-tools + install_if_missing network-manager + install_if_missing net-tools debug "Configuring..." systemctl disable systemd-networkd-wait-online.service @@ -131,27 +135,16 @@ EOF debug "network-manager installation complete." fi -debug "Installing the JRE..." -if ! package_is_installed openjdk-17-jre-headless -then - apt-get update - apt-get install --yes openjdk-17-jre-headless -fi -debug "JRE installation complete." - +debug "" debug "Installing additional math packages" if [[ "$DISTRO" = "Ubuntu" && -z $(apt-cache search libcholmod3) ]]; then debug "Adding jammy to list of apt sources" add-apt-repository -y -S 'deb http://ports.ubuntu.com/ubuntu-ports jammy main universe' fi -apt-get install --yes libcholmod3 liblapack3 libsuitesparseconfig5 - -debug "Installing v4l-utils..." -apt-get install --yes v4l-utils -debug "v4l-utils installation complete." -debug "Installing sqlite3" -apt-get install --yes sqlite3 +install_if_missing libcholmod3 +install_if_missing liblapack3 +install_if_missing libsuitesparseconfig5 debug "Downloading latest stable release of PhotonVision..." mkdir -p /opt/photonvision From 80cc81eb89654ba511a3f206cfe4257db5ada522 Mon Sep 17 00:00:00 2001 From: EmDash00 Date: Fri, 11 Oct 2024 12:00:14 -0700 Subject: [PATCH 29/59] Add option for specifying architecture formally --- scripts/install.sh | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 75c4e24..25c4e04 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -37,6 +37,7 @@ help() { echo "Syntax: sudo ./install.sh [-h|m|n|q]" echo " options:" echo " -h Display this help message." + echo " -a Install PhotonVision for the specified architecture." echo " -m Install and configure NetworkManager (Ubuntu only)." echo " -n Disable networking. This will also prevent installation of NetworkManager." echo " -q Silent install, automatically accepts all defaults. For non-interactive use." @@ -45,12 +46,14 @@ help() { INSTALL_NETWORK_MANAGER="false" -while getopts ":hmnq" name; do +while getopts "ha:mnq" name; do case "$name" in h) help exit 0 ;; + a) ARCH=$OPTARG + ;; m) INSTALL_NETWORK_MANAGER="true" ;; n) DISABLE_NETWORKING="true" @@ -69,7 +72,12 @@ if [ "$(id -u)" != "0" ]; then die "This script must be run as root" fi -ARCH=$(uname -m) +if [[ -z "$ARCH" ]]; then + debug "Arch was not specified. Inferring..." + ARCH=$(uname -m) + debug "Arch was inferred to be $ARCH" +fi + ARCH_NAME="" if [ "$ARCH" = "aarch64" ]; then ARCH_NAME="linuxarm64" @@ -78,19 +86,13 @@ elif [ "$ARCH" = "armv7l" ]; then elif [ "$ARCH" = "x86_64" ]; then ARCH_NAME="linuxx64" else - if [ "$#" -ne 1 ]; then - die "Can't determine current arch; please provide it (one of):" \ - "" \ - "- linuxarm64 (64-bit Linux ARM)" \ - "- linuxx64 (64-bit Linux)" - else - debug "Can't detect arch (got $ARCH) -- using user-provided $1" - ARCH_NAME=$1 - fi + die "Unsupported or unknown architecture: '$ARCH'." \ + "Please specify your architecture using: ./install.sh -a " \ + "Run './install.sh -h' for more information." fi debug "This is the installation script for PhotonVision." -debug "Installing for platform $ARCH_NAME" +debug "Installing for platform $ARCH" DISTRO=$(lsb_release -is) if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET" && -z "$DISABLE_NETWORKING" ]]; then From 9d20d6678768b1cbc55c06b7bef72d7c28763bd2 Mon Sep 17 00:00:00 2001 From: EmDash00 Date: Fri, 11 Oct 2024 12:09:21 -0700 Subject: [PATCH 30/59] Support long options --- scripts/install.sh | 70 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 21 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 25c4e04..f503ffe 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -1,5 +1,12 @@ #!/bin/bash +needs_arg() { + if [ -z "$OPTARG" ]; then + die "Argument is required for --$OPT option" \ + "See './install.sh -h' for more information." + fi; +} + die() { for arg in "$@"; do echo "$arg" 1>&2 @@ -31,38 +38,59 @@ install_if_missing() { } help() { - echo "This script installs Photonvision." - echo "It must be run as root." - echo - echo "Syntax: sudo ./install.sh [-h|m|n|q]" - echo " options:" - echo " -h Display this help message." - echo " -a Install PhotonVision for the specified architecture." - echo " -m Install and configure NetworkManager (Ubuntu only)." - echo " -n Disable networking. This will also prevent installation of NetworkManager." - echo " -q Silent install, automatically accepts all defaults. For non-interactive use." - echo + cat << EOF +This script installs Photonvision. +It must be run as root. + +Syntax: sudo ./install.sh [options] + options: + -h, --help + Display this help message. + -a , --arch= + Install PhotonVision for the specified architecture. + Supported values: aarch64, x86_64 + -m, --install-nm + Install and configure NetworkManager (Ubuntu only). + -n, --no-networking + Disable networking. This will also prevent installation of + NetworkManager. + -q, --quiet + Silent install, automatically accepts all defaults. For + non-interactive use. + +EOF } INSTALL_NETWORK_MANAGER="false" -while getopts "ha:mnq" name; do - case "$name" in - h) +while getopts "ha:mnq-:" OPT; do + if [ "$OPT" = "-" ]; then + OPT="${OPTARG%%=*}" # extract long option name + OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty) + OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=` + fi + + case "$OPT" in + h | help) help exit 0 ;; - a) ARCH=$OPTARG + a | arch) needs_arg; ARCH=$OPTARG + ;; + m | install-nm) INSTALL_NETWORK_MANAGER="true" + ;; + n | no-networking) DISABLE_NETWORKING="true" ;; - m) INSTALL_NETWORK_MANAGER="true" + q | quiet) QUIET="true" ;; - n) DISABLE_NETWORKING="true" + \?) # Handle invalid short options + die "Error: Invalid option -$OPTARG" \ + "See './install.sh -h' for more information." ;; - q) QUIET="true" + * ) # Handle invalid long options + die "Error: Invalid option --$OPT" \ + "See './install.sh -h' for more information." ;; - \?) - die "Error: Invalid option -- '$OPTARG'" \ - "Try './install.sh -h' for more information." esac done From d699308a956e217de3a900f9fcf4fcc708d2caf5 Mon Sep 17 00:00:00 2001 From: EmDash00 Date: Fri, 11 Oct 2024 12:28:41 -0700 Subject: [PATCH 31/59] Make -m more sensible --- scripts/install.sh | 40 +++++++++++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index f503ffe..958f025 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -49,19 +49,24 @@ Syntax: sudo ./install.sh [options] -a , --arch= Install PhotonVision for the specified architecture. Supported values: aarch64, x86_64 - -m, --install-nm - Install and configure NetworkManager (Ubuntu only). + -m [option], --install-nm=[option] + Whether or not to install NetworkManager. Only used on + Ubuntu, and ignored for all other distros. + Supported options are: "yes", "no", and "ask". + "ask" prompts the user for installation of NetworkManager. + If not specified, will fall back to "ask". + If specified, "yes" is the default option. -n, --no-networking Disable networking. This will also prevent installation of - NetworkManager. + NetworkManager (ignoring -m,--install-nm). -q, --quiet Silent install, automatically accepts all defaults. For - non-interactive use. + non-interactive use. Forces --install-nm="no". EOF } -INSTALL_NETWORK_MANAGER="false" +INSTALL_NETWORK_MANAGER="ask" while getopts "ha:mnq-:" OPT; do if [ "$OPT" = "-" ]; then @@ -77,7 +82,19 @@ while getopts "ha:mnq-:" OPT; do ;; a | arch) needs_arg; ARCH=$OPTARG ;; - m | install-nm) INSTALL_NETWORK_MANAGER="true" + m | install-nm) + INSTALL_NETWORK_MANAGER="$(echo ${OPTARG:-'yes'} | tr '[:upper:]' '[:lower:]')" + case "$INSTALL_NETWORK_MANAGER" in + yes) + ;; + no) + ;; + ask) + ;; + * ) + die "Valid options for -m, --install-nm are: 'yes', 'no', and 'ask'" + ;; + esac ;; n | no-networking) DISABLE_NETWORKING="true" ;; @@ -123,12 +140,17 @@ debug "This is the installation script for PhotonVision." debug "Installing for platform $ARCH" DISTRO=$(lsb_release -is) -if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET" && -z "$DISABLE_NETWORKING" ]]; then + +if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then + INSTALL_NETWORK_MANAGER="no" +fi + +if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then debug "" debug "Photonvision uses NetworkManager to control networking on your device." read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then - INSTALL_NETWORK_MANAGER="true" + INSTALL_NETWORK_MANAGER="yes" fi fi @@ -151,7 +173,7 @@ else echo 'GOVERNOR=performance' > /etc/default/cpufrequtils fi -if [[ "$INSTALL_NETWORK_MANAGER" == "true" ]]; then +if [[ "$INSTALL_NETWORK_MANAGER" == "yes" ]]; then debug "NetworkManager installation specified. Installing components..." install_if_missing network-manager install_if_missing net-tools From dbc67ec3dc67a106f09dd993256b68ea0d1b881a Mon Sep 17 00:00:00 2001 From: EmDash00 Date: Fri, 11 Oct 2024 12:30:19 -0700 Subject: [PATCH 32/59] Add -l,--list-versions --- scripts/install.sh | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/scripts/install.sh b/scripts/install.sh index 958f025..614e7c1 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -37,6 +37,28 @@ install_if_missing() { debug "$1 installation complete." } +get_photonvision_releases() { + if ! command -v curl > /dev/null 2>&1 ; then + die "./install --list-versions requires curl and it is not installed." + fi + + if [ -z "$PHOTON_VISION_RELEASES" ] ; then + PHOTON_VISION_RELEASES="$(curl -sk https://api.github.com/repos/photonvision/photonvision/releases)" + fi + + echo "$PHOTON_VISION_RELEASES" +} + +get_versions() { + if [ -z "$PHOTON_VISION_VERSIONS" ] ; then + PHOTON_VISION_VERSIONS=$(get_photonvision_releases | \ + sed -En 's/\"tag_name\": \"v([0-9]+\.[0-9]+\.[0-9]+)(-(beta|alpha)(-[0-9])?(\.[0-9]+)?)?\",/\1\2/p' | \ + sed 's/^[[:space:]]*//') + fi + + echo "$PHOTON_VISION_VERSIONS" +} + help() { cat << EOF This script installs Photonvision. @@ -46,6 +68,8 @@ Syntax: sudo ./install.sh [options] options: -h, --help Display this help message. + -l, --list-versions + Lists all available versions of PhotonVision. -a , --arch= Install PhotonVision for the specified architecture. Supported values: aarch64, x86_64 @@ -68,7 +92,7 @@ EOF INSTALL_NETWORK_MANAGER="ask" -while getopts "ha:mnq-:" OPT; do +while getopts "hla:mnq-:" OPT; do if [ "$OPT" = "-" ]; then OPT="${OPTARG%%=*}" # extract long option name OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty) @@ -80,6 +104,10 @@ while getopts "ha:mnq-:" OPT; do help exit 0 ;; + l | list-versions) + get_versions + exit 0 + ;; a | arch) needs_arg; ARCH=$OPTARG ;; m | install-nm) From b1cc2df830fd28226cbe215e38d7739ea9e6d74a Mon Sep 17 00:00:00 2001 From: EmDash00 Date: Fri, 11 Oct 2024 12:35:12 -0700 Subject: [PATCH 33/59] Add -v,--version --- scripts/install.sh | 52 ++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 48 insertions(+), 4 deletions(-) diff --git a/scripts/install.sh b/scripts/install.sh index 614e7c1..a796afe 100755 --- a/scripts/install.sh +++ b/scripts/install.sh @@ -59,6 +59,28 @@ get_versions() { echo "$PHOTON_VISION_VERSIONS" } +is_version_available() { + local target_version="$1" + + # latest is a special case + if [ "$target_version" = "latest" ]; then + return + fi + + # Check if the version is present + if ! echo "$(get_versions)" | grep -qFx "$target_version"; then + return 1 + fi + + # Check if multiple lines are match. You can only match 1. + local line_count="$(echo "$versions" | grep -cFx "$target_string")" + if [ $line_count -gt 1 ] ; then + return 1 + fi + + return 0 +} + help() { cat << EOF This script installs Photonvision. @@ -70,6 +92,10 @@ Syntax: sudo ./install.sh [options] Display this help message. -l, --list-versions Lists all available versions of PhotonVision. + -v , --version= + Specifies which version of PhotonVision to install. + If not specified, the latest stable release is installed. + Ignores leading 'v's. -a , --arch= Install PhotonVision for the specified architecture. Supported values: aarch64, x86_64 @@ -92,7 +118,7 @@ EOF INSTALL_NETWORK_MANAGER="ask" -while getopts "hla:mnq-:" OPT; do +while getopts "hlv:a:mnq-:" OPT; do if [ "$OPT" = "-" ]; then OPT="${OPTARG%%=*}" # extract long option name OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty) @@ -108,6 +134,10 @@ while getopts "hla:mnq-:" OPT; do get_versions exit 0 ;; + v | version) + needs_arg + VERSION=$(echo "$OPTARG" | sed 's/^v//') # drop leading 'v's + ;; a | arch) needs_arg; ARCH=$OPTARG ;; m | install-nm) @@ -226,15 +256,29 @@ install_if_missing libcholmod3 install_if_missing liblapack3 install_if_missing libsuitesparseconfig5 -debug "Downloading latest stable release of PhotonVision..." +debug "" + +if ! is_version_available "$VERSION" ; then + die "PhotonVision v$VERSION is not available" \ + "See ./install --list-versions for a complete list of available versions." +fi + +if [ "$VERSION" = "latest" ] ; then + RELEASE_URL="https://api.github.com/repos/photonvision/photonvision/releases/latest" + debug "Downloading PhotonVision (latest)..." +else + RELEASE_URL="https://api.github.com/repos/photonvision/photonvision/releases/tags/v$VERSION" + debug "Downloading PhotonVision (v$VERSION)..." +fi + mkdir -p /opt/photonvision cd /opt/photonvision -curl -sk https://api.github.com/repos/photonvision/photonvision/releases/latest | +curl -sk "$RELEASE_URL" | grep "browser_download_url.*$ARCH_NAME.jar" | cut -d : -f 2,3 | tr -d '"' | wget -qi - -O photonvision.jar -debug "Downloaded latest stable release of PhotonVision." +debug "Downloaded PhotonVision." debug "Creating the PhotonVision systemd service..." From 578b3e964d95bc30d62fe7405b0be91845ba7c0f Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 12 Oct 2024 18:48:42 -0500 Subject: [PATCH 34/59] install.sh in wrong place --- scripts/install.sh | 334 --------------------------------------------- 1 file changed, 334 deletions(-) delete mode 100755 scripts/install.sh diff --git a/scripts/install.sh b/scripts/install.sh deleted file mode 100755 index a796afe..0000000 --- a/scripts/install.sh +++ /dev/null @@ -1,334 +0,0 @@ -#!/bin/bash - -needs_arg() { - if [ -z "$OPTARG" ]; then - die "Argument is required for --$OPT option" \ - "See './install.sh -h' for more information." - fi; -} - -die() { - for arg in "$@"; do - echo "$arg" 1>&2 - done - exit 1 -} - -debug() { - if [ -z "$QUIET" ] ; then - for arg in "$@"; do - echo "$arg" - done - fi -} - -package_is_installed(){ - dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "ok installed" -} - -install_if_missing() { - if package_is_installed "$1" ; then - debug "Found existing $1. Skipping..." - return - fi - - debug "Installing $1..." - apt-get install --yes $1 - debug "$1 installation complete." -} - -get_photonvision_releases() { - if ! command -v curl > /dev/null 2>&1 ; then - die "./install --list-versions requires curl and it is not installed." - fi - - if [ -z "$PHOTON_VISION_RELEASES" ] ; then - PHOTON_VISION_RELEASES="$(curl -sk https://api.github.com/repos/photonvision/photonvision/releases)" - fi - - echo "$PHOTON_VISION_RELEASES" -} - -get_versions() { - if [ -z "$PHOTON_VISION_VERSIONS" ] ; then - PHOTON_VISION_VERSIONS=$(get_photonvision_releases | \ - sed -En 's/\"tag_name\": \"v([0-9]+\.[0-9]+\.[0-9]+)(-(beta|alpha)(-[0-9])?(\.[0-9]+)?)?\",/\1\2/p' | \ - sed 's/^[[:space:]]*//') - fi - - echo "$PHOTON_VISION_VERSIONS" -} - -is_version_available() { - local target_version="$1" - - # latest is a special case - if [ "$target_version" = "latest" ]; then - return - fi - - # Check if the version is present - if ! echo "$(get_versions)" | grep -qFx "$target_version"; then - return 1 - fi - - # Check if multiple lines are match. You can only match 1. - local line_count="$(echo "$versions" | grep -cFx "$target_string")" - if [ $line_count -gt 1 ] ; then - return 1 - fi - - return 0 -} - -help() { - cat << EOF -This script installs Photonvision. -It must be run as root. - -Syntax: sudo ./install.sh [options] - options: - -h, --help - Display this help message. - -l, --list-versions - Lists all available versions of PhotonVision. - -v , --version= - Specifies which version of PhotonVision to install. - If not specified, the latest stable release is installed. - Ignores leading 'v's. - -a , --arch= - Install PhotonVision for the specified architecture. - Supported values: aarch64, x86_64 - -m [option], --install-nm=[option] - Whether or not to install NetworkManager. Only used on - Ubuntu, and ignored for all other distros. - Supported options are: "yes", "no", and "ask". - "ask" prompts the user for installation of NetworkManager. - If not specified, will fall back to "ask". - If specified, "yes" is the default option. - -n, --no-networking - Disable networking. This will also prevent installation of - NetworkManager (ignoring -m,--install-nm). - -q, --quiet - Silent install, automatically accepts all defaults. For - non-interactive use. Forces --install-nm="no". - -EOF -} - -INSTALL_NETWORK_MANAGER="ask" - -while getopts "hlv:a:mnq-:" OPT; do - if [ "$OPT" = "-" ]; then - OPT="${OPTARG%%=*}" # extract long option name - OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty) - OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=` - fi - - case "$OPT" in - h | help) - help - exit 0 - ;; - l | list-versions) - get_versions - exit 0 - ;; - v | version) - needs_arg - VERSION=$(echo "$OPTARG" | sed 's/^v//') # drop leading 'v's - ;; - a | arch) needs_arg; ARCH=$OPTARG - ;; - m | install-nm) - INSTALL_NETWORK_MANAGER="$(echo ${OPTARG:-'yes'} | tr '[:upper:]' '[:lower:]')" - case "$INSTALL_NETWORK_MANAGER" in - yes) - ;; - no) - ;; - ask) - ;; - * ) - die "Valid options for -m, --install-nm are: 'yes', 'no', and 'ask'" - ;; - esac - ;; - n | no-networking) DISABLE_NETWORKING="true" - ;; - q | quiet) QUIET="true" - ;; - \?) # Handle invalid short options - die "Error: Invalid option -$OPTARG" \ - "See './install.sh -h' for more information." - ;; - * ) # Handle invalid long options - die "Error: Invalid option --$OPT" \ - "See './install.sh -h' for more information." - ;; - esac -done - -shift $(($OPTIND -1)) - -if [ "$(id -u)" != "0" ]; then - die "This script must be run as root" -fi - -if [[ -z "$ARCH" ]]; then - debug "Arch was not specified. Inferring..." - ARCH=$(uname -m) - debug "Arch was inferred to be $ARCH" -fi - -ARCH_NAME="" -if [ "$ARCH" = "aarch64" ]; then - ARCH_NAME="linuxarm64" -elif [ "$ARCH" = "armv7l" ]; then - die "ARM32 is not supported by PhotonVision. Exiting." -elif [ "$ARCH" = "x86_64" ]; then - ARCH_NAME="linuxx64" -else - die "Unsupported or unknown architecture: '$ARCH'." \ - "Please specify your architecture using: ./install.sh -a " \ - "Run './install.sh -h' for more information." -fi - -debug "This is the installation script for PhotonVision." -debug "Installing for platform $ARCH" - -DISTRO=$(lsb_release -is) - -if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then - INSTALL_NETWORK_MANAGER="no" -fi - -if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then - debug "" - debug "Photonvision uses NetworkManager to control networking on your device." - read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response - if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then - INSTALL_NETWORK_MANAGER="yes" - fi -fi - -debug "Updating package list..." -apt-get update -debug "Updated package list." - -install_if_missing curl -install_if_missing avahi-daemon -install_if_missing cpufrequtils -install_if_missing libatomic1 -install_if_missing v4l-utils -install_if_missing sqlite3 -install_if_missing openjdk-17-jre-headless - -debug "Setting cpufrequtils to performance mode" -if [ -f /etc/default/cpufrequtils ]; then - sed -i -e 's/^#\?GOVERNOR=.*$/GOVERNOR=performance/' /etc/default/cpufrequtils -else - echo 'GOVERNOR=performance' > /etc/default/cpufrequtils -fi - -if [[ "$INSTALL_NETWORK_MANAGER" == "yes" ]]; then - debug "NetworkManager installation specified. Installing components..." - install_if_missing network-manager - install_if_missing net-tools - - debug "Configuring..." - systemctl disable systemd-networkd-wait-online.service - cat > /etc/netplan/00-default-nm-renderer.yaml < /lib/systemd/system/photonvision.service < Date: Sat, 12 Oct 2024 21:21:34 -0500 Subject: [PATCH 35/59] copied emdash00 improvements --- install.sh | 305 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 218 insertions(+), 87 deletions(-) diff --git a/install.sh b/install.sh index 43b9eee..a796afe 100755 --- a/install.sh +++ b/install.sh @@ -1,159 +1,290 @@ #!/bin/bash +needs_arg() { + if [ -z "$OPTARG" ]; then + die "Argument is required for --$OPT option" \ + "See './install.sh -h' for more information." + fi; +} + +die() { + for arg in "$@"; do + echo "$arg" 1>&2 + done + exit 1 +} + +debug() { + if [ -z "$QUIET" ] ; then + for arg in "$@"; do + echo "$arg" + done + fi +} + package_is_installed(){ dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -q "ok installed" } +install_if_missing() { + if package_is_installed "$1" ; then + debug "Found existing $1. Skipping..." + return + fi + + debug "Installing $1..." + apt-get install --yes $1 + debug "$1 installation complete." +} + +get_photonvision_releases() { + if ! command -v curl > /dev/null 2>&1 ; then + die "./install --list-versions requires curl and it is not installed." + fi + + if [ -z "$PHOTON_VISION_RELEASES" ] ; then + PHOTON_VISION_RELEASES="$(curl -sk https://api.github.com/repos/photonvision/photonvision/releases)" + fi + + echo "$PHOTON_VISION_RELEASES" +} + +get_versions() { + if [ -z "$PHOTON_VISION_VERSIONS" ] ; then + PHOTON_VISION_VERSIONS=$(get_photonvision_releases | \ + sed -En 's/\"tag_name\": \"v([0-9]+\.[0-9]+\.[0-9]+)(-(beta|alpha)(-[0-9])?(\.[0-9]+)?)?\",/\1\2/p' | \ + sed 's/^[[:space:]]*//') + fi + + echo "$PHOTON_VISION_VERSIONS" +} + +is_version_available() { + local target_version="$1" + + # latest is a special case + if [ "$target_version" = "latest" ]; then + return + fi + + # Check if the version is present + if ! echo "$(get_versions)" | grep -qFx "$target_version"; then + return 1 + fi + + # Check if multiple lines are match. You can only match 1. + local line_count="$(echo "$versions" | grep -cFx "$target_string")" + if [ $line_count -gt 1 ] ; then + return 1 + fi + + return 0 +} + help() { - echo "This script installs Photonvision." - echo "It must be run as root." - echo - echo "Syntax: sudo ./install.sh [-h|m|n|q]" - echo " options:" - echo " -h Display this help message." - echo " -m Install and configure NetworkManager (Ubuntu only)." - echo " -n Disable networking. This will also prevent installation of NetworkManager." - echo " -q Silent install, automatically accepts all defaults. For non-interactive use." - echo + cat << EOF +This script installs Photonvision. +It must be run as root. + +Syntax: sudo ./install.sh [options] + options: + -h, --help + Display this help message. + -l, --list-versions + Lists all available versions of PhotonVision. + -v , --version= + Specifies which version of PhotonVision to install. + If not specified, the latest stable release is installed. + Ignores leading 'v's. + -a , --arch= + Install PhotonVision for the specified architecture. + Supported values: aarch64, x86_64 + -m [option], --install-nm=[option] + Whether or not to install NetworkManager. Only used on + Ubuntu, and ignored for all other distros. + Supported options are: "yes", "no", and "ask". + "ask" prompts the user for installation of NetworkManager. + If not specified, will fall back to "ask". + If specified, "yes" is the default option. + -n, --no-networking + Disable networking. This will also prevent installation of + NetworkManager (ignoring -m,--install-nm). + -q, --quiet + Silent install, automatically accepts all defaults. For + non-interactive use. Forces --install-nm="no". + +EOF } -INSTALL_NETWORK_MANAGER="false" +INSTALL_NETWORK_MANAGER="ask" -while getopts ":hmnq" name; do - case "$name" in - h) +while getopts "hlv:a:mnq-:" OPT; do + if [ "$OPT" = "-" ]; then + OPT="${OPTARG%%=*}" # extract long option name + OPTARG="${OPTARG#"$OPT"}" # extract long option argument (may be empty) + OPTARG="${OPTARG#=}" # if long option argument, remove assigning `=` + fi + + case "$OPT" in + h | help) help exit 0 ;; - m) INSTALL_NETWORK_MANAGER="true" + l | list-versions) + get_versions + exit 0 + ;; + v | version) + needs_arg + VERSION=$(echo "$OPTARG" | sed 's/^v//') # drop leading 'v's + ;; + a | arch) needs_arg; ARCH=$OPTARG + ;; + m | install-nm) + INSTALL_NETWORK_MANAGER="$(echo ${OPTARG:-'yes'} | tr '[:upper:]' '[:lower:]')" + case "$INSTALL_NETWORK_MANAGER" in + yes) + ;; + no) + ;; + ask) + ;; + * ) + die "Valid options for -m, --install-nm are: 'yes', 'no', and 'ask'" + ;; + esac + ;; + n | no-networking) DISABLE_NETWORKING="true" ;; - n) DISABLE_NETWORKING="true" + q | quiet) QUIET="true" ;; - q) QUIET="true" + \?) # Handle invalid short options + die "Error: Invalid option -$OPTARG" \ + "See './install.sh -h' for more information." + ;; + * ) # Handle invalid long options + die "Error: Invalid option --$OPT" \ + "See './install.sh -h' for more information." ;; - \?) - echo "Error: Invalid option -- '$OPTARG'" - echo "Try './install.sh -h' for more information." - exit 1 esac done shift $(($OPTIND -1)) if [ "$(id -u)" != "0" ]; then - echo "This script must be run as root" 1>&2 - exit 1 + die "This script must be run as root" +fi + +if [[ -z "$ARCH" ]]; then + debug "Arch was not specified. Inferring..." + ARCH=$(uname -m) + debug "Arch was inferred to be $ARCH" fi -ARCH=$(uname -m) ARCH_NAME="" if [ "$ARCH" = "aarch64" ]; then ARCH_NAME="linuxarm64" elif [ "$ARCH" = "armv7l" ]; then - echo "ARM32 is not supported by PhotonVision. Exiting." - exit 1 + die "ARM32 is not supported by PhotonVision. Exiting." elif [ "$ARCH" = "x86_64" ]; then ARCH_NAME="linuxx64" else - if [ "$#" -ne 1 ]; then - echo "Can't determine current arch; please provide it (one of):" - echo "" - echo "- linuxarm64 (64-bit Linux ARM)" - echo "- linuxx64 (64-bit Linux)" - exit 1 - else - echo "Can't detect arch (got $ARCH) -- using user-provided $1" - ARCH_NAME=$1 - fi + die "Unsupported or unknown architecture: '$ARCH'." \ + "Please specify your architecture using: ./install.sh -a " \ + "Run './install.sh -h' for more information." fi -echo "This is the installation script for PhotonVision." -echo "Installing for platform $ARCH_NAME" +debug "This is the installation script for PhotonVision." +debug "Installing for platform $ARCH" DISTRO=$(lsb_release -is) -if [[ "$DISTRO" = "Ubuntu" && "$INSTALL_NETWORK_MANAGER" != "true" && -z "$QUIET" && -z "$DISABLE_NETWORKING" ]]; then - echo "" - echo "Photonvision uses NetworkManager to control networking on your device." + +if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then + INSTALL_NETWORK_MANAGER="no" +fi + +if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then + debug "" + debug "Photonvision uses NetworkManager to control networking on your device." read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then - INSTALL_NETWORK_MANAGER="true" + INSTALL_NETWORK_MANAGER="yes" fi fi -echo "Update package list" +debug "Updating package list..." apt-get update +debug "Updated package list." -echo "Installing curl..." -apt-get install --yes curl -echo "curl installation complete." - -echo "Installing avahi-daemon..." -apt-get install --yes avahi-daemon -echo "avahi-daemon installation complete." - -echo "Installing cpufrequtils..." -apt-get install --yes cpufrequtils -echo "cpufrequtils installation complete." +install_if_missing curl +install_if_missing avahi-daemon +install_if_missing cpufrequtils +install_if_missing libatomic1 +install_if_missing v4l-utils +install_if_missing sqlite3 +install_if_missing openjdk-17-jre-headless -echo "Setting cpufrequtils to performance mode" +debug "Setting cpufrequtils to performance mode" if [ -f /etc/default/cpufrequtils ]; then sed -i -e 's/^#\?GOVERNOR=.*$/GOVERNOR=performance/' /etc/default/cpufrequtils else echo 'GOVERNOR=performance' > /etc/default/cpufrequtils fi -echo "Installing libatomic" -apt-get install --yes libatomic1 -echo "libatomic installation complete." +if [[ "$INSTALL_NETWORK_MANAGER" == "yes" ]]; then + debug "NetworkManager installation specified. Installing components..." + install_if_missing network-manager + install_if_missing net-tools -if [[ "$INSTALL_NETWORK_MANAGER" == "true" ]]; then - echo "Installing network-manager..." - apt-get install --yes network-manager net-tools + debug "Configuring..." systemctl disable systemd-networkd-wait-online.service cat > /etc/netplan/00-default-nm-renderer.yaml < Date: Sat, 12 Oct 2024 21:22:35 -0500 Subject: [PATCH 36/59] fix wrong AllowedCPUs from main repo --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index a796afe..8d69d6f 100755 --- a/install.sh +++ b/install.sh @@ -321,7 +321,7 @@ fi if [[ -n $(cat /proc/cpuinfo | grep "RK3588") ]]; then debug "This has a Rockchip RK3588, enabling all cores" - sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=0-7/g' /lib/systemd/system/photonvision.service + sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' /lib/systemd/system/photonvision.service fi cp /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service From e52a9ff29c4a6d009e6937c7de2ef3b842e678ff Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 12 Oct 2024 22:01:30 -0500 Subject: [PATCH 37/59] allow debug messages --- install_opi5.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_opi5.sh b/install_opi5.sh index a26b563..f2e685c 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -34,7 +34,7 @@ echo "Freed up $freed KiB" # run Photonvision install script chmod +x ./install.sh -./install.sh -m -q +./install.sh -m echo "Installing additional things" apt-get install --yes --quiet libc6 libstdc++6 From 14445ffb4d66fab318e6059256b4978ddd8b7c61 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 12 Oct 2024 22:01:47 -0500 Subject: [PATCH 38/59] specify default version --- install.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/install.sh b/install.sh index 8d69d6f..0ba3a24 100755 --- a/install.sh +++ b/install.sh @@ -117,6 +117,7 @@ EOF } INSTALL_NETWORK_MANAGER="ask" +VERSION="latest" while getopts "hlv:a:mnq-:" OPT; do if [ "$OPT" = "-" ]; then From b0a28988ecaa21ee2c57e84b849da3f709133610 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 12 Oct 2024 22:25:31 -0500 Subject: [PATCH 39/59] specify if Network Manager should be installed --- install_dev_pi.sh | 2 +- install_limelight.sh | 2 +- install_opi5.sh | 2 +- install_pi.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install_dev_pi.sh b/install_dev_pi.sh index 1548160..1f3bcef 100644 --- a/install_dev_pi.sh +++ b/install_dev_pi.sh @@ -1,6 +1,6 @@ # Run normal photon installer chmod +x ./install.sh -./install.sh -q +./install.sh --install-nm=yes # and edit boot partition install -m 644 config.txt /boot/ diff --git a/install_limelight.sh b/install_limelight.sh index 27b358b..f5e6be3 100755 --- a/install_limelight.sh +++ b/install_limelight.sh @@ -1,6 +1,6 @@ # Run normal photon installer chmod +x ./install.sh -./install.sh -q +./install.sh --install-nm=yes # edit boot partition install -m 644 limelight/config.txt /boot/ diff --git a/install_opi5.sh b/install_opi5.sh index f2e685c..9b61132 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -34,7 +34,7 @@ echo "Freed up $freed KiB" # run Photonvision install script chmod +x ./install.sh -./install.sh -m +./install.sh --install-nm=no echo "Installing additional things" apt-get install --yes --quiet libc6 libstdc++6 diff --git a/install_pi.sh b/install_pi.sh index 940a691..9f29cc3 100755 --- a/install_pi.sh +++ b/install_pi.sh @@ -1,6 +1,6 @@ # Run normal photon installer chmod +x ./install.sh -./install.sh -q +./install.sh --install-nm=yes # and edit boot partition install -m 644 config.txt /boot/ From 4231d1260f37a9a46559c1493e666cee32796a3c Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 12 Oct 2024 22:30:04 -0500 Subject: [PATCH 40/59] correct message --- install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 0ba3a24..c9d95ca 100755 --- a/install.sh +++ b/install.sh @@ -321,7 +321,7 @@ if [ "$DISABLE_NETWORKING" = "true" ]; then fi if [[ -n $(cat /proc/cpuinfo | grep "RK3588") ]]; then - debug "This has a Rockchip RK3588, enabling all cores" + debug "This has a Rockchip RK3588, enabling big cores" sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' /lib/systemd/system/photonvision.service fi From 5c4a475a37b15beb5fa72a3e77cf8f6c31096945 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 10:16:25 -0500 Subject: [PATCH 41/59] check cpuinfo --- install.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/install.sh b/install.sh index c9d95ca..692f0df 100755 --- a/install.sh +++ b/install.sh @@ -198,6 +198,9 @@ fi debug "This is the installation script for PhotonVision." debug "Installing for platform $ARCH" +echo "*** CPU Info ******************************************************************" +cat /proc/cpuinfo + DISTRO=$(lsb_release -is) if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then From 6889b96d1e7c8fe58b545ecf5bf901787f914280 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 10:26:53 -0500 Subject: [PATCH 42/59] try 22.04 runner --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4f3fc0..2f1b680 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: fail-fast: false From c4c943a6ec03a643a1112b7a79c2eb06ef83d94b Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 10:42:00 -0500 Subject: [PATCH 43/59] ubuntu latest seems fine --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 2f1b680..b4f3fc0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,7 +9,7 @@ on: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: fail-fast: false From 4bd2902ad88488ddc82bf9adef7c3b33ee45afab Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 11:12:18 -0500 Subject: [PATCH 44/59] check a few more things --- install.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/install.sh b/install.sh index 692f0df..5ef0b65 100755 --- a/install.sh +++ b/install.sh @@ -198,7 +198,13 @@ fi debug "This is the installation script for PhotonVision." debug "Installing for platform $ARCH" -echo "*** CPU Info ******************************************************************" +echo "*** ischroot ***********************************************************" +if ischroot; then + echo "Running in chroot" +fi +echo "*** uname **************************************************************" +uname --all +echo "*** CPU Info ***********************************************************" cat /proc/cpuinfo DISTRO=$(lsb_release -is) From a88a6fa97e7f6a0b9b70302b74598e1dea48372c Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 11:30:46 -0500 Subject: [PATCH 45/59] not detecting the RK3588 in chroot, so enable big cores here --- install_opi5.sh | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/install_opi5.sh b/install_opi5.sh index 9b61132..376bc83 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -15,8 +15,9 @@ apt-get update --quiet before=$(df --output=used / | tail -n1) # clean up stuff -echo 'Purging snaps' + # get rid of snaps +echo "Purging snaps" rm -rf /var/lib/snapd/seed/snaps/* rm -f /var/lib/snapd/seed/seed.yaml apt-get purge --yes --quiet lxd-installer lxd-agent-loader @@ -62,6 +63,14 @@ systemctl disable systemd-networkd-wait-online.service # the bluetooth service isn't needed and causes a delay at boot systemctl disable ap6275p-bluetooth.service +# enable big cores +echo "Enabling big cores" +sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' /lib/systemd/system/photonvision.service +cp -f /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service +chmod 644 /etc/systemd/system/photonvision.service +systemctl daemon-reload +systemctl enable photonvision.service + rm -rf /var/lib/apt/lists/* apt-get --yes --quiet clean From a5808eda2defad2b3d2d48f22c81049c6d9fc0f2 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 11:57:50 -0500 Subject: [PATCH 46/59] better place for it --- install_opi5.sh | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/install_opi5.sh b/install_opi5.sh index 376bc83..700aff5 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -49,11 +49,14 @@ cp -f ./OPi5_CIDATA/network-config /boot/network-config # add customized user-data file for cloud-init cp -f ./OPi5_CIDATA/user-data /boot/user-data +# modify photonvision.service to enable big cores +sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' /lib/systemd/system/photonvision.service + # modify photonvision.service to wait for the network before starting # this helps ensure that photonvision detects the network the first time it starts # but it may cause a startup delay if the coprocessor isn't connected to a network sed -i '/Description/aAfter=network-online.target' /lib/systemd/system/photonvision.service -cp /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service +cp -f /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service chmod 644 /etc/systemd/system/photonvision.service cat /etc/systemd/system/photonvision.service @@ -63,14 +66,6 @@ systemctl disable systemd-networkd-wait-online.service # the bluetooth service isn't needed and causes a delay at boot systemctl disable ap6275p-bluetooth.service -# enable big cores -echo "Enabling big cores" -sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' /lib/systemd/system/photonvision.service -cp -f /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service -chmod 644 /etc/systemd/system/photonvision.service -systemctl daemon-reload -systemctl enable photonvision.service - rm -rf /var/lib/apt/lists/* apt-get --yes --quiet clean From d47dbee39d554389bba621a50cc953295710506f Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 12:11:42 -0500 Subject: [PATCH 47/59] ARCH may not be detected correctly in chroot, so specify it --- install_dev_pi.sh | 2 +- install_limelight.sh | 2 +- install_opi5.sh | 2 +- install_pi.sh | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/install_dev_pi.sh b/install_dev_pi.sh index 1f3bcef..67c9fad 100644 --- a/install_dev_pi.sh +++ b/install_dev_pi.sh @@ -1,6 +1,6 @@ # Run normal photon installer chmod +x ./install.sh -./install.sh --install-nm=yes +./install.sh --install-nm=yes --arch=aarch64 # and edit boot partition install -m 644 config.txt /boot/ diff --git a/install_limelight.sh b/install_limelight.sh index f5e6be3..262d905 100755 --- a/install_limelight.sh +++ b/install_limelight.sh @@ -1,6 +1,6 @@ # Run normal photon installer chmod +x ./install.sh -./install.sh --install-nm=yes +./install.sh --install-nm=yes --arch=aarch64 # edit boot partition install -m 644 limelight/config.txt /boot/ diff --git a/install_opi5.sh b/install_opi5.sh index 700aff5..7cedc68 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -35,7 +35,7 @@ echo "Freed up $freed KiB" # run Photonvision install script chmod +x ./install.sh -./install.sh --install-nm=no +./install.sh --install-nm=no --arch=aarch64 echo "Installing additional things" apt-get install --yes --quiet libc6 libstdc++6 diff --git a/install_pi.sh b/install_pi.sh index 9f29cc3..3436aa5 100755 --- a/install_pi.sh +++ b/install_pi.sh @@ -1,6 +1,6 @@ # Run normal photon installer chmod +x ./install.sh -./install.sh --install-nm=yes +./install.sh --install-nm=yes --arch=aarch64 # and edit boot partition install -m 644 config.txt /boot/ From 141254ec96ca6c035563fa91234cd7f70c3442b4 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 13 Oct 2024 23:55:01 -0500 Subject: [PATCH 48/59] honor --install-nm=yes --- install.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 5ef0b65..035c6e1 100755 --- a/install.sh +++ b/install.sh @@ -111,7 +111,8 @@ Syntax: sudo ./install.sh [options] NetworkManager (ignoring -m,--install-nm). -q, --quiet Silent install, automatically accepts all defaults. For - non-interactive use. Forces --install-nm="no". + non-interactive use. Forces --install-nm="no" unless + --install-nm="yes" is explicitly specified. EOF } @@ -209,8 +210,11 @@ cat /proc/cpuinfo DISTRO=$(lsb_release -is) -if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then - INSTALL_NETWORK_MANAGER="no" +if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then + # make sure that asking about network manager makes sense + if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then + INSTALL_NETWORK_MANAGER="no" + fi fi if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then From 17606f9278b63c583c3221e41355be53c0ab6b92 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Mon, 14 Oct 2024 00:08:31 -0500 Subject: [PATCH 49/59] after asking, INSTALL_NETWORK_MANAGER should either be "yes" or "no" --- install.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/install.sh b/install.sh index 035c6e1..7a5e7bb 100755 --- a/install.sh +++ b/install.sh @@ -223,6 +223,8 @@ if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then INSTALL_NETWORK_MANAGER="yes" + else + INSTALL_NETWORK_MANAGER="no" fi fi From 92cc9501829398591c8cdd7ba36a8fbc4fa922c1 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Wed, 16 Oct 2024 21:52:43 -0500 Subject: [PATCH 50/59] simplify the logic for asking to install NetworkManager --- install.sh | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/install.sh b/install.sh index 7a5e7bb..0269eb4 100755 --- a/install.sh +++ b/install.sh @@ -211,20 +211,18 @@ cat /proc/cpuinfo DISTRO=$(lsb_release -is) if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then - # make sure that asking about network manager makes sense if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then + # Only ask if it makes sense to do so INSTALL_NETWORK_MANAGER="no" - fi -fi - -if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then - debug "" - debug "Photonvision uses NetworkManager to control networking on your device." - read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response - if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then - INSTALL_NETWORK_MANAGER="yes" else - INSTALL_NETWORK_MANAGER="no" + debug "" + debug "Photonvision uses NetworkManager to control networking on your device." + read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response + if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then + INSTALL_NETWORK_MANAGER="yes" + else + INSTALL_NETWORK_MANAGER="no" + fi fi fi From bfb395ca35f14e5e7b260159473b49a2bacc529c Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Wed, 16 Oct 2024 22:00:04 -0500 Subject: [PATCH 51/59] uses wget instead of curl to check releases --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index 0269eb4..7f1b8b4 100755 --- a/install.sh +++ b/install.sh @@ -38,12 +38,12 @@ install_if_missing() { } get_photonvision_releases() { - if ! command -v curl > /dev/null 2>&1 ; then - die "./install --list-versions requires curl and it is not installed." + if ! command -v wget > /dev/null 2>&1 ; then + die "./install.sh --list-versions requires wget and it is not installed." fi if [ -z "$PHOTON_VISION_RELEASES" ] ; then - PHOTON_VISION_RELEASES="$(curl -sk https://api.github.com/repos/photonvision/photonvision/releases)" + PHOTON_VISION_RELEASES="$(wget -qO- https://api.github.com/repos/photonvision/photonvision/releases)" fi echo "$PHOTON_VISION_RELEASES" From 9847dc778802f6de8a38135f4f41f8b2f1440d6b Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 2 Nov 2024 22:35:57 -0500 Subject: [PATCH 52/59] merge final changes from EmDash00 --- install.sh | 82 +++++++++++++++++++++++------------------------------- 1 file changed, 35 insertions(+), 47 deletions(-) diff --git a/install.sh b/install.sh index 7f1b8b4..3431189 100755 --- a/install.sh +++ b/install.sh @@ -33,20 +33,25 @@ install_if_missing() { fi debug "Installing $1..." - apt-get install --yes $1 + apt-get install --yes "$1" debug "$1 installation complete." } get_photonvision_releases() { - if ! command -v wget > /dev/null 2>&1 ; then - die "./install.sh --list-versions requires wget and it is not installed." + # Return cached input + if [ -n "$PHOTON_VISION_RELEASES" ] ; then + echo "$PHOTON_VISION_RELEASES" + return fi - if [ -z "$PHOTON_VISION_RELEASES" ] ; then + # Use curl if available, otherwise fallback to wget + if command -v curl > /dev/null 2>&1 ; then + PHOTON_VISION_RELEASES="$(curl -sk https://api.github.com/repos/photonvision/photonvision/releases)" + else PHOTON_VISION_RELEASES="$(wget -qO- https://api.github.com/repos/photonvision/photonvision/releases)" fi - echo "$PHOTON_VISION_RELEASES" + echo "$PHOTON_VISION_RELEASES" } get_versions() { @@ -64,17 +69,11 @@ is_version_available() { # latest is a special case if [ "$target_version" = "latest" ]; then - return - fi - - # Check if the version is present - if ! echo "$(get_versions)" | grep -qFx "$target_version"; then - return 1 + return 0 fi # Check if multiple lines are match. You can only match 1. - local line_count="$(echo "$versions" | grep -cFx "$target_string")" - if [ $line_count -gt 1 ] ; then + if [ "$(get_versions | grep -cFx "$target_version")" -ne 1 ] ; then return 1 fi @@ -100,19 +99,16 @@ Syntax: sudo ./install.sh [options] Install PhotonVision for the specified architecture. Supported values: aarch64, x86_64 -m [option], --install-nm=[option] - Whether or not to install NetworkManager. Only used on - Ubuntu, and ignored for all other distros. - Supported options are: "yes", "no", and "ask". - "ask" prompts the user for installation of NetworkManager. - If not specified, will fall back to "ask". - If specified, "yes" is the default option. + Controls NetworkManager installation (Ubuntu only). + Options: "yes", "no", "ask". + Default: "ask" (unless -q or --quiet is specified, then "no"). + "ask" prompts for installation. Ignored on other distros. -n, --no-networking Disable networking. This will also prevent installation of - NetworkManager (ignoring -m,--install-nm). + NetworkManager, overriding -m,--install-nm. -q, --quiet Silent install, automatically accepts all defaults. For - non-interactive use. Forces --install-nm="no" unless - --install-nm="yes" is explicitly specified. + non-interactive use. Makes -m,--install-nm default to "no". EOF } @@ -138,12 +134,12 @@ while getopts "hlv:a:mnq-:" OPT; do ;; v | version) needs_arg - VERSION=$(echo "$OPTARG" | sed 's/^v//') # drop leading 'v's + VERSION=${OPTARG#v} # drop leading 'v's ;; a | arch) needs_arg; ARCH=$OPTARG ;; m | install-nm) - INSTALL_NETWORK_MANAGER="$(echo ${OPTARG:-'yes'} | tr '[:upper:]' '[:lower:]')" + INSTALL_NETWORK_MANAGER="$(echo "${OPTARG:-'yes'}" | tr '[:upper:]' '[:lower:]')" case "$INSTALL_NETWORK_MANAGER" in yes) ;; @@ -171,8 +167,6 @@ while getopts "hlv:a:mnq-:" OPT; do esac done -shift $(($OPTIND -1)) - if [ "$(id -u)" != "0" ]; then die "This script must be run as root" fi @@ -199,30 +193,24 @@ fi debug "This is the installation script for PhotonVision." debug "Installing for platform $ARCH" -echo "*** ischroot ***********************************************************" -if ischroot; then - echo "Running in chroot" -fi -echo "*** uname **************************************************************" -uname --all -echo "*** CPU Info ***********************************************************" -cat /proc/cpuinfo - DISTRO=$(lsb_release -is) +# Only ask if it makes sense to do so. +# i.e. the distro is Ubuntu, you haven't requested disabling networking, +# and you have requested a quiet install. if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then if [[ "$DISTRO" != "Ubuntu" || -n "$DISABLE_NETWORKING" || -n "$QUIET" ]] ; then - # Only ask if it makes sense to do so INSTALL_NETWORK_MANAGER="no" - else - debug "" - debug "Photonvision uses NetworkManager to control networking on your device." - read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response - if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then - INSTALL_NETWORK_MANAGER="yes" - else - INSTALL_NETWORK_MANAGER="no" - fi + fi +fi + +if [[ "$INSTALL_NETWORK_MANAGER" == "ask" ]]; then + debug "" + debug "Photonvision uses NetworkManager to control networking on your device." + debug "This could possibly mess up the network configuration in Ubuntu." + read -p "Do you want this script to install and configure NetworkManager? [y/N]: " response + if [[ $response == [yY] || $response == [yY][eE][sS] ]]; then + INSTALL_NETWORK_MANAGER="yes" fi fi @@ -286,7 +274,7 @@ else fi mkdir -p /opt/photonvision -cd /opt/photonvision +cd /opt/photonvision || die "Tried to enter /opt/photonvision, but it was not created." curl -sk "$RELEASE_URL" | grep "browser_download_url.*$ARCH_NAME.jar" | cut -d : -f 2,3 | @@ -333,7 +321,7 @@ if [ "$DISABLE_NETWORKING" = "true" ]; then sed -i "s/photonvision.jar/photonvision.jar -n/" /lib/systemd/system/photonvision.service fi -if [[ -n $(cat /proc/cpuinfo | grep "RK3588") ]]; then +if grep -q "RK3588" /proc/cpuinfo; then debug "This has a Rockchip RK3588, enabling big cores" sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' /lib/systemd/system/photonvision.service fi From 18cb7d2ec7c1830d060973b1d4422ba2b414c15b Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 2 Nov 2024 22:43:26 -0500 Subject: [PATCH 53/59] test adding image version --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b4f3fc0..9c00169 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,6 +64,7 @@ jobs: commands: | chmod +x ${{matrix.script}} ${{ matrix.script }} + git describe > /opt/photonvision/image-version - name: Compress built image run: | From 6e5eff22e7875c2a06c85e9f89d4cc843bbfdecf Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 2 Nov 2024 22:48:46 -0500 Subject: [PATCH 54/59] workflow already knows the ref_name so use it --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9c00169..b569999 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,7 +64,7 @@ jobs: commands: | chmod +x ${{matrix.script}} ${{ matrix.script }} - git describe > /opt/photonvision/image-version + echo "${{ github.ref_name }}" > /opt/photonvision/image-version - name: Compress built image run: | From 376504a532a607b77f16b681c6bb4a2a44d62b1a Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 2 Nov 2024 22:54:38 -0500 Subject: [PATCH 55/59] does it work? --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b569999..4242040 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,6 +65,8 @@ jobs: chmod +x ${{matrix.script}} ${{ matrix.script }} echo "${{ github.ref_name }}" > /opt/photonvision/image-version + echo "****** ref-name *****************************************" + cat /opt/photonvision/image-version - name: Compress built image run: | From d8bc3f7b467816b7f4a3c6b1f3bb49903e5b1c79 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sat, 2 Nov 2024 23:13:22 -0500 Subject: [PATCH 56/59] it looks like this will work --- .github/workflows/main.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4242040..b569999 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -65,8 +65,6 @@ jobs: chmod +x ${{matrix.script}} ${{ matrix.script }} echo "${{ github.ref_name }}" > /opt/photonvision/image-version - echo "****** ref-name *****************************************" - cat /opt/photonvision/image-version - name: Compress built image run: | From 8c44a9d1898d547e267c9ecef30c21ccf5863a22 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 3 Nov 2024 16:54:15 -0600 Subject: [PATCH 57/59] should install NetworkManager --- install_opi5.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/install_opi5.sh b/install_opi5.sh index 7cedc68..5833f69 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -35,7 +35,7 @@ echo "Freed up $freed KiB" # run Photonvision install script chmod +x ./install.sh -./install.sh --install-nm=no --arch=aarch64 +./install.sh --install-nm=yes --arch=aarch64 echo "Installing additional things" apt-get install --yes --quiet libc6 libstdc++6 From f278145a6f872bb17284e32b034684608cfe9b06 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Sun, 3 Nov 2024 16:54:30 -0600 Subject: [PATCH 58/59] I don't think these are needed --- install_opi5.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/install_opi5.sh b/install_opi5.sh index 5833f69..8b6540a 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -26,6 +26,13 @@ apt-get purge --yes --quiet snapd # remove bluetooth daemon apt-get purge --yes --quiet bluez +# remove unused firmware (experimental) +rm -rf /usr/lib/firmware/mrvl/ +rm -rf /usr/lib/firmware/mellanox/ +rm -rf /usr/lib/firmware/nvidia/ +rm -rf /usr/lib/firmware/intel/ +rm -rf /usr/lib/firmware/amdgpu/ + apt-get --yes --quiet autoremove after=$(df --output=used / | tail -n1) From 294517e7983f4e7093690cb1980533d637324fa9 Mon Sep 17 00:00:00 2001 From: Craig Schardt Date: Wed, 6 Nov 2024 21:19:36 -0600 Subject: [PATCH 59/59] Revert "I don't think these are needed" This reverts commit f278145a6f872bb17284e32b034684608cfe9b06. These lines will be included in a different PR. --- install_opi5.sh | 7 ------- 1 file changed, 7 deletions(-) diff --git a/install_opi5.sh b/install_opi5.sh index 8b6540a..5833f69 100755 --- a/install_opi5.sh +++ b/install_opi5.sh @@ -26,13 +26,6 @@ apt-get purge --yes --quiet snapd # remove bluetooth daemon apt-get purge --yes --quiet bluez -# remove unused firmware (experimental) -rm -rf /usr/lib/firmware/mrvl/ -rm -rf /usr/lib/firmware/mellanox/ -rm -rf /usr/lib/firmware/nvidia/ -rm -rf /usr/lib/firmware/intel/ -rm -rf /usr/lib/firmware/amdgpu/ - apt-get --yes --quiet autoremove after=$(df --output=used / | tail -n1)