@@ -4,58 +4,91 @@ if id "$1" >/dev/null 2>&1; then
44 echo ' user found'
55else
66 echo " creating pi user"
7- useradd pi -b /home
7+ useradd pi -m - b /home -s /bin/bash
88 usermod -a -G sudo pi
9- mkdir /home/pi
10- chown -R pi /home/pi
11-
129 echo ' pi ALL=(ALL) NOPASSWD: ALL' | tee -a /etc/sudoers.d/010_pi-nopasswd > /dev/null
1310 chmod 0440 /etc/sudoers.d/010_pi-nopasswd
1411fi
1512echo " pi:raspberry" | chpasswd
1613
17- apt-get update
14+ apt-get update --quiet
15+
16+ before=$( df --output=used / | tail -n1)
17+ # clean up stuff
18+ echo ' Purging snaps'
19+ # get rid of snaps
20+ rm -rf /var/lib/snapd/seed/snaps/*
21+ rm -f /var/lib/snapd/seed/seed.yaml
22+ apt-get purge --yes --quiet lxd-installer lxd-agent-loader
23+ apt-get purge --yes --quiet snapd
24+
25+ # remove bluetooth daemon
26+ apt-get purge --yes --quiet bluez
27+
28+ apt-get --yes --quiet autoremove
29+
30+ after=$( df --output=used / | tail -n1)
31+ freed=$(( before - after ))
32+
33+ echo " Freed up $freed KiB"
34+
35+ # run Photonvision install script
1836wget https://git.io/JJrEP -O install.sh
1937chmod +x install.sh
2038
21- sed -i ' s/# AllowedCPUs=4-7/AllowedCPUs=4 -7/g' install.sh
39+ sed -i ' s/# AllowedCPUs=4-7/AllowedCPUs=0 -7/g' install.sh
2240
23- ./install.sh -n -q
41+ ./install.sh -m -q
2442rm install.sh
2543
44+ echo " Installing additional things"
2645
27- # Remove extra packages
28- echo " Purging extra things"
29- # apt-get remove -y gdb gcc g++ linux-headers* libgcc*-dev
30- # apt-get remove -y snapd
31- apt-get autoremove -y
46+ apt-get install --yes --quiet network-manager net-tools libatomic1
3247
48+ # let netplan create the config during cloud-init
49+ rm -f /etc/netplan/00-default-nm-renderer.yaml
3350
34- echo " Installing additional things"
35- sudo apt-get update
36- apt-get install -y network-manager net-tools libatomic1
51+ # set NetworkManager as the renderer in cloud-init
52+ cp -f ./OPi5_CIDATA/network-config /boot/network-config
3753
38- apt-get install -y libc6 libstdc++6
54+ # add customized user-data file for cloud-init
55+ cp -f ./OPi5_CIDATA/user-data /boot/user-data
3956
40- # cat > /etc/netplan/00-default-nm-renderer.yaml <<EOF
41- # network:
42- # renderer: NetworkManager
57+ # tell NetworkManager not to wait for the carrier on ethernet, which can delay boot
58+ # when the coprocessor isn't connected to the ethernet
59+ # cat > /etc/NetworkManager/conf.d/50-ignore-carrier.conf <<EOF
60+ # [main]
61+ # ignore-carrier=*
4362# EOF
4463
64+ # modify photonvision.service to wait for the network before starting
65+ # this helps ensure that photonvision detects the network the first time it starts
66+ # but it may cause a startup delay if the coprocessor isn't connected to a network
67+ sed -i ' /Description/aAfter=network-online.target' /etc/systemd/system/photonvision.service
68+ cat /etc/systemd/system/photonvision.service
69+
70+ # networkd isn't being used, this causes an unnecessary delay
71+ systemctl disable systemd-networkd-wait-online.service
72+
73+ # the bluetooth service isn't needed and causes a delay at boot
74+ systemctl disable ap6275p-bluetooth.service
75+
76+ apt-get install --yes --quiet libc6 libstdc++6
77+
4578if [ $( cat /etc/lsb-release | grep -c " 24.04" ) -gt 0 ]; then
4679 # add jammy to apt sources
4780 echo " Adding jammy to list of apt sources"
4881 add-apt-repository -y -S ' deb http://ports.ubuntu.com/ubuntu-ports jammy main universe'
4982fi
5083
51- apt-get update
84+ apt-get --quiet update
5285
5386# mrcal stuff
54- apt-get install -y libcholmod3 liblapack3 libsuitesparseconfig5
87+ apt-get install --yes --quiet libcholmod3 liblapack3 libsuitesparseconfig5
5588
5689
5790rm -rf /var/lib/apt/lists/*
58- apt-get clean
91+ apt-get --yes --quiet clean
5992
6093rm -rf /usr/share/doc
6194rm -rf /usr/share/locale/
0 commit comments