[alpine] setup bond0 by default

This commit is contained in:
Nico Schottelius 2021-03-14 17:06:28 +01:00
parent 6a6f9850b6
commit 6891dfe41a

View file

@ -12,7 +12,7 @@ set -x
SSH_KEYS=$1; shift SSH_KEYS=$1; shift
MAJOR_VERSION=3.13 MAJOR_VERSION=3.13
MINOR_VERSION=1 MINOR_VERSION=2
IMAGE=alpine-minirootfs-$MAJOR_VERSION.$MINOR_VERSION-x86_64.tar.gz IMAGE=alpine-minirootfs-$MAJOR_VERSION.$MINOR_VERSION-x86_64.tar.gz
RESOLVCONF=/etc/resolv.conf RESOLVCONF=/etc/resolv.conf
@ -21,6 +21,9 @@ 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
initramfs="$working_directory/initramfs-alpine-${MAJOR_VERSION}.${MINOR_VERSION}"
kernel="$working_directory/kernel-alpine-${MAJOR_VERSION}.${MINOR_VERSION}"
mkdir -p ${rootfs_tmpdir} mkdir -p ${rootfs_tmpdir}
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"
@ -66,19 +69,39 @@ iface lo inet loopback
auto eth0 auto eth0
iface eth0 inet6 manual iface eth0 inet6 manual
pre-up ip link set eth0 up bond-master bond0
post-up /sbin/ip link set \$IFACE up
post-up /sbin/ip link set \$IFACE mtu 9000
auto eth1
iface eth1 inet6 manual
bond-master bond0
post-up /sbin/ip link set \$IFACE up
post-up /sbin/ip link set \$IFACE mtu 9000
auto bond0
iface bond0 inet6 manual
bond-miimon 500
bond-mode 4
post-up /sbin/ip link set \$IFACE up
post-up /sbin/ip link set \$IFACE mtu 9000
bond-slaves none
EOF EOF
sudo tee "$rootfs_tmpdir/etc/hostname" <<EOF sudo tee "$rootfs_tmpdir/etc/hostname" <<EOF
alpine-unconfigured alpine-unconfigured
EOF EOF
# Cleanup resolv.conf
run_root rm -f /etc/resolv.conf
# Generate iniramfs image # Generate iniramfs image
(cd $rootfs_tmpdir; sudo find . | sudo cpio -H newc -o | gzip -9 > "$working_directory/alpine-initramfs.gz") (cd $rootfs_tmpdir; sudo find . | sudo cpio -H newc -o | gzip -9 > ${initramfs})
cp "$rootfs_tmpdir/boot/vmlinuz-lts" "$working_directory/alpine-kernel" cp "$rootfs_tmpdir/boot/vmlinuz-lts" "${kernel}"
echo rm -rf "$rootfs_tmpdir" echo rm -rf "$rootfs_tmpdir"
echo "Use alpine-initramfs.gz alpine-kernel from $working_directory"! echo "Use ${initramfs} and ${kernel} from $working_directory"!
exit 0 exit 0