Enable network by default on alpine initramfs (#495)

This commit is contained in:
Itxaka 2023-10-17 15:37:49 +02:00 committed by GitHub
parent 9b49d6aacd
commit eedc37677d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 24 additions and 8 deletions

View File

@ -1,7 +1,7 @@
packages: packages:
- name: "alpine" - name: "alpine"
category: "distro-kernel" category: "distro-kernel"
version: "6.1.56-5" version: "6.1.56-6"
description: "Provides kernel and custom initrd for alpine" description: "Provides kernel and custom initrd for alpine"
labels: labels:
autobump.strategy: "custom" autobump.strategy: "custom"
@ -14,7 +14,7 @@ packages:
package.version: "6.1.56" package.version: "6.1.56"
- name: "alpine-rpi" - name: "alpine-rpi"
category: "distro-kernel" category: "distro-kernel"
version: "6.1.55-5" version: "6.1.55-6"
description: "Provides kernel and custom initrd for alpine" description: "Provides kernel and custom initrd for alpine"
labels: labels:
autobump.strategy: "custom" autobump.strategy: "custom"

View File

@ -23,6 +23,18 @@ eend() {
fi fi
} }
# same as eend but this wont drop us to a shell and continue booting
eend_no_break() {
if [ "$1" = 0 ] || [ $# -lt 1 ] ; then
echo "$last_emsg: ok." > "$ROOT"/dev/kmsg
echo "ok."
else
shift
echo "$last_emsg: failed. $*" > "$ROOT"/dev/kmsg
echo "failed. $*"
fi
}
# find mount dir and mount opts for given device in an fstab # find mount dir and mount opts for given device in an fstab
get_fstab_mount_info() { get_fstab_mount_info() {
local search_dev="$1" local search_dev="$1"
@ -217,18 +229,22 @@ configure_ip() {
if [ -z "$device" ]; then if [ -z "$device" ]; then
echo "ERROR: IP requested but no network device was found" echo "ERROR: IP requested but no network device was found"
return 1 return 0
fi fi
# automatic configuration # automatic configuration
if [ ! -e "$ROOT"/usr/share/udhcpc/default.script ]; then if [ ! -e "$ROOT"/usr/share/udhcpc/default.script ]; then
echo "ERROR: DHCP requested but not present in initrd" echo "ERROR: DHCP requested but not present in initrd"
return 1 return 0
fi fi
ebegin "Obtaining IP via DHCP ($device)" ebegin "Obtaining IP via DHCP ($device)"
ifconfig "$device" 0.0.0.0 ifconfig "$device" 0.0.0.0
udhcpc -i "$device" -f -q # -q and -n means exit if got a lease or dont
eend $? # -S means log to syslog
# -A 10 is the timeout
udhcpc -i "$device" -f -q -n -S -A 10
eend_no_break $?
return 0
} }
is_url() { is_url() {
@ -334,8 +350,8 @@ rd_break pre-udev
rd_break post-udev rd_break post-udev
rd_break pre-network rd_break pre-network
# Mount network if we got rd.neednet=1 or netboot # Dont enable network if we got rd.neednet=0, otherwise do it by default
if grep -q "rd.neednet=1" /proc/cmdline || grep -q netboot /proc/cmdline ;then if grep -vq "rd.neednet=0" /proc/cmdline;then
configure_ip configure_ip
fi fi
rd_break post-network rd_break post-network