Turn the original hook into a toaster recipe.

This commit is contained in:
Cyril Brulebois 2024-07-20 07:52:53 +02:00
parent c5254d41b4
commit 9ede6bb93f

View File

@ -1,25 +1,30 @@
echo "nameserver 1.1.1.1" > /etc/resolv.conf # This recipe is sourced by the toaster, don't try to run it!
# Install minimal tools
apt-get update # shellcheck disable=SC2086
apt-get install wget sudo avahi-daemon -y toast_me() {
apt-get clean echo "nameserver 1.1.1.1" > $MNT/etc/resolv.conf
# Ensure we have the pi user # Install minimal tools
useradd -s /bin/bash -Gsudo -m pi chroot $MNT apt-get update
usermod -aG plugdev pi chroot $MNT apt-get install -y wget sudo avahi-daemon
echo "pi:raspberry" | chpasswd chroot $MNT apt-get clean
# Disable root login on SSH # Ensure we have the pi user
mkdir -p /etc/ssh/sshd_config.d/ chroot $MNT useradd -s /bin/bash -Gsudo -m pi
echo "PermitEmptyPasswords no" > /etc/ssh/sshd_config.d/pirogue-ssh.conf chroot $MNT usermod -aG plugdev pi
echo "PermitRootLogin no" >> /etc/ssh/sshd_config.d/pirogue-ssh.conf echo "pi:raspberry" | chroot $MNT chpasswd
# Force egenerate SSH host keys if exist and enable SSH # Disable root login on SSH
rm -f /etc/ssh/ssh_host_* mkdir -p $MNT/etc/ssh/sshd_config.d/
systemctl enable ssh echo "PermitEmptyPasswords no" > $MNT/etc/ssh/sshd_config.d/pirogue-ssh.conf
# Change the hostname echo "PermitRootLogin no" >> $MNT/etc/ssh/sshd_config.d/pirogue-ssh.conf
echo "127.0.0.1 pirogue" >> /etc/hosts # Force generate SSH host keys if they exist and enable SSH
echo "127.0.0.1 pirogue.local pirogue" >> /etc/hosts rm -f $MNT/etc/ssh/ssh_host_*
echo "::1 pirogue" >> /etc/hosts chroot $MNT systemctl enable ssh
echo "::1 pirogue.local pirogue" >> /etc/hosts # Change the hostname
echo "pirogue" > /etc/hostname echo "127.0.0.1 pirogue" >> $MNT/etc/hosts
# Add PTS PPA echo "127.0.0.1 pirogue.local pirogue" >> $MNT/etc/hosts
wget -O /etc/apt/sources.list.d/pirogue.list https://pts-project.org/debian-12/pirogue.list echo "::1 pirogue" >> $MNT/etc/hosts
wget -O /etc/apt/trusted.gpg.d/pirogue.asc https://pts-project.org/debian-12/Key.gpg echo "::1 pirogue.local pirogue" >> $MNT/etc/hosts
echo "pirogue" > $MNT/etc/hostname
# 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/trusted.gpg.d/pirogue.asc https://pts-project.org/debian-12/Key.gpg
}