ungleich-tools/devuan-netboot.sh

38 lines
812 B
Bash
Raw Normal View History

2019-12-09 18:43:41 +00:00
#!/bin/sh
# Nico Schottelius, 2019-12-09
2019-12-09 19:01:46 +00:00
if [ $# -ne 1 ]; then
echo $0 suite
echo suite is for instance ascii, beowulf, etc
2019-12-09 19:02:21 +00:00
exit 1
2019-12-09 19:01:46 +00:00
fi
suite=$1; shift
2019-12-09 18:43:41 +00:00
date=$(date +%F)
2019-12-09 18:57:57 +00:00
dir=${suite}-${date}
kernel=${dir}-kernel
keyurl=https://code.ungleich.ch/ungleich-public/__ungleich_staff_ssh_access/raw/master/files
2019-12-09 18:43:41 +00:00
debootstrap "${suite}" "${dir}"
2019-12-09 18:57:57 +00:00
chroot ${dir} apt install -y openssh-server rdnssd linux-image-amd64
2019-12-09 18:43:41 +00:00
cat > ${dir}/etc/network/interfaces << EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet6 auto
EOF
2019-12-09 18:57:57 +00:00
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 )