From d979bd52ceed5a2e9e8f0ea1b3ddf38c6f915f3e Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Fri, 12 Mar 2021 11:52:27 +0100 Subject: [PATCH] [netboot] use key.wf, re-introduce fixing network interfaces --- debian-devuan-netboot.sh | 73 ++++++++++++++++++++++------------------ 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/debian-devuan-netboot.sh b/debian-devuan-netboot.sh index 2858ae4..c83b9cf 100755 --- a/debian-devuan-netboot.sh +++ b/debian-devuan-netboot.sh @@ -25,7 +25,8 @@ chroot_dir=${abs_outdir}/${basename} kernel=${abs_outdir}/kernel-${basename} initramfs=${abs_outdir}/initramfs-${basename} -keyurl=https://code.ungleich.ch/ungleich-public/__ungleich_staff_ssh_access/raw/master/files +#keyurl=https://code.ungleich.ch/ungleich-public/__ungleich_staff_ssh_access/raw/master/files +keyurl=https://key.wf debootstrap "${suite}" "${chroot_dir}" @@ -43,8 +44,8 @@ echo '* * * * * root ip -o -6 addr show | grep -E -v " lo |one" > /etc/issue' > mkdir -p ${chroot_dir}/root/.ssh -for key in fnux balazs dominique jinguk nico; do - curl -s ${keyurl}/${key}.pub >> ${chroot_dir}/root/.ssh/authorized_keys +for key in sami dominique jinguk nico; do + curl -s ${keyurl}/${key} >> ${chroot_dir}/root/.ssh/authorized_keys done # Fix possible permission issue from above @@ -59,6 +60,42 @@ cat > ${chroot_dir}/etc/network/interfaces << EOF auto lo iface lo inet loopback +EOF + +# find the boot interfaces at boot: HP servers still have ifnames=1 +cat > ${chroot_dir}/etc/rc.local <> /etc/network/interfaces << eof +auto \$dev +iface \$dev inet6 auto +eof + +ifup "\${dev}" + +exit 0 +EOF + +chmod a+rx "${chroot_dir}/etc/rc.local" + +# 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 -fs /sbin/init ${chroot_dir}/init + +# Finally building the initramfs +( cd ${chroot_dir} ; find . | cpio -H newc -o | gzip -9 > ${initramfs} ) + +# Fix paranoid permissions +chmod a+rx ${abs_outdir} +chmod a+r ${kernel} ${initramfs} + + +exit 0 + +# I would like to have a generic block like this below +# But as long as interface auto bond0 iface bond0 inet manual bond-miimon 500 @@ -81,33 +118,3 @@ auto bond0.11 iface bond0.11 inet6 auto post-up /sbin/ip link set \$IFACE mtu 9000 vlan-raw-device bond0 -EOF - -# find the boot interfaces at boot - not needed, always eth0/eth1 -# cat > ${chroot_dir}/etc/rc.local < /etc/network/interfaces.d/bootinterface << eof -# auto \$dev -# iface \$dev inet6 auto -# eof - -# ifup "\${dev}" - -# exit 0 -# EOF - -# chmod a+rx "${chroot_dir}/etc/rc.local" - -# 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 -fs /sbin/init ${chroot_dir}/init - -# Finally building the initramfs -( cd ${chroot_dir} ; find . | cpio -H newc -o | gzip -9 > ${initramfs} ) - -# Fix paranoid permissions -chmod a+rx ${abs_outdir} -chmod a+r ${kernel} ${initramfs}