Accepting request 232233 from home:trenn:branches:Base:System

- Update to lateste git HEAD 48b7ab1b35adf1f3f09f883ef14ea0a3fba1e468
    Added:     dracut_v37_to_HEAD.patch
    Modified:  0013-Correct-paths-for-openSUSE.patch
    Modified:  mdraid-setup.patch
    Modified:  replace_dhclient_with_wickedd_dhcp_supplicants.patch
    Deleted:   0018-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch
    Deleted:   0019-dracut-initqueue-service-runs-before-remote-fs-pre.t.patch
- Fix lvm and other possible not working thing due to new parameter:
  hostonly-cmdline which has to be active by default
    bnc#874000 bnc#874905 bnc#874363
    Added:     mkinird_differ_host_and_cmdline_only_properly.patch
- Make write-ifcfg-suse.sh more update robust
  Avoid rebasing of diff with every update touching this file by adding
  write-ifcfg-suse.sh as source file and copy/link in .spec file.
    Modified:  change_write_ifcfg_to_suse.patch

OBS-URL: https://build.opensuse.org/request/show/232233
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=138
This commit is contained in:
Thomas Renninger 2014-04-30 15:29:13 +00:00 committed by Git OBS Bridge
parent 8bff301767
commit 30c51ef231
11 changed files with 1014 additions and 880 deletions

View File

