start of combining my rpi4 resources

This commit is contained in:
Arif Ali 2022-03-16 14:20:44 +00:00
parent d63c8ac105
commit 84d03891c6
Signed by: arif
GPG Key ID: 369608FBA1353A70
3 changed files with 82 additions and 0 deletions

18
rpi/bootstrap.md Normal file
View File

@ -0,0 +1,18 @@
This is the cloud-init file that can be used in the 20.10 raspi image
The image was originally mounted using
mkdir mnt
sudo mount -o loop,offset=1048576 ubuntu-20.10-preinstalled-server-arm64+raspi.img mnt
Then copy `mnt/user-data` with the contents from this snippet, i.e.
cp user-data.yaml mnt/user-data
Unmount the folder
umount mnt
Now write to the sdcard, in my example below `/dev/sda` is the sdcard
sudo dd if=ubuntu-20.10-preinstalled-server-arm64+raspi.img of=/dev/sda bs=4M conv=fsync

64
rpi/user-data.yaml Normal file
View File

@ -0,0 +1,64 @@
#cloud-config
ssh_import_id:
- lp:arif-ali
## Update apt database and upgrade packages on first boot
package_update: true
package_upgrade: true
byobu_by_default: enable
## Install additional packages on first boot
packages:
- aptitude
- byobu
- git
- linux-modules-extra-raspi
- nano
- openssh-server
- rpi-eeprom
- rsync
- salt-minion
- snapd
- ubuntu-minimal
- ubuntu-release-upgrader-core
## Write arbitrary files to the file-system (including binaries!)
write_files:
- path: /root/reset.sh
content: |
#!/bin/bash
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
hold_apps="byobu git linux-modules-extra-raspi nano openssh-server rpi-eeprom rsync salt-minion snapd ubuntu-release-upgrader-core"
sudo -E apt-get update
sudo -E aptitude markauto '~i!~nubuntu-minimal'
sudo -E apt-mark hold ${hold_apps}
sudo -E apt-get -yq autoremove
dpkg -l | grep ^rc | awk '{print $2}' | xargs -i sudo -E dpkg --force-all -P "{}"
sudo -E apt-mark unhold ${hold_apps}
sudo -E apt-get -y install ${hold_apps}
sudo -E apt-get update
sudo -E apt-get -y upgrade
#sudo -E salt-call state.highstate
permissions: '0755'
owner: root:root
# Configure salt
salt_minion:
grains:
physical_type: rpi
# Runs any command that we need to run post install
runcmd:
- [ /root/reset.sh ]
- [ "snap", "set", "lxd", "criu.enable=true" ]
# Creates a 8GB swap file in /
swap:
filename: /swap.img
size: 8589934592