Skip to content

Commit

Permalink
Mark deps as "held" (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
mcm001 authored Jan 13, 2025
1 parent d9bcb56 commit 8544cfb
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 9 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ jobs:
${{ matrix.script }}
chmod +x ./install_common.sh
./install_common.sh
mkdir -p /opt/photonvision/
echo "${{ github.ref_name }};${{ matrix.name }}" > /opt/photonvision/image-version
- name: Compress built image
Expand Down
27 changes: 25 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash

# Verbose and exit on errors
set -ex

needs_arg() {
if [ -z "$OPTARG" ]; then
die "Argument is required for --$OPT option" \
Expand Down Expand Up @@ -29,11 +32,17 @@ package_is_installed(){
install_if_missing() {
if package_is_installed "$1" ; then
debug "Found existing $1. Skipping..."
# Always mark our upstream apt deps as held back, which will prevent the package
# from being automatically installed, upgraded or removed
apt-mark manual "$1"
return
fi

debug "Installing $1..."
apt-get install --yes "$1"
# Always mark our upstream apt deps as held back, which will prevent the package
# from being automatically installed, upgraded or removed
apt-mark manual "$1"
debug "$1 installation complete."
}

Expand Down Expand Up @@ -80,6 +89,14 @@ is_version_available() {
return 0
}

is_chroot() {
if systemd-detect-virt -r; then
return 0
else
return 1
fi
}

help() {
cat << EOF
This script installs Photonvision.
Expand Down Expand Up @@ -171,6 +188,10 @@ if [ "$(id -u)" != "0" ]; then
die "This script must be run as root"
fi

if is_chroot ; then
debug "Running in chroot. Arch should be specified."
fi

if [[ -z "$ARCH" ]]; then
debug "Arch was not specified. Inferring..."
ARCH=$(uname -m)
Expand Down Expand Up @@ -240,10 +261,12 @@ if [[ "$INSTALL_NETWORK_MANAGER" == "yes" ]]; then

debug "Configuring..."
systemctl disable systemd-networkd-wait-online.service
cat > /etc/netplan/00-default-nm-renderer.yaml <<EOF
if [[ -d /etc/netplan/ ]]; then
cat > /etc/netplan/00-default-nm-renderer.yaml <<EOF
network:
renderer: NetworkManager
EOF
fi
debug "network-manager installation complete."
fi

Expand Down Expand Up @@ -285,7 +308,7 @@ debug "Downloaded PhotonVision."
debug "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 [[ $(systemctl --quiet is-active photonvision) = "active" ]]; then
debug "PhotonVision is already running. Stopping service."
systemctl stop photonvision
systemctl disable photonvision
Expand Down
3 changes: 3 additions & 0 deletions install_common.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash -v

# Verbose and exit on errors
set -ex

# Do additional tasks that are common across all images,
# but not suitable for inclusion in install.sh
echo "Running install_common.sh"
Expand Down
15 changes: 10 additions & 5 deletions install_dev_pi.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash -v

# Verbose and exit on errors
set -ex
# Run normal photon installer
chmod +x ./install.sh
./install.sh --install-nm=yes --arch=aarch64
Expand All @@ -7,7 +11,7 @@ install -m 644 config.txt /boot/
install -m 644 userconf.txt /boot/

# Kill wifi and other networking things
install -v -m 644 files/wait.conf /etc/systemd/system/dhcpcd.service.d/
install -v -m 644 -D -t /etc/systemd/system/dhcpcd.service.d/ files/wait.conf
install -v files/rpi-blacklist.conf /etc/modprobe.d/blacklist.conf

# Update pigipio service file to listen locally
Expand All @@ -18,10 +22,6 @@ systemctl daemon-reload
systemctl enable ssh
systemctl enable pigpiod

# Remove extra packages too
echo "Purging extra things"
apt-get purge -y gdb gcc g++ linux-headers* libgcc*-dev
apt-get autoremove -y

echo "Installing additional things"
sudo apt-get update
Expand All @@ -30,6 +30,11 @@ apt-get install -y network-manager net-tools
# libcamera-driver stuff
apt-get install -y libegl1 libopengl0 libgl1-mesa-dri libgbm1 libegl1-mesa-dev libcamera-dev cmake build-essential libdrm-dev libgbm-dev default-jdk openjdk-17-jdk

# Remove extra packages too
echo "Purging extra things"
apt-get purge -y gdb gcc g++ linux-headers* libgcc*-dev
apt-get autoremove -y

rm -rf /var/lib/apt/lists/*
apt-get clean

Expand Down
7 changes: 6 additions & 1 deletion install_limelight.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/bash -v

# Verbose and exit on errors
set -ex

# Run normal photon installer
chmod +x ./install.sh
./install.sh --install-nm=yes --arch=aarch64
Expand All @@ -10,7 +15,7 @@ install -m 644 userconf.txt /boot/
dtc -O dtb limelight/gloworm-dt.dts -o /boot/dt-blob.bin

# Kill wifi and other networking things
install -v -m 644 files/wait.conf /etc/systemd/system/dhcpcd.service.d/
install -v -m 644 -D -t /etc/systemd/system/dhcpcd.service.d/ files/wait.conf
install -v files/rpi-blacklist.conf /etc/modprobe.d/blacklist.conf

# Update pigipio service file to listen locally
Expand Down
5 changes: 5 additions & 0 deletions install_limelight3.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/bash -v

# Verbose and exit on errors
set -ex

# Run the pi install script
chmod +x ./install_pi.sh
./install_pi.sh
Expand Down
3 changes: 3 additions & 0 deletions install_opi5.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/bin/bash -v

# Verbose and exit on errors
set -ex

# Create pi/raspberry login
if id "$1" >/dev/null 2>&1; then
echo 'user found'
Expand Down
7 changes: 6 additions & 1 deletion install_pi.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/bash -v

# Verbose and exit on errors
set -ex

# Run normal photon installer
chmod +x ./install.sh
./install.sh --install-nm=yes --arch=aarch64
Expand All @@ -7,7 +12,7 @@ install -m 644 config.txt /boot/
install -m 644 userconf.txt /boot/

# Kill wifi and other networking things
install -v -m 644 files/wait.conf /etc/systemd/system/dhcpcd.service.d/
install -v -m 644 -D -t /etc/systemd/system/dhcpcd.service.d/ files/wait.conf
install -v files/rpi-blacklist.conf /etc/modprobe.d/blacklist.conf

# Update pigipio service file to listen locally
Expand Down
5 changes: 5 additions & 0 deletions install_snakeyes.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#!/bin/bash -v

# Verbose and exit on errors
set -ex

# Run the pi install script
chmod +x ./install_pi.sh
./install_pi.sh
Expand Down

0 comments on commit 8544cfb

Please sign in to comment.