Last active
November 13, 2020 13:46
-
-
Save arif-ali/2828585c0139612ad6edf026167d68e9 to your computer and use it in GitHub Desktop.
user_data cloud-init file for 20.10 raspi image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#cloud-config | |
ssh_import_id: | |
- lp:arif-ali | |
## Update apt database and upgrade packages on first boot | |
package_update: true | |
package_upgrade: true | |
## Install additional packages on first boot | |
packages: | |
- openssh-server | |
- snapd | |
- salt-minion | |
- byobu | |
- rpi-eeprom | |
- aptitude | |
- ubuntu-minimal | |
- ubuntu-release-upgrader-core | |
- git | |
## 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="openssh-server snapd salt-minion byobu rsync ubuntu-release-upgrader-core git rpi-eeprom" | |
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 | |
runcmd: | |
- [ /root/reset.sh ] | |
swap: | |
filename: /swap.img | |
size: 8589934592 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Now update
mnt/user-data
with the above contents, and enter your SD card to PC/laptop. My device was/dev/sdb
Remove SD card from PC, and add to rpi4, and the
cloud-init
will do the job that was required