[alpine] update for stuff

This commit is contained in:
Nico Schottelius 2019-12-01 00:38:13 +01:00
parent 1d1079bfc7
commit 080922ac39
1 changed files with 15 additions and 12 deletions

View File

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