ungleich-tools/debian-devuan-netboot.sh

43 lines
1 KiB
Bash
Raw Normal View History

2019-12-11 14:33:24 +00:00
#!/bin/sh
# Nico Schottelius, 2019-12-09
if [ $# -ne 1 ]; then
echo $0 suite
echo suite is for instance ascii, beowulf, etc
exit 1
fi
suite=$1; shift
date=$(date +%F)
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 linux-image-amd64
cat > ${dir}/etc/network/interfaces << EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet6 auto
EOF
2019-12-14 15:47:35 +00:00
cp ${dir}/boot/vmlinuz-* ${kernel}
#rm ${dir}/boot/initrd*
2019-12-11 14:33:24 +00:00
mkdir -p ${dir}/root/.ssh
for key in balazs dominique jinguk nico; do
curl -s ${keyurl}/${key}.pub >> ${dir}/root/.ssh/authorized_keys
done
# ensure there is /init in the initramfs -> otherwise there is a kernel panic
# reason: initramfs is designed to be PRE regular os, so /init usually hands over to /sbin/init
# in our case, they are just the same
ln -s /sbin/init ${dir}/init
( cd ${dir} ; find . | cpio -H newc -o | gzip -9 > ../${dir}-initramfs )