|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Exit on errors, print commands, ignore unset variables |
| 4 | +set -ex +u |
| 5 | + |
| 6 | +# change hostname |
| 7 | +sed -i 's/orangepi6plus/photonvision/g' /etc/hostname |
| 8 | +sed -i 's/orangepi6plus/photonvision/g' /etc/hosts |
| 9 | + |
| 10 | +# silence log spam from dpkg |
| 11 | +cat > /etc/apt/apt.conf.d/99dpkg.conf << EOF |
| 12 | +Dpkg::Progress-Fancy "0"; |
| 13 | +APT::Color "0"; |
| 14 | +Dpkg::Use-Pty "0"; |
| 15 | +EOF |
| 16 | + |
| 17 | +apt-get -q update |
| 18 | + |
| 19 | +before=$(df --output=used / | tail -n1) |
| 20 | +# clean up stuff |
| 21 | + |
| 22 | +# remove build-essential for minor space savings |
| 23 | +apt-get --yes purge --allow-change-held-packages -q *-dev git |
| 24 | +apt-get --yes autoremove --allow-change-held-packages --purge |
| 25 | + |
| 26 | +after=$(df --output=used / | tail -n1) |
| 27 | +freed=$(( before - after )) |
| 28 | +echo "Freed up $freed KiB" |
| 29 | + |
| 30 | +# run Photonvision install script |
| 31 | +chmod +x ./install.sh |
| 32 | +./install.sh --install-nm=yes --arch=aarch64 --version="$1" |
| 33 | + |
| 34 | +echo "Installing additional things" |
| 35 | +apt-get --yes -qq install libc6 libstdc++6 |
| 36 | + |
| 37 | +# modify photonvision.service to enable big cores |
| 38 | +# For reasons beyond human comprehension, the little cores are on 2, 3, 4, and 5. |
| 39 | +sed -i 's/# AllowedCPUs=4-7/AllowedCPUs=0,1,6-11/g' /lib/systemd/system/photonvision.service |
| 40 | +cp -f /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service |
| 41 | +chmod 644 /etc/systemd/system/photonvision.service |
| 42 | +cat /etc/systemd/system/photonvision.service |
| 43 | + |
| 44 | +# networkd isn't being used, this causes an unnecessary delay |
| 45 | +systemctl disable systemd-networkd-wait-online.service |
| 46 | + |
| 47 | +# PhotonVision server is managing the network, so it doesn't need to wait for online |
| 48 | +systemctl disable NetworkManager-wait-online.service |
| 49 | + |
| 50 | +# there's no internal bluetooth or wifi on the opi6plus |
| 51 | + |
| 52 | +# there's also no...preinstalled ssh keys. |
| 53 | +ssh-keygen -A |
| 54 | + |
| 55 | +rm -rf /var/lib/apt/lists/* |
| 56 | +apt-get --yes -qq clean |
| 57 | + |
| 58 | +rm -rf /usr/share/doc |
| 59 | +rm -rf /usr/share/locale/ |
0 commit comments