44set -ex +u
55
66cd /tmp/build
7- echo ' === Current directory: \ $(pwd) ==='
7+ echo ' === Current directory: $(pwd) ==='
88echo ' === Files in current directory: ==='
99ls -la
1010
@@ -30,6 +30,7 @@ APT::Color "0";
3030Dpkg::Use-Pty "0";
3131EOF_DPKG
3232
33+
3334# Make sure all the sources are available for apt
3435cat > /etc/apt/sources.list.d/ubuntu.sources << EOF_UBUNTU_SOURCES
3536Types: deb
@@ -39,6 +40,8 @@ Components: main universe restricted multiverse
3940Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
4041EOF_UBUNTU_SOURCES
4142
43+ # diff /etc/apt/sources.list /etc/apt/sources.list.d/ubuntu.sources
44+
4245apt-get -q update
4346
4447# This needs to run before install.sh to fix some weird dependency issues
@@ -47,32 +50,36 @@ apt-get -y --allow-downgrades install libsqlite3-0=3.45.1-1ubuntu2
4750# Add the GPG key for the RUBIK Pi PPA
4851wget -qO - https://thundercomm.s3.dualstack.ap-northeast-1.amazonaws.com/uploads/web/rubik-pi-3/tools/key.asc | tee /etc/apt/trusted.gpg.d/rubikpi3.asc
4952
50- # Run normal photon installer
51- chmod +x ./install.sh
52- ./install.sh --install-nm=yes --arch=aarch64 --version=" $1 "
53-
54- # Install packages from the RUBIK Pi PPA, we skip calling apt-get update here because install.sh already does that
55- apt-get -y install libqnn1 libsnpe1 qcom-adreno1 device-tree-compiler
56-
57- # Enable ssh
58- systemctl enable ssh
59-
60- # Remove extra packages too
61- echo " Purging extra things"
53+ # Remove extra packages to make space
54+ echo " Space available before purging things"
55+ df -h
6256
6357# get rid of snaps
6458echo " Purging snaps"
6559rm -rf /var/lib/snapd/seed/snaps/*
6660rm -f /var/lib/snapd/seed/seed.yaml
67- apt-get purge --yes lxd-installer lxd-agent-loader snapd gdb gcc g++ linux-headers* libgcc* -dev perl-modules* git vim-runtime
68- apt-get autoremove -y
61+ apt-get purge --yes lxd-installer lxd-agent-loader snapd gdb gcc g++ linux-headers* libgcc* -dev perl-modules* git vim-runtime python3-twisted sosreport bluez
62+ apt-get autoremove --yes
6963
7064rm -rf /var/lib/apt/lists/*
7165apt-get clean
7266
7367rm -rf /usr/share/doc
7468rm -rf /usr/share/locale/
7569
70+ echo " Space available after purging things"
71+ df -h
72+
73+ # Run normal photon installer
74+ chmod +x ./install.sh
75+ ./install.sh --install-nm=yes --arch=aarch64 --version=" $1 "
76+
77+ # Install packages from the RUBIK Pi PPA, we skip calling apt-get update here because install.sh already does that
78+ apt-get -y install libqnn1 libsnpe1 qcom-adreno1 device-tree-compiler
79+
80+ # Enable ssh
81+ systemctl enable ssh
82+
7683# modify photonvision.service to run on A78 cores
7784sed -i ' s/# AllowedCPUs=4-7/AllowedCPUs=4-7/g' /lib/systemd/system/photonvision.service
7885cp -f /lib/systemd/system/photonvision.service /etc/systemd/system/photonvision.service
@@ -82,13 +89,6 @@ cat /etc/systemd/system/photonvision.service
8289# networkd isn't being used, this causes an unnecessary delay
8390systemctl disable systemd-networkd-wait-online.service
8491
85- # PhotonVision server is managing the network, so it doesn't need to wait for online
86- # systemctl disable NetworkManager-wait-online.service
87-
88- # Disable Bluetooth
89- sed -i ' s/^AutoEnable=.*/AutoEnable=false/g' /etc/bluetooth/main.conf
90- systemctl disable bluetooth.service
91-
9292# set the hostname during cloud-init and disable cloud-init after first boot
9393cat >> /var/lib/cloud/seed/nocloud/user-data << EOFUSERDATA
9494
@@ -131,3 +131,24 @@ EOF_FAN_SERVICE
131131
132132# 4. Enable the new service
133133systemctl enable rubik-fan-max.service
134+
135+ echo " Space available before purging things"
136+ df -h /dev/loop0
137+
138+ rm -rf /var/lib/apt/lists/*
139+ df -h /dev/loop0
140+
141+ apt-get clean
142+ df -h /dev/loop0
143+
144+ rm -rf /usr/share/doc
145+ rm -rf /usr/share/locale/
146+
147+ # remove firmware that (probably) isn't needed
148+ rm -rf /usr/lib/firmware/mrvl
149+ rm -rf /usr/lib/firmware/mellanox
150+ rm -rf /usr/lib/firmware/nvidia
151+ rm -rf /usr/lib/firmware/intel
152+
153+ echo " Space available after purging things"
154+ df -h /dev/loop0
0 commit comments