From 5e5e37a7d737f6743572656f5e24a7d3c83026eb Mon Sep 17 00:00:00 2001
From: Nico Schottelius <nico@nico-notebook.schottelius.org>
Date: Mon, 9 Dec 2019 19:57:57 +0100
Subject: [PATCH] [netboot] add ssh keys

---
 devuan-netboot.sh | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/devuan-netboot.sh b/devuan-netboot.sh
index c47c92b..066472e 100644
--- a/devuan-netboot.sh
+++ b/devuan-netboot.sh
@@ -5,10 +5,12 @@
 date=$(date +%F)
 suite=ascii
 
-dir=${suit}-${date}
+dir=${suite}-${date}
+kernel=${dir}-kernel
+keyurl=https://code.ungleich.ch/ungleich-public/__ungleich_staff_ssh_access/raw/master/files
 
 debootstrap "${suite}" "${dir}"
-chroot ${dir} apt install  -y  openssh-server rdnssd
+chroot ${dir} apt install  -y  openssh-server rdnssd linux-image-amd64
 
 cat > ${dir}/etc/network/interfaces << EOF
 auto lo
@@ -17,3 +19,13 @@ iface lo inet loopback
 auto eth0
 iface eth0 inet6 auto
 EOF
+
+mv ${dir}/boot/vmlinuz-* ${kernel}
+rm ${dir}/boot/initrd*
+mkdir -p ${dir}/root/.ssh
+
+for key in balazs dominique jinguk nico; do
+    curl -s ${keyurl}/${key}.pub >> ${dir}/root/.ssh/authorized_keys
+done
+
+( cd ${dir} ; find . | cpio -H newc -o | gzip -9 > ../${dir}-initramfs )