[alpine buildr] unlock root, add rdnssd

This commit is contained in:
Nico Schottelius 2021-02-09 12:50:55 +01:00
parent 595f402ced
commit 1b720cfab6
1 changed files with 8 additions and 8 deletions

View File

@ -18,8 +18,8 @@ IMAGE=alpine-minirootfs-$MAJOR_VERSION.$MINOR_VERSION-x86_64.tar.gz
RESOLVCONF=/etc/resolv.conf RESOLVCONF=/etc/resolv.conf
working_directory=$(pwd -P) working_directory=$(pwd -P)
rootfs_tmpdir=$(mktemp -d) #rootfs_tmpdir=$(mktemp -d)
#rootfs_tmpdir=alpine_${MAJOR_VERSION}-${MINOR_VERSION}-rootfs rootfs_tmpdir=alpine_${MAJOR_VERSION}-${MINOR_VERSION}-rootfs
mkdir -p ${rootfs_tmpdir} mkdir -p ${rootfs_tmpdir}
@ -39,9 +39,9 @@ sudo tar xf $IMAGE -C $rootfs_tmpdir
# Add SSH keys # Add SSH keys
run_root mkdir -p root/.ssh run_root mkdir -p root/.ssh
sudo cp $SSH_KEYS $rootfs_tmpdir/root/.ssh/authorized_keys sudo cp $SSH_KEYS $rootfs_tmpdir/root/.ssh/authorized_keys
run_root chown root:root root/.ssh/authorized_keys run_root chown root:root /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.
sudo cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf sudo cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf
@ -50,14 +50,15 @@ sudo cp "$RESOLVCONF" $rootfs_tmpdir/etc/resolv.conf
run_root ln -sf /sbin/init /init run_root ln -sf /sbin/init /init
run_root apk update run_root apk update
run_root apk add linux-lts openrc udev openssh run_root apk add linux-lts openrc udev openssh rdnssd
# rdnssd # rdnssd
run_root rc-update add udev run_root rc-update add udev
run_root rc-update add udev-trigger run_root rc-update add udev-trigger
run_root rc-update add sshd run_root rc-update add sshd
# run_root rc-update add rdnssd run_root rc-update add rdnssd
run_root rc-update add networking run_root rc-update add networking
run_root rc-update add hostname run_root rc-update add hostname
run_root sed -i 's/root:!::0:::::/root:::0:::::/' /etc/shadow
sudo tee "$rootfs_tmpdir/etc/network/interfaces" <<EOF sudo tee "$rootfs_tmpdir/etc/network/interfaces" <<EOF
auto lo auto lo
@ -66,7 +67,6 @@ iface lo inet loopback
auto eth0 auto eth0
iface eth0 inet6 manual iface eth0 inet6 manual
pre-up ip link set eth0 up pre-up ip link set eth0 up
pre-up echo 1 > /proc/sys/net/ipv6/conf/eth0/accept_ra
EOF EOF
sudo tee "$rootfs_tmpdir/etc/hostname" <<EOF sudo tee "$rootfs_tmpdir/etc/hostname" <<EOF