@ -14,11 +14,11 @@ Signed-off-by: Hannes Reinecke <hare@suse.de>
modules.d/98systemd/rescue.service | 2 +-
3 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index c1ef474..dddb488 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -774,7 +774,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
Index: dracut-037/dracut.sh
===================================================================
--- dracut-037.orig/dracut.sh
+++ dracut-037/dracut.sh
@@ -774,7 +774,7 @@ stdloglvl=$((stdloglvl + verbosity_mod_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
@ -27,10 +27,10 @@ index c1ef474..dddb488 100755
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
[[ $tmpdir ]] || tmpdir=/var/tmp
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
diff --git a/modules.d/10i18n/module-setup.sh b/modules.d/10i18n/module-setup.sh
index a091f89..92b2fa3 100755
--- a/modules.d/10i18n/module-setup.sh
+++ b/modules.d/10i18n/module-setup.sh
Index: dracut-037/modules.d/10i18n/module-setup.sh
===================================================================
--- dracut-037.orig/modules.d/10i18n/module-setup.sh
+++ dracut-037/modules.d/10i18n/module-setup.sh
@@ -96,6 +96,8 @@ install() {
install_base() {
@ -40,10 +40,10 @@ index a091f89..92b2fa3 100755
if ! dracut_module_included "systemd"; then
inst ${moddir}/console_init.sh /lib/udev/console_init
diff --git a/modules.d/98systemd/rescue.service b/modules.d/98systemd/rescue.service
index edc2461..d80900f 100644
--- a/modules.d/98systemd/rescue.service
+++ b/modules.d/98systemd/rescue.service
Index: dracut-037/modules.d/98systemd/rescue.service
===================================================================
--- dracut-037.orig/modules.d/98systemd/rescue.service
+++ dracut-037/modules.d/98systemd/rescue.service
@@ -16,7 +16,7 @@ Environment=HOME=/
Environment=DRACUT_SYSTEMD=1
Environment=NEWROOT=/sysroot
@ -53,6 +53,3 @@ index edc2461..d80900f 100644
ExecStart=-/bin/sh -i -l
ExecStopPost=-/bin/rm -f -- /.console_lock
ExecStopPost=-/usr/bin/systemctl --fail --no-block default
--
1.8.1.4

View File

@ -1,39 +0,0 @@
From 88ed5bf13a56f9397cc50eb329785553eb82c210 Mon Sep 17 00:00:00 2001
From: WANG Chao <chaowang@redhat.com>
Date: Tue, 1 Apr 2014 15:20:49 +0800
Subject: [PATCH] fstab: do not mount and fsck from fstab if using systemd
If using systemd in initramfs, we could run into a race condition when
dracut and systemd both are trying to mount and run fsck for the same
filesystem, and mount or fsck could be a failure.
To fix such failure, we should use systemd to mount/fsck from /etc/fstab
only.
v2: check $DRACUT_SYSTEMD suggested by Alexander Tsoy
Signed-off-by: WANG Chao <chaowang@redhat.com>
---
modules.d/95fstab-sys/mount-sys.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
index 12711a0..a237810 100755
--- a/modules.d/95fstab-sys/mount-sys.sh
+++ b/modules.d/95fstab-sys/mount-sys.sh
@@ -27,7 +27,11 @@ fstab_mount() {
return 0
}
-[ -f /etc/fstab ] && fstab_mount /etc/fstab
+# systemd will mount and run fsck from /etc/fstab and we don't want to
+# run into a race condition.
+if [ -z "$DRACUT_SYSTEMD" ]; then
+ [ -f /etc/fstab ] && fstab_mount /etc/fstab
+fi
# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
if [ -f $NEWROOT/etc/fstab.sys ]; then
--
1.8.1.4

View File

@ -1,40 +0,0 @@
From c0bd4752731644ac799a7aa3d6e20069f94875bd Mon Sep 17 00:00:00 2001
From: WANG Chao <chaowang@redhat.com>
Date: Thu, 3 Apr 2014 15:49:26 +0800
Subject: [PATCH] dracut-initqueue service runs before remote-fs-pre.target
With the following commit, dracut doesn't mount anything from /etc/fstab
commit e920bfb
Author: WANG Chao <chaowang@redhat.com>
Date: Tue Apr 1 15:20:49 2014 +0800
fstab: do not mount and fsck from fstab if using systemd
But systemd doesn't mount nfs at all, because no unit is pulling in
remote-fs.target.
dracut must pull in these remote fs mount and all these remote mounts
should start only after network is up (ie. after dracut-initqueue).
Signed-off-by: WANG Chao <chaowang@redhat.com>
---
modules.d/98systemd/dracut-initqueue.service | 2 ++
1 file changed, 2 insertions(+)
diff --git a/modules.d/98systemd/dracut-initqueue.service b/modules.d/98systemd/dracut-initqueue.service
index 03dcc4e..1b9e701 100644
--- a/modules.d/98systemd/dracut-initqueue.service
+++ b/modules.d/98systemd/dracut-initqueue.service
@@ -11,6 +11,8 @@
Description=dracut initqueue hook
Documentation=man:dracut-initqueue.service(8)
DefaultDependencies=no
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
After=systemd-udev-trigger.service
Wants=systemd-udev-trigger.service
ConditionPathExists=/etc/initrd-release
--
1.8.1.4

View File

@ -6,6 +6,10 @@ Subject: [PATCH] 45ifcfg: use distro-specific scripts
Detect the system flavor and write the ifcfg files accordingly.
Signed-off-by: Hannes Reinecke <hare@suse.de>
Modified-by: Thomas Rennigner <trenn@suse.de>
- Do not move ifcfg to -suse and -redhat files to avoid re-diffing after
each upgrade. Handle this in the spec file and a separate
write-ifcfg-suse.sh source file
---
modules.d/40network/ifup.sh | 1 +
modules.d/45ifcfg/module-setup.sh | 8 +-
@ -48,749 +52,3 @@ index c407f45..164a580 100755
return 255
}
diff --git a/modules.d/45ifcfg/write-ifcfg-redhat.sh b/modules.d/45ifcfg/write-ifcfg-redhat.sh
new file mode 100755
index 0000000..e2fa485
--- /dev/null
+++ b/modules.d/45ifcfg/write-ifcfg-redhat.sh
@@ -0,0 +1,271 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# NFS root might have reached here before /tmp/net.ifaces was written
+udevadm settle --timeout=30
+
+if [ -e /tmp/bridge.info ]; then
+ . /tmp/bridge.info
+fi
+
+if [ -e /tmp/vlan.info ]; then
+ . /tmp/vlan.info
+fi
+
+mkdir -m 0755 -p /tmp/ifcfg/
+mkdir -m 0755 -p /tmp/ifcfg-leases/
+
+get_config_line_by_subchannel()
+{
+ local CHANNEL
+ local line
+
+ CHANNELS="$1"
+ while read line; do
+ if strstr "$line" "$CHANNELS"; then
+ echo $line
+ return 0
+ fi
+ done < /etc/ccw.conf
+ return 1
+}
+
+print_s390() {
+ local _netif
+ local SUBCHANNELS
+ local OPTIONS
+ local NETTYPE
+ local CONFIG_LINE
+ local i
+ local channel
+ local OLD_IFS
+
+ _netif="$1"
+ # if we find ccw channel, then use those, instead of
+ # of the MAC
+ SUBCHANNELS=$({
+ for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
+ [ -e $i ] || continue
+ channel=$(readlink -f $i)
+ echo -n "${channel##*/},"
+ done
+ })
+ [ -n "$SUBCHANNELS" ] || return 1
+
+ SUBCHANNELS=${SUBCHANNELS%,}
+ echo "SUBCHANNELS=\"${SUBCHANNELS}\""
+
+ CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
+ [ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
+
+ OLD_IFS=$IFS
+ IFS=","
+ set -- $CONFIG_LINE
+ IFS=$OLD_IFS
+ NETTYPE=$1
+ shift
+ SUBCHANNELS="$1"
+ OPTIONS=""
+ shift
+ while [ $# -gt 0 ]; do
+ case $1 in
+ *=*) OPTIONS="$OPTIONS $1";;
+ esac
+ shift
+ done
+ OPTIONS=${OPTIONS## }
+ echo "NETTYPE=\"${NETTYPE}\""
+ echo "OPTIONS=\"${OPTIONS}\""
+ return 0
+}
+
+for netup in /tmp/net.*.did-setup ; do
+ [ -f $netup ] || continue
+
+ netif=${netup%%.did-setup}
+ netif=${netif##*/net.}
+ strstr "$netif" ":*:*:*:*:" && continue
+ [ -e /tmp/ifcfg/ifcfg-$netif ] && continue
+ unset bridge
+ unset bond
+ unset bondslaves
+ unset bondname
+ unset bondoptions
+ unset uuid
+ unset ip
+ unset gw
+ unset mtu
+ unset mask
+ unset macaddr
+ unset slave
+ unset ethname
+ [ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
+
+ uuid=$(cat /proc/sys/kernel/random/uuid)
+ if [ "$netif" = "$bridgename" ]; then
+ bridge=yes
+ elif [ "$netif" = "$bondname" ]; then
+ # $netif can't be bridge and bond at the same time
+ bond=yes
+ fi
+ if [ "$netif" = "$vlanname" ]; then
+ vlan=yes
+ fi
+ [ -e /sys/class/net/$netif/address ] && \
+ cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
+ {
+ echo "# Generated by dracut initrd"
+ echo "DEVICE=\"$netif\""
+ echo "ONBOOT=yes"
+ echo "NETBOOT=yes"
+ echo "UUID=\"$uuid\""
+ if [ -f /tmp/dhclient.$netif.lease ]; then
+ [ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
+ strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
+ if [ -f /tmp/net.$netif.has_ibft_config ]; then
+ echo "BOOTPROTO=ibft"
+ else
+ echo "BOOTPROTO=dhcp"
+ fi
+ cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
+ else
+ # If we've booted with static ip= lines, the override file is there
+ [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
+ if strstr "$ip" '*:*:*'; then
+ echo "IPV6INIT=yes"
+ echo "IPV6_AUTOCONF=no"
+ echo "IPV6ADDR=\"$ip/$mask\""
+ else
+ if [ -f /tmp/net.$netif.has_ibft_config ]; then
+ echo "BOOTPROTO=ibft"
+ else
+ echo "BOOTPROTO=none"
+ echo "IPADDR=\"$ip\""
+ if strstr "$mask" "."; then
+ echo "NETMASK=\"$mask\""
+ else
+ echo "PREFIX=\"$mask\""
+ fi
+ fi
+ fi
+ if strstr "$gw" '*:*:*'; then
+ echo "IPV6_DEFAULTGW=\"$gw\""
+ elif [ -n "$gw" ]; then
+ echo "GATEWAY=\"$gw\""
+ fi
+ fi
+ [ -n "$mtu" ] && echo "MTU=\"$mtu\""
+ } > /tmp/ifcfg/ifcfg-$netif
+
+ # bridge needs different things written to ifcfg
+ if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
+ # standard interface
+ {
+ [ -n "$macaddr" ] && echo "MACADDR=\"$macaddr\""
+ if ! print_s390 $netif; then
+ [ -n "$macaddr" ] || echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
+ fi
+ echo "TYPE=Ethernet"
+ echo "NAME=\"$netif\""
+ [ -n "$mtu" ] && echo "MTU=\"$mtu\""
+ } >> /tmp/ifcfg/ifcfg-$netif
+ fi
+
+ if [ -n "$vlan" ] ; then
+ {
+ echo "TYPE=Vlan"
+ echo "NAME=\"$netif\""
+ echo "VLAN=yes"
+ echo "PHYSDEV=\"$phydevice\""
+ } >> /tmp/ifcfg/ifcfg-$netif
+ fi
+
+ if [ -n "$bond" ] ; then
+ # bond interface
+ {
+ # This variable is an indicator of a bond interface for initscripts
+ echo "BONDING_OPTS=\"$bondoptions\""
+ echo "NAME=\"$netif\""
+ echo "TYPE=Bond"
+ } >> /tmp/ifcfg/ifcfg-$netif
+
+ for slave in $bondslaves ; do
+ # write separate ifcfg file for the raw eth interface
+ {
+ echo "# Generated by dracut initrd"
+ echo "DEVICE=\"$slave\""
+ echo "TYPE=Ethernet"
+ echo "ONBOOT=yes"
+ echo "NETBOOT=yes"
+ echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
+ echo "SLAVE=yes"
+ echo "MASTER=\"$netif\""
+ echo "NAME=\"$slave\""
+ } >> /tmp/ifcfg/ifcfg-$slave
+ done
+ fi
+
+ if [ -n "$bridge" ] ; then
+ # bridge
+ {
+ echo "TYPE=Bridge"
+ echo "NAME=\"$netif\""
+ } >> /tmp/ifcfg/ifcfg-$netif
+ if [ "$ethname" = "$bondname" ] ; then
+ {
+ echo "# Generated by dracut initrd"
+ echo "DEVICE=\"$bondname\""
+ echo "ONBOOT=yes"
+ echo "NETBOOT=yes"
+ # This variable is an indicator of a bond interface for initscripts
+ echo "BONDING_OPTS=\"$bondoptions\""
+ echo "BRIDGE=\"$netif\""
+ echo "NAME=\"$bondname\""
+ } >> /tmp/ifcfg/ifcfg-$bondname
+ for slave in $bondslaves ; do
+ # write separate ifcfg file for the raw eth interface
+ {
+ echo "# Generated by dracut initrd"
+ echo "DEVICE=\"$slave\""
+ echo "TYPE=Ethernet"
+ echo "ONBOOT=yes"
+ echo "NETBOOT=yes"
+ echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
+ echo "SLAVE=yes"
+ echo "MASTER=\"$bondname\""
+ echo "NAME=\"$slave\""
+ } >> /tmp/ifcfg/ifcfg-$slave
+ done
+ else
+ # write separate ifcfg file for the raw eth interface
+ {
+ echo "# Generated by dracut initrd"
+ echo "DEVICE=\"$ethname\""
+ echo "TYPE=Ethernet"
+ echo "ONBOOT=yes"
+ echo "NETBOOT=yes"
+ echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
+ echo "BRIDGE=\"$netif\""
+ echo "NAME=\"$ethname\""
+ } >> /tmp/ifcfg/ifcfg-$ethname
+ fi
+ fi
+ i=1
+ for ns in $(getargs nameserver); do
+ echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
+ i=$((i+1))
+ done
+done
+
+# Pass network opts
+mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
+mkdir -m 0755 -p /run/initramfs/state/var/lib/dhclient
+echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
+echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
+{
+ cp /tmp/net.* /run/initramfs/
+ cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
+ copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
+ cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
+} > /dev/null 2>&1
diff --git a/modules.d/45ifcfg/write-ifcfg-suse.sh b/modules.d/45ifcfg/write-ifcfg-suse.sh
new file mode 100755
index 0000000..4b6350f
--- /dev/null
+++ b/modules.d/45ifcfg/write-ifcfg-suse.sh
@@ -0,0 +1,183 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# NFS root might have reached here before /tmp/net.ifaces was written
+udevadm settle --timeout=30
+
+if [ -e /tmp/bridge.info ]; then
+ . /tmp/bridge.info
+fi
+
+if [ -e /tmp/vlan.info ]; then
+ . /tmp/vlan.info
+fi
+
+mkdir -m 0755 -p /tmp/ifcfg/
+mkdir -m 0755 -p /tmp/ifcfg-leases/
+
+get_vid() {
+ case "$1" in
+ vlan*)
+ echo ${1#vlan}
+ ;;
+ *.*)
+ echo ${1##*.}
+ ;;
+ esac
+}
+
+for netup in /tmp/net.*.did-setup ; do
+ [ -f $netup ] || continue
+
+ netif=${netup%%.did-setup}
+ netif=${netif##*/net.}
+ [ -e /tmp/ifcfg/ifcfg-$netif ] && continue
+ unset bridge
+ unset bond
+ unset bondslaves
+ unset bondname
+ unset bondoptions
+ unset uuid
+ unset ip
+ unset gw
+ unset mtu
+ unset mask
+ unset macaddr
+ unset slave
+ unset ethname
+ [ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
+
+ uuid=$(cat /proc/sys/kernel/random/uuid)
+ if [ "$netif" = "$bridgename" ]; then
+ bridge=yes
+ elif [ "$netif" = "$bondname" ]; then
+ # $netif can't be bridge and bond at the same time
+ bond=yes
+ fi
+ if [ "$netif" = "$vlanname" ]; then
+ vlan=yes
+ fi
+ cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
+ {
+ echo "# Generated by dracut initrd"
+ echo "NAME='$netif'"
+ if [ -f /tmp/net.$netif.has_ibft_config ]; then
+ echo "STARTMODE='nfsroot'"
+ else
+ echo "STARTMODE='auto'"
+ fi
+
+ local bootproto="static"
+ if [ -f /tmp/leaseinfo.${netif}.dhcp.ipv6 ]; then
+ bootproto="dhcp6"
+ fi
+ if [ -f /tmp/leaseinfo.${netif}.dhcp.ipv4 ]; then
+ if [ "$bootproto" = "dhcp6" ]; then
+ bootproto="dhcp"
+ else
+ bootproto="dhcp4"
+ fi
+ fi
+
+ echo "BOOTPROTO='$bootproto'"
+
+ if [ "$bootproto" = "static" ]; then
+ # If we've booted with static ip= lines, the override file is there
+ [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
+ echo "IPADDR='$ip'"
+ if [ -n "$mask" ]; then
+ if strstr "$mask" "."; then
+ echo "NETMASK='$mask'"
+ else
+ echo "PREFIXLEN='$mask'"
+ fi
+ fi
+ if [ -n "$gw" ]; then
+ echo "GATEWAY='$gw'"
+ fi
+ fi
+ [ -n "$mtu" ] && echo "MTU='$mtu'"
+ } > /tmp/ifcfg/ifcfg-$netif
+
+ # bridge needs different things written to ifcfg
+ if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
+ # standard interface
+ {
+ if [ -n "$macaddr" ]; then
+ echo "LLADDR='$macaddr'"
+ else
+ echo "LLADDR='$(cat /sys/class/net/$netif/address)'"
+ fi
+ echo "INTERFACETYPE='Ethernet'"
+ } >> /tmp/ifcfg/ifcfg-$netif
+ fi
+
+ if [ -n "$vlan" ]; then
+ {
+ echo "INTERFACETYPE='Vlan'"
+ echo "VLAN_ID='$(get_vid $vlanname)'"
+ echo "ETHERDEVICE='$phydevice'"
+ } >> /tmp/ifcfg/ifcfg-$netif
+ fi
+
+ if [ -n "$bond" ] ; then
+ # bond interface
+ {
+ # This variable is an indicator of a bond interface for initscripts
+ echo "BONDING_MASTER='yes'"
+ echo "BONDING_MODULE_OPTS='$bondoptions'"
+ echo "INTERFACETYPE='Bond'"
+ } >> /tmp/ifcfg/ifcfg-$netif
+
+ local i=0
+ for slave in $bondslaves ; do
+ echo "BONDING_SLAVE_$i='$slave'" >> /tmp/ifcfg/ifcfg-$netif
+ i=$((i+1))
+ # write separate ifcfg file for the raw eth interface
+ {
+ echo "# Generated by dracut initrd"
+ echo "NAME='$slave'"
+ echo "INTERFACETYPE='Ethernet'"
+ echo "STARTMODE='hotplug'"
+ echo "BOOTPROTO='none'"
+ echo "# ETHTOOL=''"
+ } >> /tmp/ifcfg/ifcfg-$slave
+ done
+ fi
+
+ if [ -n "$bridge" ] ; then
+ # bridge
+ {
+ echo "INTERFACETYPE='Bridge'"
+ echo "BRIDGE='yes'"
+ echo "BRIDGE_STP='off'"
+ echo "BRIDGE_FORWARDDELAY='0'"
+ echo -n "BRIDGE_PORTS='"
+
+ } >> /tmp/ifcfg/ifcfg-$netif
+
+ if [ "$ethname" = "$bondname" ] ; then
+ {
+ for slave in $bondslaves ; do
+ echo -n "$bondname "
+ done
+ echo "'"
+ } >> /tmp/ifcfg/ifcfg-$netif
+ else
+ echo "$ethname'" >> /tmp/ifcfg/ifcfg-$netif
+ fi
+ fi
+done
+
+# Pass network opts
+mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network
+mkdir -m 0755 -p /run/initramfs/state/var/run/wicked
+echo "files /etc/sysconfig/network" >> /run/initramfs/rwtab
+echo "files /var/run/wicked" >> /run/initramfs/rwtab
+{
+ cp /tmp/net.* /run/initramfs/
+ cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
+ copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network
+ cp /tmp/leaseinfo.* /run/initramfs/state/var/run/wicked/
+} > /dev/null 2>&1
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
deleted file mode 100755
index e2fa485..0000000
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ /dev/null
@@ -1,271 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
-
-# NFS root might have reached here before /tmp/net.ifaces was written
-udevadm settle --timeout=30
-
-if [ -e /tmp/bridge.info ]; then
- . /tmp/bridge.info
-fi
-
-if [ -e /tmp/vlan.info ]; then
- . /tmp/vlan.info
-fi
-
-mkdir -m 0755 -p /tmp/ifcfg/
-mkdir -m 0755 -p /tmp/ifcfg-leases/
-
-get_config_line_by_subchannel()
-{
- local CHANNEL
- local line
-
- CHANNELS="$1"
- while read line; do
- if strstr "$line" "$CHANNELS"; then
- echo $line
- return 0
- fi
- done < /etc/ccw.conf
- return 1
-}
-
-print_s390() {
- local _netif
- local SUBCHANNELS
- local OPTIONS
- local NETTYPE
- local CONFIG_LINE
- local i
- local channel
- local OLD_IFS
-
- _netif="$1"
- # if we find ccw channel, then use those, instead of
- # of the MAC
- SUBCHANNELS=$({
- for i in /sys/class/net/$_netif/device/cdev[0-9]*; do
- [ -e $i ] || continue
- channel=$(readlink -f $i)
- echo -n "${channel##*/},"
- done
- })
- [ -n "$SUBCHANNELS" ] || return 1
-
- SUBCHANNELS=${SUBCHANNELS%,}
- echo "SUBCHANNELS=\"${SUBCHANNELS}\""
-
- CONFIG_LINE=$(get_config_line_by_subchannel $SUBCHANNELS)
- [ $? -ne 0 -o -z "$CONFIG_LINE" ] && return 0
-
- OLD_IFS=$IFS
- IFS=","
- set -- $CONFIG_LINE
- IFS=$OLD_IFS
- NETTYPE=$1
- shift
- SUBCHANNELS="$1"
- OPTIONS=""
- shift
- while [ $# -gt 0 ]; do
- case $1 in
- *=*) OPTIONS="$OPTIONS $1";;
- esac
- shift
- done
- OPTIONS=${OPTIONS## }
- echo "NETTYPE=\"${NETTYPE}\""
- echo "OPTIONS=\"${OPTIONS}\""
- return 0
-}
-
-for netup in /tmp/net.*.did-setup ; do
- [ -f $netup ] || continue
-
- netif=${netup%%.did-setup}
- netif=${netif##*/net.}
- strstr "$netif" ":*:*:*:*:" && continue
- [ -e /tmp/ifcfg/ifcfg-$netif ] && continue
- unset bridge
- unset bond
- unset bondslaves
- unset bondname
- unset bondoptions
- unset uuid
- unset ip
- unset gw
- unset mtu
- unset mask
- unset macaddr
- unset slave
- unset ethname
- [ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
-
- uuid=$(cat /proc/sys/kernel/random/uuid)
- if [ "$netif" = "$bridgename" ]; then
- bridge=yes
- elif [ "$netif" = "$bondname" ]; then
- # $netif can't be bridge and bond at the same time
- bond=yes
- fi
- if [ "$netif" = "$vlanname" ]; then
- vlan=yes
- fi
- [ -e /sys/class/net/$netif/address ] && \
- cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
- {
- echo "# Generated by dracut initrd"
- echo "DEVICE=\"$netif\""
- echo "ONBOOT=yes"
- echo "NETBOOT=yes"
- echo "UUID=\"$uuid\""
- if [ -f /tmp/dhclient.$netif.lease ]; then
- [ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
- strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
- if [ -f /tmp/net.$netif.has_ibft_config ]; then
- echo "BOOTPROTO=ibft"
- else
- echo "BOOTPROTO=dhcp"
- fi
- cp /tmp/dhclient.$netif.lease /tmp/ifcfg-leases/dhclient-$uuid-$netif.lease
- else
- # If we've booted with static ip= lines, the override file is there
- [ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
- if strstr "$ip" '*:*:*'; then
- echo "IPV6INIT=yes"
- echo "IPV6_AUTOCONF=no"
- echo "IPV6ADDR=\"$ip/$mask\""
- else
- if [ -f /tmp/net.$netif.has_ibft_config ]; then
- echo "BOOTPROTO=ibft"
- else
- echo "BOOTPROTO=none"
- echo "IPADDR=\"$ip\""
- if strstr "$mask" "."; then
- echo "NETMASK=\"$mask\""
- else
- echo "PREFIX=\"$mask\""
- fi
- fi
- fi
- if strstr "$gw" '*:*:*'; then
- echo "IPV6_DEFAULTGW=\"$gw\""
- elif [ -n "$gw" ]; then
- echo "GATEWAY=\"$gw\""
- fi
- fi
- [ -n "$mtu" ] && echo "MTU=\"$mtu\""
- } > /tmp/ifcfg/ifcfg-$netif
-
- # bridge needs different things written to ifcfg
- if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
- # standard interface
- {
- [ -n "$macaddr" ] && echo "MACADDR=\"$macaddr\""
- if ! print_s390 $netif; then
- [ -n "$macaddr" ] || echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
- fi
- echo "TYPE=Ethernet"
- echo "NAME=\"$netif\""
- [ -n "$mtu" ] && echo "MTU=\"$mtu\""
- } >> /tmp/ifcfg/ifcfg-$netif
- fi
-
- if [ -n "$vlan" ] ; then
- {
- echo "TYPE=Vlan"
- echo "NAME=\"$netif\""
- echo "VLAN=yes"
- echo "PHYSDEV=\"$phydevice\""
- } >> /tmp/ifcfg/ifcfg-$netif
- fi
-
- if [ -n "$bond" ] ; then
- # bond interface
- {
- # This variable is an indicator of a bond interface for initscripts
- echo "BONDING_OPTS=\"$bondoptions\""
- echo "NAME=\"$netif\""
- echo "TYPE=Bond"
- } >> /tmp/ifcfg/ifcfg-$netif
-
- for slave in $bondslaves ; do
- # write separate ifcfg file for the raw eth interface
- {
- echo "# Generated by dracut initrd"
- echo "DEVICE=\"$slave\""
- echo "TYPE=Ethernet"
- echo "ONBOOT=yes"
- echo "NETBOOT=yes"
- echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
- echo "SLAVE=yes"
- echo "MASTER=\"$netif\""
- echo "NAME=\"$slave\""
- } >> /tmp/ifcfg/ifcfg-$slave
- done
- fi
-
- if [ -n "$bridge" ] ; then
- # bridge
- {
- echo "TYPE=Bridge"
- echo "NAME=\"$netif\""
- } >> /tmp/ifcfg/ifcfg-$netif
- if [ "$ethname" = "$bondname" ] ; then
- {
- echo "# Generated by dracut initrd"
- echo "DEVICE=\"$bondname\""
- echo "ONBOOT=yes"
- echo "NETBOOT=yes"
- # This variable is an indicator of a bond interface for initscripts
- echo "BONDING_OPTS=\"$bondoptions\""
- echo "BRIDGE=\"$netif\""
- echo "NAME=\"$bondname\""
- } >> /tmp/ifcfg/ifcfg-$bondname
- for slave in $bondslaves ; do
- # write separate ifcfg file for the raw eth interface
- {
- echo "# Generated by dracut initrd"
- echo "DEVICE=\"$slave\""
- echo "TYPE=Ethernet"
- echo "ONBOOT=yes"
- echo "NETBOOT=yes"
- echo "HWADDR=\"$(cat /sys/class/net/$slave/address)\""
- echo "SLAVE=yes"
- echo "MASTER=\"$bondname\""
- echo "NAME=\"$slave\""
- } >> /tmp/ifcfg/ifcfg-$slave
- done
- else
- # write separate ifcfg file for the raw eth interface
- {
- echo "# Generated by dracut initrd"
- echo "DEVICE=\"$ethname\""
- echo "TYPE=Ethernet"
- echo "ONBOOT=yes"
- echo "NETBOOT=yes"
- echo "HWADDR=\"$(cat /sys/class/net/$ethname/address)\""
- echo "BRIDGE=\"$netif\""
- echo "NAME=\"$ethname\""
- } >> /tmp/ifcfg/ifcfg-$ethname
- fi
- fi
- i=1
- for ns in $(getargs nameserver); do
- echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
- i=$((i+1))
- done
-done
-
-# Pass network opts
-mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network-scripts
-mkdir -m 0755 -p /run/initramfs/state/var/lib/dhclient
-echo "files /etc/sysconfig/network-scripts" >> /run/initramfs/rwtab
-echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
-{
- cp /tmp/net.* /run/initramfs/
- cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
- copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
- cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
-} > /dev/null 2>&1
--
1.8.1.4

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Wed Apr 30 15:18:45 UTC 2014 - trenn@suse.de
- Update to lateste git HEAD 48b7ab1b35adf1f3f09f883ef14ea0a3fba1e468
Added: dracut_v37_to_HEAD.patch
Modified: 0013-Correct-paths-for-openSUSE.patch
Modified: mdraid-setup.patch
Modified: replace_dhclient_with_wickedd_dhcp_supplicants.patch
Deleted: 0018-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch
Deleted: 0019-dracut-initqueue-service-runs-before-remote-fs-pre.t.patch
- Fix lvm and other possible not working thing due to new parameter:
hostonly-cmdline which has to be active by default
bnc#874000 bnc#874905 bnc#874363
Added: mkinird_differ_host_and_cmdline_only_properly.patch
- Make write-ifcfg-suse.sh more update robust
Avoid rebasing of diff with every update touching this file by adding
write-ifcfg-suse.sh as source file and copy/link in .spec file.
Modified: change_write_ifcfg_to_suse.patch
-------------------------------------------------------------------
Tue Apr 29 15:43:28 UTC 2014 - meissner@suse.com

View File

@ -34,6 +34,8 @@ Source3: mkinitrd_setup_dummy
Source4: purge-kernels
Source5: purge-kernels.service
Source6: dracut-installkernel
Source7: write-ifcfg-suse.sh
Patch1: dracut_v37_to_HEAD.patch
Patch10: 0006-Install-bin-mount.patch
Patch11: 0013-Correct-paths-for-openSUSE.patch
Patch12: 0014-Check-for-plymouth-lib-directories.patch
@ -53,12 +55,11 @@ Patch26: mdraid-setup.patch
Patch27: 0015-95udev-rules-Add-59-scsi-sg_utils.rules.patch
Patch28: 0016-90multipath-add-67-kpartx-compat.rules.patch
Patch29: 0017-90multipath-install-dracut-specific-service-file.patch
Patch30: 0018-fstab-do-not-mount-and-fsck-from-fstab-if-using-syst.patch
Patch31: 0019-dracut-initqueue-service-runs-before-remote-fs-pre.t.patch
Patch32: 0020-95udev-rules-Include-correct-sg3_utils-rules.patch
Patch33: 0021-90multipath-install-correct-multipath-rules.patch
Patch34: add_dracuts_network_params_for_iscsi.patch
Patch35: 0022-90multipath-Fixup-service-file-for-booting.patch
Patch36: mkinird_differ_host_and_cmdline_only_properly.patch
BuildRequires: asciidoc
BuildRequires: bash
BuildRequires: docbook-xsl-stylesheets
@ -96,7 +97,7 @@ event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
NFS, iSCSI, NBD, FCoE with the dracut-network package.
%package fips
Summary: dracut modules to build a dracut initramfs with an integrity check
Summary: Dracut modules to build a dracut initramfs with an integrity check
Group: System/Base
Requires: %{name} = %{version}-%{release}
Requires: hmaccalc
@ -108,6 +109,7 @@ and its cryptography during startup.
%prep
%setup -q
%patch1 -p1
%patch10 -p1
%patch11 -p1
%patch12 -p1
@ -127,12 +129,11 @@ and its cryptography during startup.
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch36 -p1
%build
%configure\
@ -170,8 +171,11 @@ mkdir -p %{buildroot}%{_localstatedir}/log
touch %{buildroot}%{_localstatedir}/log/dracut.log
install -m 0644 dracut.conf.d/suse.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
echo '### Generated File - Please do not edit, create a new config file instead ###' >> %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
echo 'add_dracutmodules+=" network "' >> %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
echo 'compress="xz --check=crc32 -6"' >> %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
echo 'hostonly="yes"' >> %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
echo 'hostonly_cmdline="yes"' >> %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/40-fips.conf
@ -194,8 +198,11 @@ install -m 644 %{SOURCE5} %{buildroot}/%{_unitdir}/purge-kernels.service
install -D -m 0755 %{SOURCE6} %{buildroot}/sbin/installkernel
%if 0%{?suse_version}
install -D -m 0755 %{SOURCE7} %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-suse.sh
rm -f %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-suse.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
%else
mv %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-redhat.sh
ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-redhat.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
%endif

720
dracut_v37_to_HEAD.patch Normal file
View File

@ -0,0 +1,720 @@
diff --git a/dracut-functions.sh b/dracut-functions.sh
index 391b549..c758029 100755
--- a/dracut-functions.sh
+++ b/dracut-functions.sh
@@ -33,7 +33,11 @@ if [[ $initdir ]] && ! [[ -d $initdir ]]; then
fi
# Generic substring function. If $2 is in $1, return 0.
-strstr() { [[ $1 = *$2* ]]; }
+strstr() { [[ $1 = *"$2"* ]]; }
+# Generic glob matching function. If glob pattern $2 matches anywhere in $1, OK
+strglobin() { [[ $1 = *$2* ]]; }
+# Generic glob matching function. If glob pattern $2 matches all of $1, OK
+strglob() { [[ $1 = $2 ]]; }
# helper function for check() in module-setup.sh
# to check for required installed binaries
diff --git a/dracut-initramfs-restore.sh b/dracut-initramfs-restore.sh
index f29c814..0dd1938 100644
--- a/dracut-initramfs-restore.sh
+++ b/dracut-initramfs-restore.sh
@@ -6,6 +6,10 @@ set -e
KERNEL_VERSION="$(uname -r)"
+[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
+SKIP="$dracutbasedir/skipcpio"
+[[ -x $SKIP ]] || SKIP=cat
+
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
if [[ $MACHINE_ID ]] && [[ -d /boot/${MACHINE_ID} || -L /boot/${MACHINE_ID} ]] ; then
@@ -16,11 +20,11 @@ fi
cd /run/initramfs
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
-if zcat "$IMG" | cpio -id --quiet >/dev/null; then
+if $SKIP "$IMG" | zcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
-elif xzcat "$IMG" | cpio -id --quiet >/dev/null; then
+elif $SKIP "$IMG" | xzcat | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
-elif lz4 -d -c "$IMG" | cpio -id --quiet >/dev/null; then
+elif $SKIP "$IMG" | lz4 -d -c | cpio -id --no-absolute-filenames --quiet >/dev/null; then
rm -f -- .need_shutdown
else
# something failed, so we clean up
diff --git a/lsinitrd.sh b/lsinitrd.sh
index 8dc9032..a697bc2 100755
--- a/lsinitrd.sh
+++ b/lsinitrd.sh
@@ -160,27 +160,35 @@ case $bin in
;;
esac
-if [[ $SKIP ]]; then
- read -N 6 bin < <($SKIP "$image")
-fi
-
-case $bin in
- $'\x1f\x8b'*)
- CAT="zcat --";;
- BZh*)
- CAT="bzcat --";;
- $'\x71\xc7'*|070701)
- CAT="cat --"
- ;;
- $'\x02\x21'*)
- CAT="lz4 -d -c";;
- *)
- CAT="xzcat --";
- if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
- CAT="xzcat --single-stream --"
- fi
- ;;
-esac
+CAT=$({
+ if [[ $SKIP ]]; then
+ $SKIP "$image"
+ else
+ cat "$image"
+ fi } | {
+ read -N 6 bin
+ case $bin in
+ $'\x1f\x8b'*)
+ echo "zcat --"
+ ;;
+ BZh*)
+ echo "bzcat --"
+ ;;
+ $'\x71\xc7'*|070701)
+ echo "cat --"
+ ;;
+ $'\x02\x21'*)
+ echo "lz4 -d -c"
+ ;;
+ *)
+ if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
+ echo "xzcat --single-stream --"
+ else
+ echo "xzcat --"
+ fi
+ ;;
+ esac
+ })
skipcpio()
{
diff --git a/modules.d/10i18n/parse-i18n.sh b/modules.d/10i18n/parse-i18n.sh
index 135c57b..8f256fa 100755
--- a/modules.d/10i18n/parse-i18n.sh
+++ b/modules.d/10i18n/parse-i18n.sh
@@ -12,7 +12,7 @@ inst_key_val() {
_value="$(getarg $@)"
[ -z "${_value}" ] && _value=$_default
if [ -n "${_value}" ]; then
- printf '%s="%s"\n' $key ${_value} >> $_file
+ printf '%s="%s"\n' ${_key} ${_value} >> $_file
fi
unset _file
unset _value
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
index 50e8932..ba05250 100755
--- a/modules.d/40network/dhclient-script.sh
+++ b/modules.d/40network/dhclient-script.sh
@@ -64,13 +64,17 @@ setup_interface6() {
search=$(printf -- "$new_domain_search")
namesrv=$new_domain_name_servers
hostname=$new_host_name
- lease_time=$new_dhcp_lease_time
+ [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
+ [ -n "$new_max_life" ] && lease_time=$new_max_life
+ preferred_lft=$lease_time
+ [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
[ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
- dev ${netif} scope global valid_lft ${lease_time} \
- preferred_lft ${lease_time}
+ dev ${netif} scope global \
+ ${lease_time:+valid_lft $lease_time} \
+ ${preferred_lft:+preferred_lft ${preferred_lft}}
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 51b0d52..7740be5 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
@@ -130,12 +130,12 @@ do_ipv6auto() {
# Handle static ip configuration
do_static() {
- strstr $ip '*:*:*' && load_ipv6
+ strglobin $ip '*:*:*' && load_ipv6
linkup $netif
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
- if strstr $ip '*:*:*'; then
+ if strglobin $ip '*:*:*'; then
# note no ip addr flush for ipv6
ip addr add $ip/$mask ${srv:+peer $srv} dev $netif
wait_for_ipv6_dad $netif
@@ -364,7 +364,12 @@ fi
# no ip option directed at our interface?
if [ ! -e /tmp/net.${netif}.up ]; then
- do_dhcp -4
+ if getargs 'ip=dhcp6'; then
+ load_ipv6
+ do_dhcp -6
+ else
+ do_dhcp -4
+ fi
fi
exit 0
diff --git a/modules.d/40network/net-lib.sh b/modules.d/40network/net-lib.sh
index 7430e4c..a82f1a8 100755
--- a/modules.d/40network/net-lib.sh
+++ b/modules.d/40network/net-lib.sh
@@ -377,7 +377,7 @@ ip_to_var() {
# ip=<ipv4-address> means anaconda-style static config argument cluster:
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
- if strstr "$autoconf" "*.*.*.*"; then
+ if strglob "$autoconf" "*.*.*.*"; then
ip="$autoconf"
gw=$(getarg gateway=)
mask=$(getarg netmask=)
@@ -516,3 +516,27 @@ find_iface_with_link() {
done
return 1
}
+
+is_persistent_ethernet_name() {
+ case "$1" in
+ # udev persistent interface names
+ eth[0-9]|eth[0-9][0-9]|eth[0-9][0-9][0-9]*)
+ ;;
+ eno[0-9]|eno[0-9][0-9]|eno[0-9][0-9][0-9]*)
+ ;;
+ ens[0-9]|ens[0-9][0-9]|ens[0-9][0-9][0-9]*)
+ ;;
+ enp[0-9]s[0-9]*|enp[0-9][0-9]s[0-9]*|enp[0-9][0-9][0-9]*s[0-9]*)
+ ;;
+ enP*p[0-9]s[0-9]*|enP*p[0-9][0-9]s[0-9]*|enP*p[0-9][0-9][0-9]*s[0-9]*)
+ ;;
+ # biosdevname
+ em[0-9]|em[0-9][0-9]|em[0-9][0-9][0-9]*)
+ ;;
+ p[0-9]p[0-9]*|p[0-9][0-9]p[0-9]*|p[0-9][0-9][0-9]*p[0-9]*)
+ ;;
+ *)
+ return 1
+ esac
+ return 0
+}
diff --git a/modules.d/45ifcfg/write-ifcfg.sh b/modules.d/45ifcfg/write-ifcfg.sh
index e2fa485..5de2e90 100755
--- a/modules.d/45ifcfg/write-ifcfg.sh
+++ b/modules.d/45ifcfg/write-ifcfg.sh
@@ -85,7 +85,7 @@ for netup in /tmp/net.*.did-setup ; do
netif=${netup%%.did-setup}
netif=${netif##*/net.}
- strstr "$netif" ":*:*:*:*:" && continue
+ strglobin "$netif" ":*:*:*:*:" && continue
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
unset bridge
unset bond
@@ -122,7 +122,7 @@ for netup in /tmp/net.*.did-setup ; do
echo "UUID=\"$uuid\""
if [ -f /tmp/dhclient.$netif.lease ]; then
[ -f /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
- strstr "$ip" '*:*:*' && echo "IPV6INIT=yes"
+ strstr "$(ip -6 addr show dev $netif)" 'inet6' && echo "IPV6INIT=yes"
if [ -f /tmp/net.$netif.has_ibft_config ]; then
echo "BOOTPROTO=ibft"
else
@@ -132,7 +132,7 @@ for netup in /tmp/net.*.did-setup ; do
else
# If we've booted with static ip= lines, the override file is there
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
- if strstr "$ip" '*:*:*'; then
+ if strglobin "$ip" '*:*:*'; then
echo "IPV6INIT=yes"
echo "IPV6_AUTOCONF=no"
echo "IPV6ADDR=\"$ip/$mask\""
@@ -149,7 +149,7 @@ for netup in /tmp/net.*.did-setup ; do
fi
fi
fi
- if strstr "$gw" '*:*:*'; then
+ if strglobin "$gw" '*:*:*'; then
echo "IPV6_DEFAULTGW=\"$gw\""
elif [ -n "$gw" ]; then
echo "GATEWAY=\"$gw\""
@@ -164,7 +164,13 @@ for netup in /tmp/net.*.did-setup ; do
{
[ -n "$macaddr" ] && echo "MACADDR=\"$macaddr\""
if ! print_s390 $netif; then
- [ -n "$macaddr" ] || echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
+ if [ -z "$macaddr" ] && \
+ ! is_persistent_ethernet_name "$netif" && \
+ [ -f /sys/class/net/$netif/addr_assign_type ] && \
+ [ "$(cat /sys/class/net/$netif/addr_assign_type)" = "0" ] && \
+ [ -f /sys/class/net/$netif/address ]; then
+ echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
+ fi
fi
echo "TYPE=Ethernet"
echo "NAME=\"$netif\""
diff --git a/modules.d/80cms/cms-write-ifcfg.sh b/modules.d/80cms/cms-write-ifcfg.sh
index c0623a4..924be1d 100755
--- a/modules.d/80cms/cms-write-ifcfg.sh
+++ b/modules.d/80cms/cms-write-ifcfg.sh
@@ -26,7 +26,7 @@ function cms_write_config()
IFCFGFILE=/run/initramfs/state/etc/sysconfig/network-scripts/ifcfg-$DEVICE
- strstr "$IPADDR" '*:*:*' && ipv6=1
+ strglobin "$IPADDR" '*:*:*' && ipv6=1
# to please NetworkManager on startup in loader before loader reconfigures net
cat > /etc/sysconfig/network << EOF
diff --git a/modules.d/80cms/cmsifup.sh b/modules.d/80cms/cmsifup.sh
index b361650..926340e 100755
--- a/modules.d/80cms/cmsifup.sh
+++ b/modules.d/80cms/cmsifup.sh
@@ -8,7 +8,7 @@ DEVICE=$1
. /tmp/cms.conf
-strstr "$IPADDR" '*:*:*' && ipv6=1
+strglobin "$IPADDR" '*:*:*' && ipv6=1
if [ "$ipv6" ] && ! str_starts "$IPADDR" "["; then
IPADDR="[$IPADDR]"
diff --git a/modules.d/90dm/module-setup.sh b/modules.d/90dm/module-setup.sh
index 829c24b..2367588 100755
--- a/modules.d/90dm/module-setup.sh
+++ b/modules.d/90dm/module-setup.sh
@@ -16,7 +16,7 @@ depends() {
# called by dracut
installkernel() {
instmods =drivers/md
- instmods dm_mod
+ instmods dm_mod dm-cache dm-cache-mq dm-cache-cleaner
}
# called by dracut
diff --git a/modules.d/90lvm/module-setup.sh b/modules.d/90lvm/module-setup.sh
index 93a452e..5b810b9 100755
--- a/modules.d/90lvm/module-setup.sh
+++ b/modules.d/90lvm/module-setup.sh
@@ -80,7 +80,8 @@ install() {
inst_rules 11-dm-lvm.rules 69-dm-lvm-metad.rules
# Do not run lvmetad update via pvscan in udev rule - lvmetad is not running yet in dracut!
- if grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
+ if [[ -f ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules ]] && \
+ grep -q SYSTEMD_WANTS ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules; then
sed -i -e 's/^ENV{SYSTEMD_ALIAS}=.*/# No LVM pvscan in dracut - lvmetad is not running yet/' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
sed -i -e 's/^ENV{ID_MODEL}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
sed -i -e 's/^ENV{SYSTEMD_WANTS}=.*//' ${initdir}/lib/udev/rules.d/69-dm-lvm-metad.rules
diff --git a/modules.d/95fcoe/fcoe-genrules.sh b/modules.d/95fcoe/fcoe-genrules.sh
index 80894ed..fa3af6d 100755
--- a/modules.d/95fcoe/fcoe-genrules.sh
+++ b/modules.d/95fcoe/fcoe-genrules.sh
@@ -13,4 +13,4 @@
else
printf 'ACTION=="add", SUBSYSTEM=="net", NAME=="%s", RUN+="/sbin/initqueue --onetime --unique --name fcoe-up-$env{INTERFACE} /sbin/fcoe-up $env{INTERFACE} %s"\n' "$fcoe_interface" "$fcoe_dcb"
fi
-} > /etc/udev/rules.d/92-fcoe.rules
+} >> /etc/udev/rules.d/92-fcoe.rules
diff --git a/modules.d/95fcoe/fcoe-up.sh b/modules.d/95fcoe/fcoe-up.sh
index 511c554..d8c73c8 100755
--- a/modules.d/95fcoe/fcoe-up.sh
+++ b/modules.d/95fcoe/fcoe-up.sh
@@ -28,12 +28,35 @@ if [ "$dcb" = "dcb" ]; then
# are to kill it and start a new lldpad to take over. Data is transfered
# between the 2 using a shm segment
lldpad -d
- # stupid tools, need sleep
- sleep 1
- dcbtool sc "$netif" dcb on
- sleep 1
- dcbtool sc "$netif" app:fcoe e:1 a:1 w:1
+ # wait for lldpad to be ready
+ i=0
+ while [ $i -lt 60 ]; do
+ lldptool -p && break
+ info "Waiting for lldpad to be ready"
+ sleep 1
+ i=$(($i+1))
+ done
+
+ # on some systems lldpad needs some time
+ # sleep until we find a better solution
+ sleep 30
+
+ while [ $i -lt 60 ]; do
+ dcbtool sc "$netif" dcb on && break
+ info "Retrying to turn dcb on"
+ sleep 1
+ i=$(($i+1))
+ done
+
+ while [ $i -lt 60 ]; do
+ dcbtool sc "$netif" app:fcoe e:1 a:1 w:1 && break
+ info "Retrying to turn fcoe on"
+ sleep 1
+ i=$(($i+1))
+ done
+
sleep 1
+
fipvlan "$netif" -c -s
elif [ "$netdriver" = "bnx2x" ]; then
# If driver is bnx2x, do not use /sys/module/fcoe/parameters/create but fipvlan
diff --git a/modules.d/95fcoe/module-setup.sh b/modules.d/95fcoe/module-setup.sh
index c502ba0..9a52c00 100755
--- a/modules.d/95fcoe/module-setup.sh
+++ b/modules.d/95fcoe/module-setup.sh
@@ -21,7 +21,7 @@ installkernel() {
# called by dracut
install() {
- inst_multiple ip dcbtool fipvlan lldpad readlink
+ inst_multiple ip dcbtool fipvlan lldpad readlink lldptool
mkdir -m 0755 -p "$initdir/var/lib/lldpad"
diff --git a/modules.d/95fstab-sys/mount-sys.sh b/modules.d/95fstab-sys/mount-sys.sh
index 12711a0..a237810 100755
--- a/modules.d/95fstab-sys/mount-sys.sh
+++ b/modules.d/95fstab-sys/mount-sys.sh
@@ -27,7 +27,11 @@ fstab_mount() {
return 0
}
-[ -f /etc/fstab ] && fstab_mount /etc/fstab
+# systemd will mount and run fsck from /etc/fstab and we don't want to
+# run into a race condition.
+if [ -z "$DRACUT_SYSTEMD" ]; then
+ [ -f /etc/fstab ] && fstab_mount /etc/fstab
+fi
# prefer $NEWROOT/etc/fstab.sys over local /etc/fstab.sys
if [ -f $NEWROOT/etc/fstab.sys ]; then
diff --git a/modules.d/95nfs/nfs-lib.sh b/modules.d/95nfs/nfs-lib.sh
index 9ced2e6..d5377fe 100755
--- a/modules.d/95nfs/nfs-lib.sh
+++ b/modules.d/95nfs/nfs-lib.sh
@@ -40,7 +40,7 @@ nfsroot_to_var() {
arg="${arg##$nfs:}"
# check if we have a server
- if strstr "$arg" ':/*' ; then
+ if strstr "$arg" ':/' ; then
server="${arg%%:/*}"
arg="/${arg##*:/}"
fi
diff --git a/modules.d/98systemd/dracut-initqueue.service b/modules.d/98systemd/dracut-initqueue.service
index 03dcc4e..1b9e701 100644
--- a/modules.d/98systemd/dracut-initqueue.service
+++ b/modules.d/98systemd/dracut-initqueue.service
@@ -11,6 +11,8 @@
Description=dracut initqueue hook
Documentation=man:dracut-initqueue.service(8)
DefaultDependencies=no
+Before=remote-fs-pre.target
+Wants=remote-fs-pre.target
After=systemd-udev-trigger.service
Wants=systemd-udev-trigger.service
ConditionPathExists=/etc/initrd-release
diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh
index c72aad4..e7bf73b 100755
--- a/modules.d/98systemd/module-setup.sh
+++ b/modules.d/98systemd/module-setup.sh
@@ -44,6 +44,7 @@ install() {
$systemdutildir/systemd-modules-load \
$systemdutildir/systemd-vconsole-setup \
$systemdutildir/system-generators/systemd-fstab-generator \
+ $systemdutildir/system-generators/systemd-gpt-auto-generator \
\
$systemdsystemunitdir/cryptsetup.target \
$systemdsystemunitdir/emergency.target \
diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh
index e4d7da8..127287c 100755
--- a/modules.d/99base/dracut-lib.sh
+++ b/modules.d/99base/dracut-lib.sh
@@ -20,19 +20,33 @@ debug_on() {
[ "$RD_DEBUG" = "yes" ] && set -x
}
-# returns OK if $1 contains $2
+# returns OK if $1 contains literal string $2 (and isn't empty)
strstr() {
- [ "${1#*$2*}" != "$1" ]
+ [ "${1##*"$2"*}" != "$1" ]
}
-# returns OK if $1 contains $2 at the beginning
+# returns OK if $1 matches (completely) glob pattern $2
+# An empty $1 will not be considered matched, even if $2 is * which technically
+# matches; as it would match anything, it's not an interesting case.
+strglob() {
+ [ -n "$1" -a -z "${1##$2}" ]
+}
+
+# returns OK if $1 contains (anywhere) a match of glob pattern $2
+# An empty $1 will not be considered matched, even if $2 is * which technically
+# matches; as it would match anything, it's not an interesting case.
+strglobin() {
+ [ -n "$1" -a -z "${1##*$2*}" ]
+}
+
+# returns OK if $1 contains literal string $2 at the beginning, and isn't empty
str_starts() {
- [ "${1#$2*}" != "$1" ]
+ [ "${1#"$2"*}" != "$1" ]
}
-# returns OK if $1 contains $2 at the end
+# returns OK if $1 contains literal string $2 at the end, and isn't empty
str_ends() {
- [ "${1%*$2}" != "$1" ]
+ [ "${1%*"$2"}" != "$1" ]
}
if [ -z "$DRACUT_SYSTEMD" ]; then
@@ -85,9 +99,9 @@ str_replace() {
local out=''
while strstr "${in}" "$s"; do
- chop="${in%%$s*}"
+ chop="${in%%"$s"*}"
out="${out}${chop}$r"
- in="${in#*$s}"
+ in="${in#*"$s"}"
done
echo "${out}${in}"
}
@@ -555,7 +569,7 @@ nfsroot_to_var() {
arg="${arg##$nfs:}"
# check if we have a server
- if strstr "$arg" ':/*' ; then
+ if strstr "$arg" ':/' ; then
server="${arg%%:/*}"
arg="/${arg##*:/}"
fi
diff --git a/modules.d/99base/init.sh b/modules.d/99base/init.sh
index 2364f4f..a1232eb 100755
--- a/modules.d/99base/init.sh
+++ b/modules.d/99base/init.sh
@@ -353,7 +353,9 @@ wait_for_loginit
# remove helper symlink
[ -h /dev/root ] && rm -f -- /dev/root
-getarg rd.break -d rdbreak && emergency_shell -n switch_root "Break before switch_root"
+bv=$(getarg rd.break -d rdbreak) && [ -z "$bv" ] &&
+ emergency_shell -n switch_root "Break before switch_root"
+unset bv
info "Switching root"
diff --git a/modules.d/99fs-lib/module-setup.sh b/modules.d/99fs-lib/module-setup.sh
index 7979bab..b6f85b1 100755
--- a/modules.d/99fs-lib/module-setup.sh
+++ b/modules.d/99fs-lib/module-setup.sh
@@ -17,10 +17,10 @@ echo_fs_helper() {
local dev=$1 fs=$2
case "$fs" in
xfs)
- echo -n " xfs_db xfs_repair xfs_check xfs_metadump "
+ echo -n " xfs_db xfs_repair xfs_check xfs_metadump"
;;
ext?)
- echo -n " fsck.$fs e2fsck "
+ echo -n " e2fsck "
;;
jfs)
echo -n " jfs_fsck "
@@ -31,10 +31,10 @@ echo_fs_helper() {
btrfs)
echo -n " btrfsck "
;;
- *)
- [[ -x fsck.$fs ]] && echo -n " fsck.$fs "
- ;;
esac
+
+ echo -n " fsck.$fs "
+ return 0
}
include_fs_helper_modules() {
diff --git a/test/TEST-01-BASIC/test-init.sh b/test/TEST-01-BASIC/test-init.sh
index 5fc02d9..cf5a026 100755
--- a/test/TEST-01-BASIC/test-init.sh
+++ b/test/TEST-01-BASIC/test-init.sh
@@ -1,7 +1,7 @@
#!/bin/sh
>/dev/watchdog
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
diff --git a/test/TEST-02-SYSTEMD/test-init.sh b/test/TEST-02-SYSTEMD/test-init.sh
index ff17b6b..3fc24f5 100755
--- a/test/TEST-02-SYSTEMD/test-init.sh
+++ b/test/TEST-02-SYSTEMD/test-init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec </dev/console >/dev/console 2>&1
diff --git a/test/TEST-03-USR-MOUNT/test-init.sh b/test/TEST-03-USR-MOUNT/test-init.sh
index 63520ab..99e109a 100755
--- a/test/TEST-03-USR-MOUNT/test-init.sh
+++ b/test/TEST-03-USR-MOUNT/test-init.sh
@@ -1,7 +1,7 @@
#!/bin/sh
>/dev/watchdog
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec </dev/console >/dev/console 2>&1
diff --git a/test/TEST-04-FULL-SYSTEMD/test-init.sh b/test/TEST-04-FULL-SYSTEMD/test-init.sh
index dcda926..3012213 100755
--- a/test/TEST-04-FULL-SYSTEMD/test-init.sh
+++ b/test/TEST-04-FULL-SYSTEMD/test-init.sh
@@ -1,7 +1,7 @@
#!/bin/sh
>/dev/watchdog
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec </dev/console >/dev/console 2>&1
diff --git a/test/TEST-10-RAID/test-init.sh b/test/TEST-10-RAID/test-init.sh
index 62afcee..4b4977a 100755
--- a/test/TEST-10-RAID/test-init.sh
+++ b/test/TEST-10-RAID/test-init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
command -v plymouth >/dev/null && plymouth --quit
exec >/dev/console 2>&1
diff --git a/test/TEST-11-LVM/test-init.sh b/test/TEST-11-LVM/test-init.sh
index fd03aa5..db3c52a 100755
--- a/test/TEST-11-LVM/test-init.sh
+++ b/test/TEST-11-LVM/test-init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
diff --git a/test/TEST-12-RAID-DEG/test-init.sh b/test/TEST-12-RAID-DEG/test-init.sh
index 62afcee..4b4977a 100755
--- a/test/TEST-12-RAID-DEG/test-init.sh
+++ b/test/TEST-12-RAID-DEG/test-init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
command -v plymouth >/dev/null && plymouth --quit
exec >/dev/console 2>&1
diff --git a/test/TEST-14-IMSM/test-init.sh b/test/TEST-14-IMSM/test-init.sh
index f434f13..932bd26 100755
--- a/test/TEST-14-IMSM/test-init.sh
+++ b/test/TEST-14-IMSM/test-init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
diff --git a/test/TEST-16-DMSQUASH/test-init.sh b/test/TEST-16-DMSQUASH/test-init.sh
index 616bf68..55a5321 100755
--- a/test/TEST-16-DMSQUASH/test-init.sh
+++ b/test/TEST-16-DMSQUASH/test-init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
diff --git a/test/TEST-17-LVM-THIN/test-init.sh b/test/TEST-17-LVM-THIN/test-init.sh
index fd03aa5..db3c52a 100755
--- a/test/TEST-17-LVM-THIN/test-init.sh
+++ b/test/TEST-17-LVM-THIN/test-init.sh
@@ -1,6 +1,6 @@
#!/bin/sh
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
plymouth --quit
exec >/dev/console 2>&1
diff --git a/test/TEST-20-NFS/client-init.sh b/test/TEST-20-NFS/client-init.sh
index ad6a656..a16db3c 100755
--- a/test/TEST-20-NFS/client-init.sh
+++ b/test/TEST-20-NFS/client-init.sh
@@ -4,7 +4,7 @@ exec >/dev/console 2>&1
export TERM=linux
export PS1='initramfs-test:\w\$ '
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
stty sane
strstr "$CMDLINE" "rd.shell" && sh -i
diff --git a/test/TEST-50-MULTINIC/client-init.sh b/test/TEST-50-MULTINIC/client-init.sh
index 51f8b64..13affc4 100755
--- a/test/TEST-50-MULTINIC/client-init.sh
+++ b/test/TEST-50-MULTINIC/client-init.sh
@@ -2,14 +2,15 @@
exec >/dev/console 2>&1
set -x
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
-strstr() { [ "${1#*$2*}" != "$1" ]; }
+strstr() { [ "${1##*"$2"*}" != "$1" ]; }
+strglobin() { [ -n "$1" -a -z "${1##*$2*}" ]; }
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
export TERM=linux
export PS1='initramfs-test:\w\$ '
stty sane
echo "made it to the rootfs! Powering down."
for i in /run/initramfs/net.*.did-setup; do
- strstr "$i" ":*:*:*:*:" && continue
+ strglobin "$i" ":*:*:*:*:" && continue
i=${i%.did-setup}
IFACES+="${i##*/net.} "
done

View File

@ -13,10 +13,10 @@ Signed-off-by: NeilBrown <neilb@suse.de>
modules.d/90mdraid/module-setup.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules.d/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh
index ac745d1..767b3aa 100755
--- a/modules.d/90mdraid/module-setup.sh
+++ b/modules.d/90mdraid/module-setup.sh
Index: dracut-037/modules.d/90mdraid/module-setup.sh
===================================================================
--- dracut-037.orig/modules.d/90mdraid/module-setup.sh
+++ dracut-037/modules.d/90mdraid/module-setup.sh
@@ -86,7 +86,7 @@ install() {
for rule in 64-md-raid.rules 64-md-raid-assembly.rules; do
rule_path="${initdir}${udevdir}/rules.d/${rule}"
@ -26,6 +26,3 @@ index ac745d1..767b3aa 100755
"${rule_path}"
done
--
1.8.1.4

View File

@ -0,0 +1,33 @@
Index: dracut-037/mkinitrd-suse.sh
===================================================================
--- dracut-037.orig/mkinitrd-suse.sh
+++ dracut-037/mkinitrd-suse.sh
@@ -297,7 +297,11 @@ targets=( $targets )
[[ $kernels ]] && kernels=( $kernels )
[[ $logfile ]] && dracut_args="${dracut_args} --logfile $logfile"
-[[ $host_only == 1 ]] && dracut_args="${dracut_args} --hostonly"
+if [[ $host_only == 1 ]];then
+ dracut_args="${dracut_args} --hostonly --hostonly-cmdline"
+else
+ dracut_args="${dracut_args} --no-hostonly --no-hostonly-cmdline"
+fi
[[ $force == 1 ]] && dracut_args="${dracut_args} --force"
[[ $dracut_cmdline ]] && dracut_args="${dracut_args} --kernel-cmdline ${dracut_cmdline}"
[ -z "$(type -p update-bootloader)" ] && skip_update_bootloader=1
Index: dracut-037/mkinitrd-suse.8
===================================================================
--- dracut-037.orig/mkinitrd-suse.8
+++ dracut-037/mkinitrd-suse.8
@@ -139,7 +139,10 @@ script after the initrd(s) have been cre
.PP
\fB\-A\fR
.RS 4
-Create a so called "monster initrd" which includes all available features and modules\&.
+Create a so called "monster initrd" which includes all available features and
+modules. This calls dracut with \-\-no\-hostonly and \-\-no-hostonly\-cmdline
+parameters internally (instead of \-\-hostonly, \-\-hostonly\-cmdline by
+default).\&.
.RE
.PP
\fB\-v, \-\-verbose\fR

View File

@ -20,12 +20,11 @@ Signed-off-by: Hannes Reinecke <hare@suse.de>
delete mode 100644 modules.d/40network/dhclient.conf
delete mode 100755 modules.d/40network/kill-dhclient.sh
diff --git a/modules.d/40network/dhclient-script.sh b/modules.d/40network/dhclient-script.sh
deleted file mode 100755
index 50e8932..0000000
--- a/modules.d/40network/dhclient-script.sh
Index: dracut-037/modules.d/40network/dhclient-script.sh
===================================================================
--- dracut-037.orig/modules.d/40network/dhclient-script.sh
+++ /dev/null
@@ -1,152 +0,0 @@
@@ -1,156 +0,0 @@
-#!/bin/sh
-# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
-# ex: ts=8 sw=4 sts=4 et filetype=sh
@ -92,13 +91,17 @@ index 50e8932..0000000
- search=$(printf -- "$new_domain_search")
- namesrv=$new_domain_name_servers
- hostname=$new_host_name
- lease_time=$new_dhcp_lease_time
- [ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
- [ -n "$new_max_life" ] && lease_time=$new_max_life
- preferred_lft=$lease_time
- [ -n "$new_preferred_life" ] && preferred_lft=$new_preferred_life
-
- [ -f /tmp/net.$netif.override ] && . /tmp/net.$netif.override
-
- ip -6 addr add ${new_ip6_address}/${new_ip6_prefixlen} \
- dev ${netif} scope global valid_lft ${lease_time} \
- preferred_lft ${lease_time}
- dev ${netif} scope global \
- ${lease_time:+valid_lft $lease_time} \
- ${preferred_lft:+preferred_lft ${preferred_lft}}
-
- [ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
- if [ -n "$namesrv" ] ; then
@ -178,19 +181,18 @@ index 50e8932..0000000
-esac
-
-exit 0
diff --git a/modules.d/40network/dhclient.conf b/modules.d/40network/dhclient.conf
deleted file mode 100644
index dbf5882..0000000
--- a/modules.d/40network/dhclient.conf
Index: dracut-037/modules.d/40network/dhclient.conf
===================================================================
--- dracut-037.orig/modules.d/40network/dhclient.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-request subnet-mask, broadcast-address, time-offset, routers,
- domain-name, domain-name-servers, domain-search, host-name,
- root-path, interface-mtu;
diff --git a/modules.d/40network/ifup.sh b/modules.d/40network/ifup.sh
index 51b0d52..25ce094 100755
--- a/modules.d/40network/ifup.sh
+++ b/modules.d/40network/ifup.sh
Index: dracut-037/modules.d/40network/ifup.sh
===================================================================
--- dracut-037.orig/modules.d/40network/ifup.sh
+++ dracut-037/modules.d/40network/ifup.sh
@@ -88,21 +88,106 @@ else
[ -e /tmp/net.$(cat /sys/class/net/$netif/address).did-setup ] && exit 0
fi
@ -312,10 +314,9 @@ index 51b0d52..25ce094 100755
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
# start bridge if necessary
diff --git a/modules.d/40network/kill-dhclient.sh b/modules.d/40network/kill-dhclient.sh
deleted file mode 100755
index 78060f5..0000000
--- a/modules.d/40network/kill-dhclient.sh
Index: dracut-037/modules.d/40network/kill-dhclient.sh
===================================================================
--- dracut-037.orig/modules.d/40network/kill-dhclient.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
@ -335,10 +336,10 @@ index 78060f5..0000000
- read PID < $f;
- kill -9 $PID >/dev/null 2>&1
-done
diff --git a/modules.d/40network/module-setup.sh b/modules.d/40network/module-setup.sh
index 1df4174..b54f873 100755
--- a/modules.d/40network/module-setup.sh
+++ b/modules.d/40network/module-setup.sh
Index: dracut-037/modules.d/40network/module-setup.sh
===================================================================
--- dracut-037.orig/modules.d/40network/module-setup.sh
+++ dracut-037/modules.d/40network/module-setup.sh
@@ -2,11 +2,14 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
@ -385,6 +386,3 @@ index 1df4174..b54f873 100755
_arch=$(uname -m)
--
1.8.1.4

183
write-ifcfg-suse.sh Normal file
View File

@ -0,0 +1,183 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# NFS root might have reached here before /tmp/net.ifaces was written
udevadm settle --timeout=30
if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
fi
if [ -e /tmp/vlan.info ]; then
. /tmp/vlan.info
fi
mkdir -m 0755 -p /tmp/ifcfg/
mkdir -m 0755 -p /tmp/ifcfg-leases/
get_vid() {
case "$1" in
vlan*)
echo ${1#vlan}
;;
*.*)
echo ${1##*.}
;;
esac
}
for netup in /tmp/net.*.did-setup ; do
[ -f $netup ] || continue
netif=${netup%%.did-setup}
netif=${netif##*/net.}
[ -e /tmp/ifcfg/ifcfg-$netif ] && continue
unset bridge
unset bond
unset bondslaves
unset bondname
unset bondoptions
unset uuid
unset ip
unset gw
unset mtu
unset mask
unset macaddr
unset slave
unset ethname
[ -e /tmp/bond.${netif}.info ] && . /tmp/bond.${netif}.info
uuid=$(cat /proc/sys/kernel/random/uuid)
if [ "$netif" = "$bridgename" ]; then
bridge=yes
elif [ "$netif" = "$bondname" ]; then
# $netif can't be bridge and bond at the same time
bond=yes
fi
if [ "$netif" = "$vlanname" ]; then
vlan=yes
fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
{
echo "# Generated by dracut initrd"
echo "NAME='$netif'"
if [ -f /tmp/net.$netif.has_ibft_config ]; then
echo "STARTMODE='nfsroot'"
else
echo "STARTMODE='auto'"
fi
local bootproto="static"
if [ -f /tmp/leaseinfo.${netif}.dhcp.ipv6 ]; then
bootproto="dhcp6"
fi
if [ -f /tmp/leaseinfo.${netif}.dhcp.ipv4 ]; then
if [ "$bootproto" = "dhcp6" ]; then
bootproto="dhcp"
else
bootproto="dhcp4"
fi
fi
echo "BOOTPROTO='$bootproto'"
if [ "$bootproto" = "static" ]; then
# If we've booted with static ip= lines, the override file is there
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
echo "IPADDR='$ip'"
if [ -n "$mask" ]; then
if strstr "$mask" "."; then
echo "NETMASK='$mask'"
else
echo "PREFIXLEN='$mask'"
fi
fi
if [ -n "$gw" ]; then
echo "GATEWAY='$gw'"
fi
fi
[ -n "$mtu" ] && echo "MTU='$mtu'"
} > /tmp/ifcfg/ifcfg-$netif
# bridge needs different things written to ifcfg
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
# standard interface
{
if [ -n "$macaddr" ]; then
echo "LLADDR='$macaddr'"
else
echo "LLADDR='$(cat /sys/class/net/$netif/address)'"
fi
echo "INTERFACETYPE='Ethernet'"
} >> /tmp/ifcfg/ifcfg-$netif
fi
if [ -n "$vlan" ]; then
{
echo "INTERFACETYPE='Vlan'"
echo "VLAN_ID='$(get_vid $vlanname)'"
echo "ETHERDEVICE='$phydevice'"
} >> /tmp/ifcfg/ifcfg-$netif
fi
if [ -n "$bond" ] ; then
# bond interface
{
# This variable is an indicator of a bond interface for initscripts
echo "BONDING_MASTER='yes'"
echo "BONDING_MODULE_OPTS='$bondoptions'"
echo "INTERFACETYPE='Bond'"
} >> /tmp/ifcfg/ifcfg-$netif
local i=0
for slave in $bondslaves ; do
echo "BONDING_SLAVE_$i='$slave'" >> /tmp/ifcfg/ifcfg-$netif
i=$((i+1))
# write separate ifcfg file for the raw eth interface
{
echo "# Generated by dracut initrd"
echo "NAME='$slave'"
echo "INTERFACETYPE='Ethernet'"
echo "STARTMODE='hotplug'"
echo "BOOTPROTO='none'"
echo "# ETHTOOL=''"
} >> /tmp/ifcfg/ifcfg-$slave
done
fi
if [ -n "$bridge" ] ; then
# bridge
{
echo "INTERFACETYPE='Bridge'"
echo "BRIDGE='yes'"
echo "BRIDGE_STP='off'"
echo "BRIDGE_FORWARDDELAY='0'"
echo -n "BRIDGE_PORTS='"
} >> /tmp/ifcfg/ifcfg-$netif
if [ "$ethname" = "$bondname" ] ; then
{
for slave in $bondslaves ; do
echo -n "$bondname "
done
echo "'"
} >> /tmp/ifcfg/ifcfg-$netif
else
echo "$ethname'" >> /tmp/ifcfg/ifcfg-$netif
fi
fi
done
# Pass network opts
mkdir -m 0755 -p /run/initramfs/state/etc/sysconfig/network
mkdir -m 0755 -p /run/initramfs/state/var/run/wicked
echo "files /etc/sysconfig/network" >> /run/initramfs/rwtab
echo "files /var/run/wicked" >> /run/initramfs/rwtab
{
cp /tmp/net.* /run/initramfs/
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/resolv.conf
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network
cp /tmp/leaseinfo.* /run/initramfs/state/var/run/wicked/
} > /dev/null 2>&1