Split into blocks for readability.

This commit is contained in:
Cyril Brulebois 2024-07-20 14:35:44 +02:00
parent f14ea9817c
commit a6f8c1fdf5

View File

@ -3,15 +3,18 @@
# shellcheck disable=SC2086 # shellcheck disable=SC2086
toast_me() { toast_me() {
echo "nameserver 1.1.1.1" > $MNT/etc/resolv.conf echo "nameserver 1.1.1.1" > $MNT/etc/resolv.conf
# Install minimal tools # Install minimal tools
chroot $MNT apt-get update chroot $MNT apt-get update
chroot $MNT apt-get install -y wget sudo avahi-daemon chroot $MNT apt-get install -y wget sudo avahi-daemon
chroot $MNT apt-get clean chroot $MNT apt-get clean
# Ensure we have the pi user # Ensure we have the pi user
chroot $MNT adduser --disabled-password --gecos '' pi chroot $MNT adduser --disabled-password --gecos '' pi
chroot $MNT adduser pi sudo chroot $MNT adduser pi sudo
chroot $MNT adduser pi plugdev chroot $MNT adduser pi plugdev
echo "pi:raspberry" | chroot $MNT chpasswd echo "pi:raspberry" | chroot $MNT chpasswd
# Let's make sure we don't ship any SSH host keys. Also work around upstream # Let's make sure we don't ship any SSH host keys. Also work around upstream
# bug leading ssh.service to try and start before SSH host keys have been # bug leading ssh.service to try and start before SSH host keys have been
# generated (https://salsa.debian.org/raspi-team/image-specs/-/issues/72): # generated (https://salsa.debian.org/raspi-team/image-specs/-/issues/72):
@ -21,10 +24,12 @@ toast_me() {
chroot $MNT systemctl disable ssh.service chroot $MNT systemctl disable ssh.service
sed '/^ExecStart=/a ExecStart=/usr/bin/systemctl enable --now ssh.service' \ sed '/^ExecStart=/a ExecStart=/usr/bin/systemctl enable --now ssh.service' \
-i $MNT/etc/systemd/system/rpi-generate-ssh-host-keys.service -i $MNT/etc/systemd/system/rpi-generate-ssh-host-keys.service
# Change the hostname # Change the hostname
echo "127.0.1.1 pirogue.local pirogue" >> $MNT/etc/hosts echo "127.0.1.1 pirogue.local pirogue" >> $MNT/etc/hosts
echo "::1 pirogue.local pirogue" >> $MNT/etc/hosts echo "::1 pirogue.local pirogue" >> $MNT/etc/hosts
echo "pirogue" > $MNT/etc/hostname echo "pirogue" > $MNT/etc/hostname
# Add PTS PPA # Add PTS PPA
chroot $MNT wget -O /etc/apt/sources.list.d/pirogue.list https://pts-project.org/debian-12/pirogue.list chroot $MNT wget -O /etc/apt/sources.list.d/pirogue.list https://pts-project.org/debian-12/pirogue.list
chroot $MNT wget -O /etc/apt/trusted.gpg.d/pirogue.asc https://pts-project.org/debian-12/Key.gpg chroot $MNT wget -O /etc/apt/trusted.gpg.d/pirogue.asc https://pts-project.org/debian-12/Key.gpg