Browse Source

removed all direct references to /proc/cmdline

use getarg() and getargs() from /lib/dracut-lib.sh instead of
reinventing the wheel
master
Harald Hoyer 16 years ago
parent
commit
3e6d2b31ea
  1. 6
      modules.d/40network/ifup
  2. 24
      modules.d/40network/parse-ip-opts.sh
  3. 11
      modules.d/99base/parse-blacklist.sh

6
modules.d/40network/ifup

@ -100,10 +100,8 @@ ip=$(getarg ip) @@ -100,10 +100,8 @@ ip=$(getarg ip)

# Specific configuration, spin through the kernel command line
# looking for ip= lines
[ "$CMDLINE" ] || read CMDLINE </proc/cmdline;
for p in $CMDLINE; do
[ -n "${p%ip=*}" ] && continue
ip_to_var ${p#ip=}
for p in $(getargs ip=); do
ip_to_var $p
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue

24
modules.d/40network/parse-ip-opts.sh

@ -52,10 +52,9 @@ fi @@ -52,10 +52,9 @@ fi

# Count ip= lines to decide whether we need bootdev= or not
if [ -z "$NEEDBOOTDEV" ] ; then
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
local count=0
for p in $CMDLINE; do
[ "${p%%=*}" = "ip" ] && count=$(( $count + 1 ))
for p in $(getargs ip=); do
count=$(( $count + 1 ))
done
[ $count -gt 1 ] && NEEDBOOTDEV=1
fi
@ -68,11 +67,8 @@ fi @@ -68,11 +67,8 @@ fi

# Check ip= lines
# XXX Would be nice if we could errorcheck ip addresses here as well
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
for p in $CMDLINE; do
[ -n "${p%ip=*}" ] && continue

ip_to_var ${p#ip=}
for p in $(getargs ip=); do
ip_to_var $p

# We need to have an ip= line for the specified bootdev
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
@ -85,28 +81,28 @@ for p in $CMDLINE; do @@ -85,28 +81,28 @@ for p in $CMDLINE; do

# Error checking for autoconf in combination with other values
case $autoconf in
error) die "Error parsing option '$p'";;
error) die "Error parsing option 'ip=$p'";;
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
none|off) \
[ -z "$ip" ] && \
die "For argument '$p'\nValue '$autoconf' without static configuration does not make sense"
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
[ -z "$mask" ] && \
die "Sorry, automatic calculation of netmask is not yet supported"
;;
dhcp|on|any) \
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
die "Sorry, '$p' does not make sense for multiple interface configurations"
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
[ -n "$ip" ] && \
die "For argument '$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
;;
*) die "For argument '$p'\nSorry, unknown value '$autoconf'";;
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
esac

if [ -n "$dev" ] ; then
# We don't like duplicate device configs
if [ -n "$IFACES" ] ; then
for i in $IFACES ; do
[ "$dev" = "$i" ] && die "For argument '$p'\nDuplication configurations for '$dev'"
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
done
fi
# IFACES list for later use

11
modules.d/99base/parse-blacklist.sh

@ -1,10 +1,5 @@ @@ -1,10 +1,5 @@
#!/bin/sh

if getarg rdblacklist= >/dev/null ; then
[ "$CMDLINE" ] || read CMDLINE < /proc/cmdline
for p in $CMDLINE; do
[ -n "${p%rdblacklist=*}" ] && continue

echo "blacklist ${p#rdblacklist=}" >> /etc/modprobe.d/initramfsblacklist.conf
done
fi
for p in $(getargs rdblacklist=); do
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
done

Loading…
Cancel
Save