From 8544cfb600fa29a573bc3412ff1b849031004470 Mon Sep 17 00:00:00 2001 From: Matt Morley Date: Sun, 12 Jan 2025 17:32:14 -0700 Subject: [PATCH] Mark deps as "held" (#45) --- .github/workflows/main.yml | 1 + install.sh | 27 +++++++++++++++++++++++++-- install_common.sh | 3 +++ install_dev_pi.sh | 15 ++++++++++----- install_limelight.sh | 7 ++++++- install_limelight3.sh | 5 +++++ install_opi5.sh | 3 +++ install_pi.sh | 7 ++++++- install_snakeyes.sh | 5 +++++ 9 files changed, 64 insertions(+), 9 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b31544c..ab91302 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/install.sh b/install.sh index 3431189..cb8f650 100755 --- a/install.sh +++ b/install.sh @@ -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" \ @@ -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." } @@ -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. @@ -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) @@ -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 < /etc/netplan/00-default-nm-renderer.yaml </dev/null 2>&1; then echo 'user found' diff --git a/install_pi.sh b/install_pi.sh index 3436aa5..777de03 100755 --- a/install_pi.sh +++ b/install_pi.sh @@ -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 @@ -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 diff --git a/install_snakeyes.sh b/install_snakeyes.sh index 583b6b3..f687dec 100755 --- a/install_snakeyes.sh +++ b/install_snakeyes.sh @@ -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