Skip to content

Commit

Permalink
Update install.sh for OPi5 Ubuntu 24.04 (#1390)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
crschardt authored Aug 13, 2024
1 parent c330204 commit dbe566c
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
network:
renderer: NetworkManager
Expand All @@ -121,6 +126,10 @@ fi
echo "JRE installation complete."

echo "Installing additional math packages"
if [[ "$DISTRO" = "Ubuntu" && -z $(apt-cache search libcholmod3) ]]; then
echo "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

echo "Installing v4l-utils..."
Expand All @@ -143,8 +152,7 @@ echo "Downloaded latest stable release of PhotonVision."
echo "Creating the PhotonVision systemd service..."

# service --status-all doesn't list photonvision on OrangePi use systemctl instead:
#if systemctl --quiet is-active photonvision; then
if service --status-all | grep -Fq 'photonvision'; then
if systemctl --quiet is-active photonvision; then
echo "PhotonVision is already running. Stopping service."
systemctl stop photonvision
systemctl disable photonvision
Expand Down Expand Up @@ -180,6 +188,11 @@ 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
echo "This has a Rockchip RK3588, enabling all cores"
sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=0-7/g' /lib/systemd/system/photonvision.service
fi

cp /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service
chmod 644 /etc/systemd/system/photonvision.service
systemctl daemon-reload
Expand Down

0 comments on commit dbe566c

Please sign in to comment.