From 4d348ab724614d6d72119bbcdceab960464d3b54 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sun, 18 Oct 2020 09:47:53 +0200 Subject: [PATCH] Update working script. --- alpine-rebuild-initramfs.sh | 47 +++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/alpine-rebuild-initramfs.sh b/alpine-rebuild-initramfs.sh index 8913924..668e0cb 100755 --- a/alpine-rebuild-initramfs.sh +++ b/alpine-rebuild-initramfs.sh @@ -19,7 +19,7 @@ RESOLVCONF=/etc/resolv.conf working_directory=$(pwd -P) rootfs_tmpdir=$(mktemp -d) -rootfs_tmpdir=alpine_${MAJOR_VERSION}-${MINOR_VERSION}-rootfs +#rootfs_tmpdir=alpine_${MAJOR_VERSION}-${MINOR_VERSION}-rootfs mkdir -p ${rootfs_tmpdir} @@ -31,7 +31,7 @@ run_root () { /bin/sh -c "$*" } -wget -c "$rootfs_url" -O "$working_directory/$IMAGE" +wget -c "$rootfs_url" -O "$IMAGE" # keep right permissions, use sudo sudo tar xf $IMAGE -C $rootfs_tmpdir @@ -47,25 +47,42 @@ run_root chmod 0700 root/.ssh sudo cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf # Make sure init is found by the kernel. -#run_root ln -sf /sbin/init /init +run_root ln -sf /sbin/init /init - -# Layer atop base rootfs. run_root apk update -run_root apk upgrade -run_root apk add openssh linux-lts openrc udev ndisc6 - +run_root apk add linux-lts openrc udev openssh rdnssd run_root rc-update add udev run_root rc-update add udev-trigger run_root rc-update add sshd -run_root rc-update add networking -run_root rc-update add hostname run_root rc-update add rdnssd +# Layer atop base rootfs. +# run_root apk add openssh linux-lts openrc udev ndisc6 + + +# run_root rc-update add networking +# run_root rc-update add hostname +# run_root rc-update add rdnssd + + +sudo tee "$rootfs_tmpdir/etc/network/interfaces" < /proc/sys/net/ipv6/conf/eth0/accept_ra +EOF + # Generate iniramfs image (cd $rootfs_tmpdir; sudo find . | sudo cpio -H newc -o | gzip -9 > "$working_directory/alpine-initramfs.gz") cp "$rootfs_tmpdir/boot/vmlinuz-lts" "$working_directory/alpine-kernel" +echo rm -rf "$rootfs_tmpdir" + +exit 0 + # Servers have static addresses, disable the standard # alpine setting of using tempaddr = 2 @@ -76,16 +93,6 @@ net.ipv6.conf.all.use_tempaddr = 0 net.ipv6.conf.all.accept_ra = 1 EOF -sudo tee "$rootfs_tmpdir/etc/network/interfaces" <> /etc/issue -EOF sudo tee "$rootfs_tmpdir/etc/hostname" <