[alpine] update for stuff

This commit is contained in:
Nico Schottelius 2019-12-01 00:38:13 +01:00
parent 1d1079bfc7
commit 080922ac39

View file

@ -29,27 +29,28 @@ curl "$rootfs_url" -o "$working_directory/$IMAGE"
tar xf $IMAGE -C $rootfs_tmpdir tar xf $IMAGE -C $rootfs_tmpdir
# Add SSH keys # Add SSH keys
run_root mkdir root/.ssh run_root mkdir -p root/.ssh
echo $SSH_KEYS > $rootfs_tmpdir/root/.ssh/authorized_keys echo $SSH_KEYS > $rootfs_tmpdir/root/.ssh/authorized_keys
run_root chmod 0600 root/.ssh/authorized_keys run_root chmod 0600 root/.ssh/authorized_keys
run_root chmod 0700 root/.ssh run_root chmod 0700 root/.ssh
# Import local resolv.conf. # Import local resolv.conf.
cat $RESOLVCONF > $rootfs_tmpdir/etc/resolv.conf cat "$RESOLVCONF" > $rootfs_tmpdir/etc/resolv.conf
# Make sure init is found by the kernel. # Make sure init is found by the kernel.
run_root ln -s /sbin/init /init run_root ln -s /sbin/init /init
cat > $rootfs_tmpdir/etc/network/interfaces <<EOF cat > "$rootfs_tmpdir/etc/network/interfaces" <<EOF
auto lo auto lo
iface lo inet loopback iface lo inet loopback
auto eth0 auto eth0
iface eth0 inet6 auto iface eth0 inet6 manual
post-up ip addr show dev eth0 | grep inet6 | tee -a /etc/issue pre-up modprobe ipv6 && sysctl -w net.ipv6.conf.eth0.accept_ra=1
post-up ip addr show dev eth0 | grep inet6 >> /etc/issue
EOF EOF
cat > $rootfs_tmpdir/etc/hostname <<EOF cat > "$rootfs_tmpdir/etc/hostname" <<EOF
alpine-unconfigured alpine-unconfigured
EOF EOF
@ -62,13 +63,15 @@ run_root rc-update add sshd
run_root rc-update add networking run_root rc-update add networking
run_root rc-update add hostname run_root rc-update add hostname
# FIXME: add / install rdnssd / ndisc6 / start it on boot
# ndisc6 is only @testing
# Generate iniramfs image # Generate iniramfs image
(cd $rootfs_tmpdir; find . | cpio -H newc -o | gzip -9 > "$working_directory/alpine-initramfs.gz") (cd $rootfs_tmpdir; find . | cpio -H newc -o | gzip -9 > "$working_directory/alpine-initramfs.gz")
cp $rootfs_tmpdir/boot/vmlinuz-vanilla "$working_directory/alpine-kernel" cp "$rootfs_tmpdir/boot/vmlinuz-vanilla" "$working_directory/alpine-kernel"
# Upload to netboot server.
scp alpine-initramfs.gz alpine-kernel root@netboot.hack4glarus.ungleich.cloud:/var/www/html/
# Cleanup. # Cleanup.
rm -r $rootfs_tmpdir rm -r "$rootfs_tmpdir"
(cd "$working_directory/"; rm vmlinuz-vanilla alpine-kernel $IMAGE)
# Upload to netboot server. - needs to be done outside sudo
echo "Use alpine-initramfs.gz alpine-kernel from $working_directory"!