Accepting request 224249 from Base:System

- Make sure that --add-drivers is not called with whitespace string which
  will lead to a "read line" user input request and things may get stuck at
  installation.
  - Add: dracut-fix-whitespace-add-drivers_call.patch
- Remove s390 grub module again -> this will go into grub2 package
  (ask rw@suse.de for details)
  Delete/remove: s390_add-user-space-grub-rule.patch
- Add installkernel script which installs the kernel when:
  make install
  is invoked. The script from mkinitrd has been taken over and adopted.
  Added source: dracut-installkernel
  bnc#862990 (forwarded request 224246 from trenn)

OBS-URL: https://build.opensuse.org/request/show/224249
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/dracut?expand=0&rev=34
This commit is contained in:
Stephan Kulow 2014-03-01 06:46:57 +00:00 committed by Git OBS Bridge
commit 4762fe37db
6 changed files with 1003 additions and 43 deletions

View File

@ -0,0 +1,769 @@
Index: dracut-036/modules.d/45ifcfg/module-setup.sh
===================================================================
--- dracut-036.orig/modules.d/45ifcfg/module-setup.sh 2014-01-29 08:35:47.000000000 +0100
+++ dracut-036/modules.d/45ifcfg/module-setup.sh 2014-02-14 14:40:06.851658347 +0100
@@ -4,7 +4,13 @@
# called by dracut
check() {
- [[ -d /etc/sysconfig/network-scripts ]] && return 0
+ local link=$(readlink $moddir/write-ifcfg.sh)
+ [[ "$link" = "write-ifcfg-suse.sh" ]] && \
+ [[ -d /etc/sysconfig/network ]] && \
+ return 0
+ [[ "$link" = "write-ifcfg-redhat.sh" ]] && \
+ [[ -d /etc/sysconfig/network-scripts ]] && \
+ return 0
return 255
}
Index: dracut-036/modules.d/45ifcfg/write-ifcfg.sh
===================================================================
--- dracut-036.orig/modules.d/45ifcfg/write-ifcfg.sh 2014-01-29 08:35:47.000000000 +0100
+++ /dev/null 1970-01-01 00:00:00.000000000 +0000
@@ -1,270 +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
-
- 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}\""
-}
-
-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 "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
- {
- if [ -n "$macaddr" ]; then
- echo "MACADDR=\"$macaddr\""
- else
- echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
- fi
- print_s390 $netif
- 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
Index: dracut-036/modules.d/45ifcfg/write-ifcfg-redhat.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dracut-036/modules.d/45ifcfg/write-ifcfg-redhat.sh 2014-02-14 12:45:19.558236609 +0100
@@ -0,0 +1,270 @@
+#!/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
+
+ 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}\""
+}
+
+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 "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
+ {
+ if [ -n "$macaddr" ]; then
+ echo "MACADDR=\"$macaddr\""
+ else
+ echo "HWADDR=\"$(cat /sys/class/net/$netif/address)\""
+ fi
+ print_s390 $netif
+ 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
Index: dracut-036/modules.d/45ifcfg/write-ifcfg-suse.sh
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ dracut-036/modules.d/45ifcfg/write-ifcfg-suse.sh 2014-02-14 17:48:33.209350683 +0100
@@ -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
Index: dracut-036/modules.d/40network/ifup.sh
===================================================================
--- dracut-036.orig/modules.d/40network/ifup.sh 2014-02-14 12:45:19.487236605 +0100
+++ dracut-036/modules.d/40network/ifup.sh 2014-02-14 14:40:29.587659739 +0100
@@ -174,6 +174,7 @@ do_dhcp() {
info "Starting DHCP on interface $netif"
$dhclient --test $netif > /tmp/leaseinfo.${netif}.dhcp.ipv${1:1:1}
dhcp_apply $1 || return $?
+ echo $netif > /tmp/net.${netif}.did-setup
return 0
}

View File

@ -0,0 +1,77 @@
Index: dracut-036/mkinitrd-suse.sh
===================================================================
--- dracut-036.orig/mkinitrd-suse.sh
+++ dracut-036/mkinitrd-suse.sh
@@ -70,10 +70,7 @@ usage () {
$cmd " -j device Journal device"
$cmd " -D interface Run dhcp on the specified interface."
$cmd " -I interface Configure the specified interface statically."
- $cmd " -a acpi_dsdt Attach compiled ACPI DSDT (Differentiated"
- $cmd " System Description Table) to initrd. This"
- $cmd " replaces the DSDT of the BIOS. Defaults to"
- $cmd " the ACPI_DSDT variable in /etc/sysconfig/kernel."
+ $cmd " -a acpi_dsdt Obsolete, do not use."
$cmd " -s size Add splash animation and bootscreen to initrd."
[[ $1 = '-n' ]] && exit 0
@@ -310,11 +307,10 @@ if [ -f /etc/sysconfig/kernel ] ; then
. /etc/sysconfig/kernel
fi
[[ $module_list ]] || module_list="${INITRD_MODULES}"
-basicmodules="$basicmodules ${module_list}"
[[ $domu_module_list ]] || domu_module_list="${DOMU_INITRD_MODULES}"
-[[ $acpi_dsdt ]] || acpi_dsdt="${ACPI_DSDT}"
+shopt -s extglob
-echo "Creating: target|kernel|dracut args|basicmodules "
+echo "Creating: target|kernel|dracut args "
for ((i=0 ; $i<${#targets[@]} ; i++)); do
if [[ $img_vers ]];then
@@ -324,28 +320,30 @@ for ((i=0 ; $i<${#targets[@]} ; i++)); d
fi
kernel="${kernels[$i]}"
+ if is_xen_kernel $kernel $rootfs ; then
+ modules_all="${module_list} ${domu_module_list}"
+ else
+ modules_all="${module_list}"
+ fi
+
+ # Remove leading and trailing spaces needs (set above): shopt -s extglob
+ modules_all=${modules_all%%+([[:space:]])}
+ modules_all=${modules_all##+([[:space:]])}
+ if [ -n "${modules_all}" ];then
+ dracut_args_all="$dracut_args --add-drivers \"${modules_all}\""
+ else
+ dracut_args_all="$dracut_args"
+ fi
+
# Duplicate code: No way found how to redirect output based on $quiet
if [[ $quiet == 1 ]];then
- echo "$target|$kernel|$dracut_args|$basicmodules"
+ echo "$target|$kernel|$dracut_args_all"
if is_xen_kernel $kernel $rootfs ; then
basicmodules="$basicmodules ${domu_module_list}"
fi
- if [[ $basicmodules ]]; then
- $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
- "$kernel" &>/dev/null
- else
- $dracut_cmd $dracut_args "$target" "$kernel" &>/dev/null
- fi
+ $dracut_cmd $dracut_args_all "$target" "$kernel" &>/dev/null
else
- if is_xen_kernel $kernel $rootfs ; then
- basicmodules="$basicmodules ${domu_module_list}"
- fi
- if [[ $basicmodules ]]; then
- $dracut_cmd $dracut_args --add-drivers "$basicmodules" "$target" \
- "$kernel"
- else
- $dracut_cmd $dracut_args "$target" "$kernel"
- fi
+ $dracut_cmd $dracut_args_all "$target" "$kernel"
fi
done

107
dracut-installkernel Normal file
View File

@ -0,0 +1,107 @@
#! /bin/sh
#
# /sbin/installkernel - written by tyson@rwii.com
#
# May 21, 2003 - agruen@suse.de
# * Adapted for SuSE and cleaned up.
#
# This file is kept in the following CVS repository:
#
# $Source: /suse/yast2/cvsroot/mkinitrd/installkernel,v $
# $Revision: 1.8 $
#
: ${INSTALL_PATH:=/boot}
KERNEL_VERSION=$1
BOOTIMAGE=$2
MAPFILE=$3
case "$(uname -m)" in
s390|s390x)
BOOTFILE=image
;;
ppc|ppc64)
BOOTFILE=vmlinux
;;
*)
BOOTFILE=vmlinuz
;;
esac
#
# Move away files from versions up to SuSE Linux 8.2
#
if [ -f $INSTALL_PATH/$BOOTFILE -a ! -L $INSTALL_PATH/$BOOTFILE ]; then
mv $INSTALL_PATH/$BOOTFILE $INSTALL_PATH/$BOOTFILE.old
fi
if [ -L $INSTALL_PATH/System.map ]; then
rm -f $INSTALL_PATH/System.map
elif [ -f $INSTALLPATH/System.map ]; then
mv $INSTALL_PATH/System.map $INSTALL_PATH/System.map.old
fi
#
# Move away files from after SuSE Linux 8.2
#
if [ -f $INSTALL_PATH/$BOOTFILE-$KERNEL_VERSION ]; then
mv $INSTALL_PATH/$BOOTFILE-$KERNEL_VERSION \
$INSTALL_PATH/$BOOTFILE-$KERNEL_VERSION.old;
fi
if [ -f $INSTALL_PATH/System.map-$KERNEL_VERSION ]; then
mv $INSTALL_PATH/System.map-$KERNEL_VERSION \
$INSTALL_PATH/System.map-$KERNEL_VERSION.old;
fi
#
# Install new files
#
cp -fp $BOOTIMAGE $INSTALL_PATH/$BOOTFILE-$KERNEL_VERSION
cp -fp $MAPFILE $INSTALL_PATH/System.map-$KERNEL_VERSION
KERNTYPES=$(dirname $MAPFILE)/init/kerntypes.o
if [ -e $KERNTYPES ]; then
cp -fp $KERNTYPES $INSTALL_PATH/Kerntypes-$KERNEL_VERSION
fi
case "$(uname -m)" in
i?86 | x86_64)
KERNBIN=$(dirname $MAPFILE)/vmlinux
if [ -e $KERNBIN ]; then
if [ -f $INSTALL_PATH/vmlinux-$KERNEL_VERSION.gz ]; then
mv $INSTALL_PATH/vmlinux-$KERNEL_VERSION.gz \
$INSTALL_PATH/vmlinux-$KERNEL_VERSION.gz.old;
fi
gzip -c $KERNBIN > $INSTALL_PATH/vmlinux-$KERNEL_VERSION.gz
fi
;;
esac
if [ ! -d /lib/modules/$KERNEL_VERSION ];then
make modules_install
fi
#
# Generate initial ramdisk
#
if [ -x /usr/bin/dracut -a -d /lib/modules/$KERNEL_VERSION ]; then
/usr/bin/dracut --hostonly --force $INSTALL_PATH/initrd-$KERNEL_VERSION
else
echo "You may need to create an initial ramdisk now."
fi
#
# Update boot loader
#
if [ -x /sbin/update-bootloader ]; then
opt_initrd=
[ -e $INSTALL_PATH/initrd-$KERNEL_VERSION ] \
&& opt_initrd="--initrd $INSTALL_PATH/initrd-$KERNEL_VERSION"
/sbin/update-bootloader --name $KERNEL_VERSION \
--image $INSTALL_PATH/$BOOTFILE-$KERNEL_VERSION \
$opt_initrd --add --force
fi

View File

@ -1,3 +1,39 @@
-------------------------------------------------------------------
Thu Feb 27 14:08:56 UTC 2014 - trenn@suse.de
- Make sure that --add-drivers is not called with whitespace string which
will lead to a "read line" user input request and things may get stuck at
installation.
- Add: dracut-fix-whitespace-add-drivers_call.patch
- Remove s390 grub module again -> this will go into grub2 package
(ask rw@suse.de for details)
Delete/remove: s390_add-user-space-grub-rule.patch
- Add installkernel script which installs the kernel when:
make install
is invoked. The script from mkinitrd has been taken over and adopted.
Added source: dracut-installkernel
bnc#862990
-------------------------------------------------------------------
Fri Feb 21 14:56:20 UTC 2014 - trenn@suse.de
- Fix syntax error -> missing then
- Correct path, it is /usr/bin/grub2-emu
-------------------------------------------------------------------
Mon Feb 17 18:51:58 UTC 2014 - trenn@suse.de
- autofs4 is always included since mainline git commit: 314929920f27448b45bfd
systemd: ensure autofs4 and ipv6 are included
- Always add network and iscsi dracut module, so that ibft, iscsi, nfsroot
work as expected.
-------------------------------------------------------------------
Fri Feb 14 14:02:52 UTC 2014 - pwieczorkiewicz@suse.com
- change_write_ifcfg_to_suse.patch:
Detect the system flavor and write the ifcfg files accordingly.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Feb 14 13:10:28 UTC 2014 - trenn@suse.de Fri Feb 14 13:10:28 UTC 2014 - trenn@suse.de

View File

@ -33,6 +33,7 @@ Source2: parse-suse-initrd.sh
Source3: mkinitrd_setup_dummy Source3: mkinitrd_setup_dummy
Source4: purge-kernels Source4: purge-kernels
Source5: purge-kernels.service Source5: purge-kernels.service
Source6: dracut-installkernel
Patch10: 0006-Install-bin-mount.patch Patch10: 0006-Install-bin-mount.patch
Patch11: 0013-Correct-paths-for-openSUSE.patch Patch11: 0013-Correct-paths-for-openSUSE.patch
Patch12: 0014-Check-for-plymouth-lib-directories.patch Patch12: 0014-Check-for-plymouth-lib-directories.patch
@ -41,8 +42,9 @@ Patch14: suse_grub_manpage.patch
Patch15: replace_dhclient_with_wickedd_dhcp_supplicants.patch Patch15: replace_dhclient_with_wickedd_dhcp_supplicants.patch
Patch16: fix-iscsi-firmware.patch Patch16: fix-iscsi-firmware.patch
Patch17: remove-iscsiuio.patch Patch17: remove-iscsiuio.patch
Patch18: s390_add-user-space-grub-rule.patch Patch18: 0015-add-new-s390x-specific-rule-files.patch
Patch19: 0015-add-new-s390x-specific-rule-files.patch Patch19: change_write_ifcfg_to_suse.patch
Patch20: dracut-fix-whitespace-add-drivers_call.patch
BuildRequires: asciidoc BuildRequires: asciidoc
BuildRequires: bash BuildRequires: bash
BuildRequires: docbook-xsl-stylesheets BuildRequires: docbook-xsl-stylesheets
@ -65,9 +67,6 @@ Requires: systemd-sysvinit
Requires: udev > 166 Requires: udev > 166
Requires: util-linux >= 2.21 Requires: util-linux >= 2.21
Requires: xz Requires: xz
%ifarch s390x
Requires: grub2
%endif
Recommends: binutils Recommends: binutils
Recommends: logrotate Recommends: logrotate
Obsoletes: mkinitrd < 2.8.2 Obsoletes: mkinitrd < 2.8.2
@ -123,6 +122,7 @@ This package contains tools to assemble the local initrd and host configuration.
%patch17 -p1 %patch17 -p1
%patch18 -p1 %patch18 -p1
%patch19 -p1 %patch19 -p1
%patch20 -p1
%build %build
%configure\ %configure\
@ -164,7 +164,7 @@ mkdir -p %{buildroot}%{_localstatedir}/log
touch %{buildroot}%{_localstatedir}/log/dracut.log touch %{buildroot}%{_localstatedir}/log/dracut.log
install -m 0644 dracut.conf.d/suse.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf install -m 0644 dracut.conf.d/suse.conf.example %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
echo 'add_drivers+="autofs4"' >> %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf echo 'add_dracutmodules+="network iscsi"' >> %{buildroot}%{_sysconfdir}/dracut.conf.d/01-dist.conf
%ifarch %ix86 x86_64 %ifarch %ix86 x86_64
echo 'early_microcode="yes"' > %{buildroot}%{_sysconfdir}/dracut.conf.d/02-early-microcode.conf echo 'early_microcode="yes"' > %{buildroot}%{_sysconfdir}/dracut.conf.d/02-early-microcode.conf
@ -182,7 +182,13 @@ install -m 0644 dracut.logrotate %{buildroot}%{_sysconfdir}/logrotate.d/dracut
install -D -m 0755 %{SOURCE4} %{buildroot}/sbin/purge-kernels install -D -m 0755 %{SOURCE4} %{buildroot}/sbin/purge-kernels
install -m 644 %{SOURCE5} %{buildroot}/%{_unitdir}/purge-kernels.service install -m 644 %{SOURCE5} %{buildroot}/%{_unitdir}/purge-kernels.service
chmod 755 %{buildroot}/%{dracutlibdir}/modules.d/95grub2/* install -D -m 0755 %{SOURCE6} %{buildroot}/sbin/installkernel
%if 0%{?suse_version}
ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-suse.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
%else
ln -s %{dracutlibdir}/modules.d/45ifcfg/write-ifcfg-redhat.sh %{buildroot}/%{dracutlibdir}/modules.d/45ifcfg/write-ifcfg.sh
%endif
%pre %pre
%service_add_pre purge-kernels.service %service_add_pre purge-kernels.service
@ -195,6 +201,7 @@ chmod 755 %{buildroot}/%{dracutlibdir}/modules.d/95grub2/*
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg %doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
%{_bindir}/dracut %{_bindir}/dracut
/sbin/purge-kernels /sbin/purge-kernels
/sbin/installkernel
/sbin/mkinitrd /sbin/mkinitrd
/sbin/mkinitrd_setup /sbin/mkinitrd_setup
%{_bindir}/lsinitrd %{_bindir}/lsinitrd
@ -269,7 +276,6 @@ chmod 755 %{buildroot}/%{dracutlibdir}/modules.d/95grub2/*
%{dracutlibdir}/modules.d/95dasd_mod %{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95dasd_rules %{dracutlibdir}/modules.d/95dasd_rules
%{dracutlibdir}/modules.d/95fstab-sys %{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95grub2
%{dracutlibdir}/modules.d/95zfcp %{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95zfcp_rules %{dracutlibdir}/modules.d/95zfcp_rules
%{dracutlibdir}/modules.d/95terminfo %{dracutlibdir}/modules.d/95terminfo

View File

@ -1,35 +0,0 @@
Index: dracut-036/modules.d/95grub2/module-setup.sh
===================================================================
--- /dev/null
+++ dracut-036/modules.d/95grub2/module-setup.sh
@@ -0,0 +1,17 @@
+#!/bin/bash
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+
+# called by dracut
+check() {
+ local _arch=$(uname -m)
+ [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
+ return 0
+}
+
+# called by dracut
+install() {
+ inst_hook cmdline 30 "$moddir/s390-grub2.sh"
+ inst_multiple grub-emu kexec
+}
+
Index: dracut-036/modules.d/95grub2/s390-grub2.sh
===================================================================
--- /dev/null
+++ dracut-036/modules.d/95grub2/s390-grub2.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
+# ex: ts=8 sw=4 sts=4 et filetype=sh
+if getargbool 0 initgrub ; then
+ if [ -e /usr/bin/grub-emu ]
+ /boot/grub2/grub-emu
+ fi
+fi