Skip to content

Commit

Permalink
Skip lo device in alpine network config
Browse files Browse the repository at this point in the history
Signed-off-by: Itxaka <[email protected]>
  • Loading branch information
Itxaka committed Oct 3, 2024
1 parent f921c38 commit 21a0071
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/alpine/collection.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
packages:
- name: "alpine"
category: "initrd"
version: "3.8.2-1"
version: "3.8.2-2"
description: "Provides custom initrd scripts for alpine"
# This syncs with the alpine version at https://gitlab.alpinelinux.org/alpine/mkinitfs/-/blob/master/initramfs-init.in?ref_type=heads
# any changes to the initramfs-init.in file should be looked at and backported if necessary
10 changes: 7 additions & 3 deletions packages/alpine/files/initramfs-init
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

VERSION=3.8.2-kairos3
VERSION=3.8.2-kairos4
INIT=/sbin/init
sysroot="$ROOT"/sysroot
# This is where we mount the livecd
Expand Down Expand Up @@ -212,6 +212,8 @@ retry() {
# uses the first network interface with state 'up'.
ip_choose_if() {
for x in "$ROOT"/sys/class/net/*; do
# skip lo device
if [ "${x##*/}" == "lo" ];then continue; fi
if grep -iq up $x/operstate 2>/dev/null;then
[ -e "$x" ] && echo ${x##*/} && return
fi
Expand All @@ -220,7 +222,9 @@ ip_choose_if() {
}

device_up() {
for x in "$ROOT"/sys/class/net/eth*; do
for x in "$ROOT"/sys/class/net/*; do
# skip lo device
if [ "${x##*/}" == "lo" ];then continue; fi
if grep -iq up $x/operstate 2>/dev/null;then
[ -e "$x" ] && echo "Found up device: ${x##*/}" && return
fi
Expand All @@ -230,7 +234,7 @@ device_up() {

configure_ip() {
# Sometimes it takes a bit for the device to come in UP state
# so first check fi any eth devices are in UP state before getting the device
# so first check for any eth devices are in UP state before getting the device
retry 5 device_up

device=$(ip_choose_if)
Expand Down

0 comments on commit 21a0071

Please sign in to comment.