From fd3902d30bc30e87bbe5f179df38894bbfb510aa Mon Sep 17 00:00:00 2001 From: Marcin Krol Date: Sat, 17 May 2014 10:45:28 +0000 Subject: [PATCH] - fixes from upstream --- git.patch | 800 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 800 insertions(+) create mode 100644 git.patch diff --git a/git.patch b/git.patch new file mode 100644 index 0000000..3c4b11d --- /dev/null +++ b/git.patch @@ -0,0 +1,800 @@ +diff -urN dracut-037/dracut-functions.sh dracut.dev/dracut-functions.sh +--- dracut-037/dracut-functions.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/dracut-functions.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -33,7 +33,11 @@ + 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 -urN dracut-037/dracut-initramfs-restore.sh dracut.dev/dracut-initramfs-restore.sh +--- dracut-037/dracut-initramfs-restore.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/dracut-initramfs-restore.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -6,6 +6,10 @@ + + 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 @@ + 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 -urN dracut-037/dracut.sh dracut.dev/dracut.sh +--- dracut-037/dracut.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/dracut.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -834,6 +834,13 @@ + export DRACUT_KERNEL_LAZY="1" + export DRACUT_RESOLVE_LAZY="1" + ++if [[ $print_cmdline ]]; then ++ stdloglvl=0 ++ sysloglvl=0 ++ fileloglvl=0 ++ kmsgloglvl=0 ++fi ++ + if [[ -f $dracutbasedir/dracut-functions.sh ]]; then + . $dracutbasedir/dracut-functions.sh + else +@@ -907,6 +914,7 @@ + dracut_args[$i]="\"${dracut_args[$i]}\"" + #" keep vim happy + done ++ + dinfo "Executing: $0 ${dracut_args[@]}" + + [[ $do_list = yes ]] && { +diff -urN dracut-037/dracut-version.sh dracut.dev/dracut-version.sh +--- dracut-037/dracut-version.sh 2014-03-19 16:17:06.000000000 +0000 ++++ dracut.dev/dracut-version.sh 1970-01-01 00:00:00.000000000 +0000 +@@ -1 +0,0 @@ +-DRACUT_VERSION=037 +diff -urN dracut-037/lsinitrd.sh dracut.dev/lsinitrd.sh +--- dracut-037/lsinitrd.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/lsinitrd.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -160,27 +160,35 @@ + ;; + 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 -urN dracut-037/modules.d/10i18n/parse-i18n.sh dracut.dev/modules.d/10i18n/parse-i18n.sh +--- dracut-037/modules.d/10i18n/parse-i18n.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/10i18n/parse-i18n.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -12,7 +12,7 @@ + _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 -urN dracut-037/modules.d/40network/dhclient-script.sh dracut.dev/modules.d/40network/dhclient-script.sh +--- dracut-037/modules.d/40network/dhclient-script.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/40network/dhclient-script.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -64,13 +64,17 @@ + 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 -urN dracut-037/modules.d/40network/ifup.sh dracut.dev/modules.d/40network/ifup.sh +--- dracut-037/modules.d/40network/ifup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/40network/ifup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -130,12 +130,12 @@ + + # 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 @@ + + # 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 -urN dracut-037/modules.d/40network/net-lib.sh dracut.dev/modules.d/40network/net-lib.sh +--- dracut-037/modules.d/40network/net-lib.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/40network/net-lib.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -377,7 +377,7 @@ + # ip= means anaconda-style static config argument cluster: + # ip= gateway= netmask= hostname= mtu= + # ksdevice={link|bootif|ibft||} +- if strstr "$autoconf" "*.*.*.*"; then ++ if strglob "$autoconf" "*.*.*.*"; then + ip="$autoconf" + gw=$(getarg gateway=) + mask=$(getarg netmask=) +@@ -516,3 +516,27 @@ + 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 -urN dracut-037/modules.d/45ifcfg/write-ifcfg.sh dracut.dev/modules.d/45ifcfg/write-ifcfg.sh +--- dracut-037/modules.d/45ifcfg/write-ifcfg.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/45ifcfg/write-ifcfg.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -3,6 +3,8 @@ + # ex: ts=8 sw=4 sts=4 et filetype=sh + + # NFS root might have reached here before /tmp/net.ifaces was written ++type is_persistent_ethernet_name >/dev/null 2>&1 || . /lib/net-lib.sh ++ + udevadm settle --timeout=30 + + if [ -e /tmp/bridge.info ]; then +@@ -85,7 +87,7 @@ + + netif=${netup%%.did-setup} + netif=${netif##*/net.} +- strstr "$netif" ":*:*:*:*:" && continue ++ strglobin "$netif" ":*:*:*:*:" && continue + [ -e /tmp/ifcfg/ifcfg-$netif ] && continue + unset bridge + unset bond +@@ -120,9 +122,9 @@ + echo "ONBOOT=yes" + echo "NETBOOT=yes" + echo "UUID=\"$uuid\"" ++ strstr "$(ip -6 addr show dev $netif)" 'inet6' && echo "IPV6INIT=yes" + 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 +@@ -132,7 +134,7 @@ + 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 +151,7 @@ + fi + fi + fi +- if strstr "$gw" '*:*:*'; then ++ if strglobin "$gw" '*:*:*'; then + echo "IPV6_DEFAULTGW=\"$gw\"" + elif [ -n "$gw" ]; then + echo "GATEWAY=\"$gw\"" +@@ -164,7 +166,13 @@ + { + [ -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 -urN dracut-037/modules.d/80cms/cmsifup.sh dracut.dev/modules.d/80cms/cmsifup.sh +--- dracut-037/modules.d/80cms/cmsifup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/80cms/cmsifup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -8,7 +8,7 @@ + + . /tmp/cms.conf + +-strstr "$IPADDR" '*:*:*' && ipv6=1 ++strglobin "$IPADDR" '*:*:*' && ipv6=1 + + if [ "$ipv6" ] && ! str_starts "$IPADDR" "["; then + IPADDR="[$IPADDR]" +diff -urN dracut-037/modules.d/80cms/cmssetup.sh dracut.dev/modules.d/80cms/cmssetup.sh +--- dracut-037/modules.d/80cms/cmssetup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/80cms/cmssetup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -144,6 +144,7 @@ + processcmsfile() + { + source /tmp/cms.conf ++ SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')" + + if [[ $NETTYPE ]]; then + ( +diff -urN dracut-037/modules.d/80cms/cms-write-ifcfg.sh dracut.dev/modules.d/80cms/cms-write-ifcfg.sh +--- dracut-037/modules.d/80cms/cms-write-ifcfg.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/80cms/cms-write-ifcfg.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -26,7 +26,7 @@ + + 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 -urN dracut-037/modules.d/90dm/module-setup.sh dracut.dev/modules.d/90dm/module-setup.sh +--- dracut-037/modules.d/90dm/module-setup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/90dm/module-setup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -16,7 +16,7 @@ + # 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 -urN dracut-037/modules.d/90lvm/module-setup.sh dracut.dev/modules.d/90lvm/module-setup.sh +--- dracut-037/modules.d/90lvm/module-setup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/90lvm/module-setup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -80,7 +80,8 @@ + 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 -urN dracut-037/modules.d/90mdraid/module-setup.sh dracut.dev/modules.d/90mdraid/module-setup.sh +--- dracut-037/modules.d/90mdraid/module-setup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/90mdraid/module-setup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -54,6 +54,8 @@ + done + ) + ++ [[ -z "$UUID" ]] && continue ++ + if ! [[ ${_activated[${UUID}]} ]]; then + printf "%s" " rd.md.uuid=${UUID}" + _activated["${UUID}"]=1 +diff -urN dracut-037/modules.d/95fcoe/fcoe-genrules.sh dracut.dev/modules.d/95fcoe/fcoe-genrules.sh +--- dracut-037/modules.d/95fcoe/fcoe-genrules.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/95fcoe/fcoe-genrules.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -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 -urN dracut-037/modules.d/95fcoe/fcoe-up.sh dracut.dev/modules.d/95fcoe/fcoe-up.sh +--- dracut-037/modules.d/95fcoe/fcoe-up.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/95fcoe/fcoe-up.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -28,12 +28,35 @@ + # 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 -urN dracut-037/modules.d/95fcoe/module-setup.sh dracut.dev/modules.d/95fcoe/module-setup.sh +--- dracut-037/modules.d/95fcoe/module-setup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/95fcoe/module-setup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -21,7 +21,7 @@ + + # 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 -urN dracut-037/modules.d/95fstab-sys/mount-sys.sh dracut.dev/modules.d/95fstab-sys/mount-sys.sh +--- dracut-037/modules.d/95fstab-sys/mount-sys.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/95fstab-sys/mount-sys.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -27,7 +27,11 @@ + 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 -urN dracut-037/modules.d/95nbd/nbdroot.sh dracut.dev/modules.d/95nbd/nbdroot.sh +--- dracut-037/modules.d/95nbd/nbdroot.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/95nbd/nbdroot.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -111,6 +111,10 @@ + fi + fi + ++if strstr "$(nbd-client --help 2>&1)" "systemd-mark"; then ++ preopts="--systemd-mark $preopts" ++fi ++ + nbd-client $preopts "$nbdserver" $nbdport /dev/nbd0 $opts || exit 1 + + # NBD doesn't emit uevents when it gets connected, so kick it +diff -urN dracut-037/modules.d/95nfs/nfs-lib.sh dracut.dev/modules.d/95nfs/nfs-lib.sh +--- dracut-037/modules.d/95nfs/nfs-lib.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/95nfs/nfs-lib.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -40,7 +40,7 @@ + arg="${arg##$nfs:}" + + # check if we have a server +- if strstr "$arg" ':/*' ; then ++ if strstr "$arg" ':/' ; then + server="${arg%%:/*}" + arg="/${arg##*:/}" + fi +diff -urN dracut-037/modules.d/95resume/parse-resume.sh dracut.dev/modules.d/95resume/parse-resume.sh +--- dracut-037/modules.d/95resume/parse-resume.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/95resume/parse-resume.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -70,9 +70,10 @@ + printf '[ -e "%s" ] && { ln -s "%s" /dev/resume; rm -f -- "$job" "%s/initqueue/timeout/resume.sh"; }\n' \ + "$resume" "$resume" "$hookdir" >> $hookdir/initqueue/settled/resume.sh + +- printf -- "%s" 'warn "Cancelling resume operation. Device not found.";' +- printf -- ' cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";\n' \ +- "$hookdir" >> $hookdir/initqueue/timeout/resume.sh ++ { ++ printf -- "%s" 'warn "Cancelling resume operation. Device not found.";' ++ printf -- ' cancel_wait_for_dev /dev/resume; rm -f -- "$job" "%s/initqueue/settled/resume.sh";\n' "$hookdir" ++ } >> $hookdir/initqueue/timeout/resume.sh + + mv /lib/dracut/resume.sh /lib/dracut/hooks/pre-mount/10-resume.sh + else +diff -urN dracut-037/modules.d/98systemd/dracut-initqueue.service dracut.dev/modules.d/98systemd/dracut-initqueue.service +--- dracut-037/modules.d/98systemd/dracut-initqueue.service 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/98systemd/dracut-initqueue.service 2014-05-17 10:31:22.000000000 +0000 +@@ -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 -urN dracut-037/modules.d/98systemd/module-setup.sh dracut.dev/modules.d/98systemd/module-setup.sh +--- dracut-037/modules.d/98systemd/module-setup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/98systemd/module-setup.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -44,6 +44,7 @@ + $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 -urN dracut-037/modules.d/99base/dracut-lib.sh dracut.dev/modules.d/99base/dracut-lib.sh +--- dracut-037/modules.d/99base/dracut-lib.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/99base/dracut-lib.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -20,19 +20,33 @@ + [ "$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 @@ + 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 @@ + arg="${arg##$nfs:}" + + # check if we have a server +- if strstr "$arg" ':/*' ; then ++ if strstr "$arg" ':/' ; then + server="${arg%%:/*}" + arg="/${arg##*:/}" + fi +@@ -969,6 +983,7 @@ + local _cmd + local _exe + local _rl ++ local _ret=1 + local i + _cmd="$1" + [ -z "$_cmd" ] && return 1 +@@ -983,8 +998,9 @@ + fi + i=${i%/exe} + echo ${i##/proc/} ++ _ret=0 + done +- return 0 ++ return $_ret + } + fi + +diff -urN dracut-037/modules.d/99base/init.sh dracut.dev/modules.d/99base/init.sh +--- dracut-037/modules.d/99base/init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/99base/init.sh 2014-05-17 10:31:22.000000000 +0000 +@@ -353,7 +353,9 @@ + # 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 -urN dracut-037/modules.d/99fs-lib/module-setup.sh dracut.dev/modules.d/99fs-lib/module-setup.sh +--- dracut-037/modules.d/99fs-lib/module-setup.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/modules.d/99fs-lib/module-setup.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -17,10 +17,10 @@ + 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 @@ + btrfs) + echo -n " btrfsck " + ;; +- *) +- [[ -x fsck.$fs ]] && echo -n " fsck.$fs " +- ;; + esac ++ ++ echo -n " fsck.$fs " ++ return 0 + } + + include_fs_helper_modules() { +diff -urN dracut-037/test/TEST-01-BASIC/test-init.sh dracut.dev/test/TEST-01-BASIC/test-init.sh +--- dracut-037/test/TEST-01-BASIC/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-01-BASIC/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-02-SYSTEMD/test-init.sh dracut.dev/test/TEST-02-SYSTEMD/test-init.sh +--- dracut-037/test/TEST-02-SYSTEMD/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-02-SYSTEMD/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-03-USR-MOUNT/test-init.sh dracut.dev/test/TEST-03-USR-MOUNT/test-init.sh +--- dracut-037/test/TEST-03-USR-MOUNT/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-03-USR-MOUNT/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-04-FULL-SYSTEMD/test-init.sh dracut.dev/test/TEST-04-FULL-SYSTEMD/test-init.sh +--- dracut-037/test/TEST-04-FULL-SYSTEMD/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-04-FULL-SYSTEMD/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-10-RAID/test-init.sh dracut.dev/test/TEST-10-RAID/test-init.sh +--- dracut-037/test/TEST-10-RAID/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-10-RAID/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-11-LVM/test-init.sh dracut.dev/test/TEST-11-LVM/test-init.sh +--- dracut-037/test/TEST-11-LVM/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-11-LVM/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-12-RAID-DEG/test-init.sh dracut.dev/test/TEST-12-RAID-DEG/test-init.sh +--- dracut-037/test/TEST-12-RAID-DEG/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-12-RAID-DEG/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-14-IMSM/test-init.sh dracut.dev/test/TEST-14-IMSM/test-init.sh +--- dracut-037/test/TEST-14-IMSM/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-14-IMSM/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-16-DMSQUASH/test-init.sh dracut.dev/test/TEST-16-DMSQUASH/test-init.sh +--- dracut-037/test/TEST-16-DMSQUASH/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-16-DMSQUASH/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-17-LVM-THIN/test-init.sh dracut.dev/test/TEST-17-LVM-THIN/test-init.sh +--- dracut-037/test/TEST-17-LVM-THIN/test-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-17-LVM-THIN/test-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -urN dracut-037/test/TEST-20-NFS/client-init.sh dracut.dev/test/TEST-20-NFS/client-init.sh +--- dracut-037/test/TEST-20-NFS/client-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-20-NFS/client-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -4,7 +4,7 @@ + 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 -urN dracut-037/test/TEST-50-MULTINIC/client-init.sh dracut.dev/test/TEST-50-MULTINIC/client-init.sh +--- dracut-037/test/TEST-50-MULTINIC/client-init.sh 2014-03-19 16:16:08.000000000 +0000 ++++ dracut.dev/test/TEST-50-MULTINIC/client-init.sh 2014-05-17 10:31:23.000000000 +0000 +@@ -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 -- 2.46.0