Update working script.

This commit is contained in:
Nico Schottelius 2020-10-18 09:47:53 +02:00
parent 76ff02656d
commit 4d348ab724
1 changed files with 27 additions and 20 deletions

View File

@ -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" <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet6 manual
pre-up ip link set eth0 up
pre-up echo 1 > /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" <<EOF
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet6 manual
pre-up ip link set eth0 up
post-up sleep 10
post-up ip addr show dev eth0 | grep inet6 >> /etc/issue
EOF
sudo tee "$rootfs_tmpdir/etc/hostname" <<EOF
alpine-unconfigured