Alpine updates

- use current dir as working dir
- add network config
- add hostname
This commit is contained in:
Nico Schottelius 2019-12-01 00:10:32 +01:00
parent 00fc553026
commit e0831f8b68

View file

@ -9,7 +9,7 @@ IMAGE=alpine-minirootfs-$MAJOR_VERSION.$MINOR_VERSION-x86_64.tar.gz
SSH_KEYS=$(cat ~/.ssh/id_rsa.pub) SSH_KEYS=$(cat ~/.ssh/id_rsa.pub)
RESOLVCONF=/etc/resolv.conf RESOLVCONF=/etc/resolv.conf
working_directory=$(dirname $0) working_directory=$(pwd -P)
rootfs_tmpdir=$(mktemp -d) rootfs_tmpdir=$(mktemp -d)
rootfs_url="http://dl-cdn.alpinelinux.org/alpine/v$MAJOR_VERSION/releases/x86_64/$IMAGE" rootfs_url="http://dl-cdn.alpinelinux.org/alpine/v$MAJOR_VERSION/releases/x86_64/$IMAGE"
@ -40,12 +40,26 @@ 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
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
EOF
cat > $rootfs_tmpdir/etc/hostname <<EOF
alpine-unconfigured
EOF
# Layer atop base rootfs. # Layer atop base rootfs.
run_root apk update run_root apk update
run_root apk upgrade run_root apk upgrade
run_root apk add openssh linux-vanilla openrc udev run_root apk add openssh linux-vanilla openrc udev
run_root rc-update add udev run_root rc-update add udev
run_root rc-update add sshd run_root rc-update add sshd
run_root rc-update add networking
# 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")