eth-eni-setup init script (#87)
* eth-eni-setup init script before networking starts up, makes sure eth interfaces match attached ENIs also fixes a permissions problem with eth-eni-hotplug mdev config * fix aarch64 build
This commit is contained in:
parent
88e5a6d9cc
commit
e42c833553
|
@ -3,7 +3,7 @@
|
|||
|
||||
arch = "aarch64"
|
||||
build_arch = "arm64"
|
||||
build_instance_type = "a1.medium"
|
||||
build_instance_type = "t4g.nano"
|
||||
apk_tools = "https://github.com/alpinelinux/apk-tools/releases/download/v2.10.3/apk-tools-2.10.3-aarch64-linux.tar.gz"
|
||||
apk_tools_sha256 = "58a07e547c83c3a30eb0a0bd73db57d6bbaf92cc093df7a1d9805631f7d349e3"
|
||||
alpine_keys = "http://dl-cdn.alpinelinux.org/alpine/v3.12/main/aarch64/alpine-keys-2.2-r0.apk"
|
||||
|
|
|
@ -76,6 +76,7 @@ svcs {
|
|||
}
|
||||
default {
|
||||
chronyd = true
|
||||
eth-eni-setup = true
|
||||
networking = true
|
||||
sshd = true
|
||||
tiny-ec2-bootstrap = true
|
||||
|
|
|
@ -75,6 +75,7 @@ svcs {
|
|||
}
|
||||
default {
|
||||
chronyd = true
|
||||
eth-eni-setup = true
|
||||
networking = true
|
||||
sshd = true
|
||||
tiny-ec2-bootstrap = true
|
||||
|
|
|
@ -221,7 +221,7 @@ install_grub_efi() {
|
|||
|
||||
# install default grub config
|
||||
install -o root -g root -Dm644 -t "$TARGET/etc/default" \
|
||||
"$SETUP/etc/grub.default" grub
|
||||
"$SETUP/etc/grub"
|
||||
|
||||
# generate/install new config
|
||||
chroot "$TARGET" grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
@ -253,6 +253,10 @@ setup_networking() {
|
|||
ln -sf /usr/share/udhcpc/eth-eni-hook \
|
||||
"$TARGET/etc/udhcpc/$i"
|
||||
done
|
||||
|
||||
# install ENI interface setup init script
|
||||
install -o root -g root -Dm755 -t "$TARGET/etc/init.d" \
|
||||
"$SETUP/eth-eni-setup"
|
||||
}
|
||||
|
||||
enable_services() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# additional ENIs
|
||||
eth[1-9] root:root 0666 */lib/mdev/eth-eni-hotplug
|
||||
eth[1-9] root:root 0644 */lib/mdev/eth-eni-hotplug
|
||||
|
||||
# EBS NVMe links
|
||||
nvme[0-9]+n[0-9]+.* root:root 0660 */lib/mdev/nvme-ebs-links
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
#!/sbin/openrc-run
|
||||
|
||||
description="Sets up interfaces for attached Elastic Network Interfaces"
|
||||
|
||||
IFACE_CFG=/etc/network/interfaces
|
||||
|
||||
depend() {
|
||||
before net
|
||||
need sysfs
|
||||
}
|
||||
|
||||
eni_eths() {
|
||||
local iface
|
||||
for iface in /sys/class/net/eth*; do
|
||||
echo "${iface##*/}"
|
||||
done
|
||||
}
|
||||
|
||||
start() {
|
||||
local iface
|
||||
|
||||
ebegin "Setting up interfaces for attached ENIs"
|
||||
|
||||
cat "$IFACE_CFG.d/lo" > "$IFACE_CFG.new"
|
||||
|
||||
for iface in $(eni_eths); do
|
||||
[ -f "$IFACE_CFG.d/$iface" ] ||
|
||||
sed -e "s/%%/$iface/g" "$IFACE_CFG.d/DEFAULT" > "$IFACE_CFG.d/$iface"
|
||||
cat "$IFACE_CFG.d/$iface" >> "$IFACE_CFG.new"
|
||||
einfo "$iface configured"
|
||||
done
|
||||
|
||||
mv "$IFACE_CFG.new" "$IFACE_CFG"
|
||||
|
||||
eend "$?"
|
||||
}
|
Loading…
Reference in New Issue