2019-12-17 20:41:16 +00:00
|
|
|
# See https://wiki.debian.org/RaspberryPi3 for known issues and more details.
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- mkimg: "{{ output }}"
|
|
|
|
size: 1500M
|
|
|
|
|
|
|
|
- mklabel: msdos
|
|
|
|
device: "{{ output }}"
|
|
|
|
|
|
|
|
- mkpart: primary
|
|
|
|
fs-type: 'fat32'
|
|
|
|
device: "{{ output }}"
|
|
|
|
start: 0%
|
|
|
|
end: 20%
|
|
|
|
tag: /boot
|
|
|
|
|
|
|
|
- mkpart: primary
|
|
|
|
device: "{{ output }}"
|
|
|
|
start: 20%
|
|
|
|
end: 100%
|
|
|
|
tag: /
|
|
|
|
|
|
|
|
- kpartx: "{{ output }}"
|
|
|
|
|
|
|
|
- mkfs: vfat
|
|
|
|
partition: /boot
|
|
|
|
label: RASPIFIRM
|
|
|
|
|
|
|
|
- mkfs: ext4
|
|
|
|
partition: /
|
|
|
|
label: RASPIROOT
|
|
|
|
|
|
|
|
- mount: /
|
|
|
|
|
|
|
|
- mount: /boot
|
|
|
|
mount-on: /
|
|
|
|
dirname: '/boot/firmware'
|
|
|
|
|
|
|
|
- unpack-rootfs: /
|
|
|
|
|
2021-01-14 06:55:55 +00:00
|
|
|
- qemu-debootstrap: __RELEASE__
|
2019-12-17 20:41:16 +00:00
|
|
|
mirror: http://deb.debian.org/debian
|
|
|
|
target: /
|
|
|
|
arch: __ARCH__
|
|
|
|
components:
|
|
|
|
- main
|
|
|
|
- contrib
|
|
|
|
- non-free
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
2020-04-05 02:56:51 +01:00
|
|
|
- create-file: /etc/apt/sources.list
|
|
|
|
trailing-newline: '1'
|
|
|
|
contents: |
|
2021-01-14 06:55:55 +00:00
|
|
|
deb http://deb.debian.org/debian __RELEASE__ main contrib non-free
|
|
|
|
deb http://deb.debian.org/debian-security __RELEASE__/updates main contrib non-free
|
2020-04-05 02:56:51 +01:00
|
|
|
# Backports are _not_ enabled by default.
|
|
|
|
# Enable them by uncommenting the following line:
|
2021-01-14 06:55:55 +00:00
|
|
|
# deb http://deb.debian.org/debian __RELEASE__-backports main contrib non-free
|
2020-04-24 17:00:10 +01:00
|
|
|
__OTHER_APT_ENABLE__
|
2020-04-05 02:56:51 +01:00
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
2019-12-17 20:41:16 +00:00
|
|
|
- chroot: /
|
|
|
|
shell: |
|
|
|
|
apt-get update
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
|
|
|
- apt: install
|
|
|
|
packages:
|
|
|
|
- ssh
|
|
|
|
- parted
|
|
|
|
- dosfstools
|
|
|
|
- wireless-tools
|
|
|
|
- wpasupplicant
|
|
|
|
- raspi3-firmware
|
|
|
|
- __LINUX_IMAGE__
|
|
|
|
__EXTRA_PKGS__
|
|
|
|
tag: /
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
|
|
|
- cache-rootfs: /
|
|
|
|
unless: rootfs_unpacked
|
|
|
|
|
|
|
|
- shell: |
|
|
|
|
echo "__HOST__-$(date +%Y%m%d)" > "${ROOT?}/etc/hostname"
|
|
|
|
|
|
|
|
# Allow root logins locally with no password
|
|
|
|
sed -i 's,root:[^:]*:,root::,' "${ROOT?}/etc/shadow"
|
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 644 -o root -g root rootfs/etc/fstab "${ROOT?}/etc/fstab"
|
2019-12-17 20:41:16 +00:00
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 644 -o root -g root rootfs/etc/network/interfaces.d/eth0 "${ROOT?}/etc/network/interfaces.d/eth0"
|
2020-08-15 06:15:43 +01:00
|
|
|
install -m 600 -o root -g root rootfs/etc/network/interfaces.d/wlan0 "${ROOT?}/etc/network/interfaces.d/wlan0"
|
2019-12-17 20:41:16 +00:00
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 755 -o root -g root rootfs/usr/local/sbin/rpi-set-sysconf "${ROOT?}/usr/local/sbin/rpi-set-sysconf"
|
|
|
|
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-set-sysconf.service "${ROOT?}/etc/systemd/system/"
|
|
|
|
install -m 644 -o root -g root rootfs/boot/firmware/sysconf.txt "${ROOT?}/boot/firmware/sysconf.txt"
|
2019-12-17 20:41:16 +00:00
|
|
|
mkdir -p "${ROOT?}/etc/systemd/system/basic.target.requires/"
|
|
|
|
ln -s /etc/systemd/system/rpi-set-sysconf.service "${ROOT?}/etc/systemd/system/basic.target.requires/rpi-set-sysconf.service"
|
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 755 -o root -g root rootfs/usr/sbin/rpi-resizerootfs "${ROOT?}/usr/sbin/rpi-resizerootfs"
|
|
|
|
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-resizerootfs.service "${ROOT?}/etc/systemd/system/"
|
2019-12-17 20:41:16 +00:00
|
|
|
mkdir -p "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/"
|
|
|
|
ln -s /etc/systemd/system/rpi-resizerootfs.service "${ROOT?}/etc/systemd/system/systemd-remount-fs.service.requires/rpi-resizerootfs.service"
|
|
|
|
|
2020-08-15 06:06:18 +01:00
|
|
|
install -m 644 -o root -g root rootfs/etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/"
|
2019-12-17 20:41:16 +00:00
|
|
|
mkdir -p "${ROOT?}/etc/systemd/system/multi-user.target.requires/"
|
|
|
|
ln -s /etc/systemd/system/rpi-generate-ssh-host-keys.service "${ROOT?}/etc/systemd/system/multi-user.target.requires/rpi-generate-ssh-host-keys.service"
|
2019-12-06 15:09:31 +00:00
|
|
|
rm -f "${ROOT?}"/etc/ssh/ssh_host_*_key*
|
2019-12-17 20:41:16 +00:00
|
|
|
root-fs: /
|
|
|
|
|
|
|
|
# Copy the relevant device tree files to the boot partition
|
|
|
|
- chroot: /
|
|
|
|
shell: |
|
|
|
|
install -m 644 -o root -g root __DTB__ /boot/firmware/
|
|
|
|
|
|
|
|
# Clean up archive cache (likely not useful) and lists (likely outdated) to
|
|
|
|
# reduce image size by several hundred megabytes.
|
|
|
|
- chroot: /
|
|
|
|
shell: |
|
|
|
|
apt-get clean
|
|
|
|
rm -rf /var/lib/apt/lists
|
|
|
|
|
|
|
|
# Modify the kernel commandline we take from the firmware to boot from
|
|
|
|
# the partition labeled raspiroot instead of forcing it to mmcblk0p2
|
|
|
|
- chroot: /
|
|
|
|
shell: |
|
|
|
|
ls -aR /boot
|
|
|
|
sed -i 's/.dev.mmcblk0p2/LABEL=RASPIROOT/' /boot/firmware/cmdline.txt
|
|
|
|
|
|
|
|
# TODO(https://github.com/larswirzenius/vmdb2/issues/24): remove once vmdb
|
|
|
|
# clears /etc/resolv.conf on its own.
|
|
|
|
- shell: |
|
|
|
|
rm "${ROOT?}/etc/resolv.conf"
|
|
|
|
root-fs: /
|