Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP1:Update
dracut.608
dracut_v37_to_HEAD.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File dracut_v37_to_HEAD.patch of Package dracut.608
HEAD is: commit 0fa5dbedc5b222435f51f7460a81232ee120c4e1 Date: Tue May 20 13:23:43 2014 +0200 diff --git a/dracut-functions.sh b/dracut-functions.sh index 391b549..ac22b7e 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 @@ -49,7 +53,7 @@ require_binaries() { for cmd in "$@"; do if ! find_binary "$cmd" &>/dev/null; then - dinfo "$_module_name: Could not find command '$cmd'!" + dinfo "dracut module '${_module_name#[0-9][0-9]}' will not be installed, because command '$cmd' could not be found!" ((_ret++)) fi done @@ -221,7 +225,7 @@ print_vars() { for _var in "$@" do - eval printf -v _value "%s" "\$$_var" + eval printf -v _value "%s" \""\$$_var"\" [[ ${_value} ]] && printf '%s="%s"\n' "$_var" "$_value" done } 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/dracut.sh b/dracut.sh index c1ef474..c4163bc 100755 --- a/dracut.sh +++ b/dracut.sh @@ -834,6 +834,13 @@ trap 'exit 1;' SIGINT 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 @@ for ((i=0; i < ${#dracut_args[@]}; i++)); do dracut_args[$i]="\"${dracut_args[$i]}\"" #" keep vim happy done + dinfo "Executing: $0 ${dracut_args[@]}" [[ $do_list = yes ]] && { 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..6756c3f 100755 --- a/modules.d/45ifcfg/write-ifcfg.sh +++ b/modules.d/45ifcfg/write-ifcfg.sh @@ -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 @@ 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 @@ -120,9 +122,9 @@ for netup in /tmp/net.*.did-setup ; do 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 @@ 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 +151,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 +166,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/80cms/cmssetup.sh b/modules.d/80cms/cmssetup.sh index 36955bc..c9e1331 100755 --- a/modules.d/80cms/cmssetup.sh +++ b/modules.d/80cms/cmssetup.sh @@ -144,6 +144,7 @@ function dasd_settle_all() { processcmsfile() { source /tmp/cms.conf + SUBCHANNELS="$(echo $SUBCHANNELS | sed 'y/ABCDEF/abcdef/')" if [[ $NETTYPE ]]; then ( 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/90mdraid/module-setup.sh b/modules.d/90mdraid/module-setup.sh index ac745d1..81c94f2 100755 --- a/modules.d/90mdraid/module-setup.sh +++ b/modules.d/90mdraid/module-setup.sh @@ -54,6 +54,8 @@ cmdline() { done ) + [[ -z "$UUID" ]] && continue + if ! [[ ${_activated[${UUID}]} ]]; then printf "%s" " rd.md.uuid=${UUID}" _activated["${UUID}"]=1 diff --git a/modules.d/95fcoe-uefi/parse-uefifcoe.sh b/modules.d/95fcoe-uefi/parse-uefifcoe.sh index 0799cdd..7b8f1a6 100755 --- a/modules.d/95fcoe-uefi/parse-uefifcoe.sh +++ b/modules.d/95fcoe-uefi/parse-uefifcoe.sh @@ -26,7 +26,7 @@ print_fcoe_uefi_conf() esac fi # fcoe=eth0:nodcb - printf "%s\n" "$dev:nodcb" + printf "fcoe=%s\n" "$dev:nodcb" return 0 } 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/95nbd/nbdroot.sh b/modules.d/95nbd/nbdroot.sh index 32f346d..8bfbebc 100755 --- a/modules.d/95nbd/nbdroot.sh +++ b/modules.d/95nbd/nbdroot.sh @@ -111,6 +111,10 @@ if [ "$root" = "block:/dev/root" -o "$root" = "dhcp" ]; then 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 --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/95resume/module-setup.sh b/modules.d/95resume/module-setup.sh index ceb7855..b1b4684 100755 --- a/modules.d/95resume/module-setup.sh +++ b/modules.d/95resume/module-setup.sh @@ -17,12 +17,12 @@ check() { # called by dracut cmdline() { - local _activated - declare -A _activated + local _resume for dev in "${!host_fs_types[@]}"; do [[ ${host_fs_types[$dev]} =~ ^(swap|swsuspend|swsupend)$ ]] || continue - printf "resume=%s " "$(shorten_persistent_dev "$(get_persistent_dev "$dev")")" + _resume=$(shorten_persistent_dev "$(get_persistent_dev "$dev")") + [[ -n ${_resume} ]] && printf " resume=%s" "${_resume}" done } diff --git a/modules.d/95resume/parse-resume.sh b/modules.d/95resume/parse-resume.sh index d7b2d7f..6ab59c3 100755 --- a/modules.d/95resume/parse-resume.sh +++ b/modules.d/95resume/parse-resume.sh @@ -70,9 +70,10 @@ if ! getarg noresume; then 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 --git a/modules.d/95udev-rules/module-setup.sh b/modules.d/95udev-rules/module-setup.sh index 2d36712..fab4ffc 100755 --- a/modules.d/95udev-rules/module-setup.sh +++ b/modules.d/95udev-rules/module-setup.sh @@ -32,6 +32,7 @@ install() { 60-pcmcia.rules \ 50-udev.rules 95-late.rules \ 50-firmware.rules \ + 59-scsi-sg3_utils.rules \ 75-net-description.rules \ 80-net-name-slot.rules 80-net-setup-link.rules \ "$moddir/59-persistent-storage.rules" \ 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/dracut-pre-pivot.service b/modules.d/98systemd/dracut-pre-pivot.service index 6db1f2c..d7c7b1d 100644 --- a/modules.d/98systemd/dracut-pre-pivot.service +++ b/modules.d/98systemd/dracut-pre-pivot.service @@ -13,6 +13,8 @@ Documentation=man:dracut-pre-pivot.service(8) After=initrd.target initrd-parse-etc.service sysroot.mount After=dracut-initqueue.service dracut-pre-mount.service dracut-mount.service Before=initrd-cleanup.service +Wants=remote-fs.target +After=remote-fs.target ConditionPathExists=/etc/initrd-release ConditionDirectoryNotEmpty=|/lib/dracut/hooks/pre-pivot ConditionDirectoryNotEmpty=|/lib/dracut/hooks/cleanup diff --git a/modules.d/98systemd/module-setup.sh b/modules.d/98systemd/module-setup.sh index c72aad4..cf1b2e7 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 \ @@ -191,7 +192,7 @@ install() { inst_script "$moddir/dracut-mount.sh" /bin/dracut-mount inst_script "$moddir/dracut-pre-pivot.sh" /bin/dracut-pre-pivot - inst_script "$moddir/rootfs-generator.sh" /lib/systemd/system-generators/dracut-rootfs-generator + inst_script "$moddir/rootfs-generator.sh" $systemdutildir/system-generators/dracut-rootfs-generator inst_binary true ln_r $(type -P true) "/usr/bin/loginctl" diff --git a/modules.d/99base/dracut-lib.sh b/modules.d/99base/dracut-lib.sh index e4d7da8..33f7678 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 @@ -969,6 +983,7 @@ if ! command -v pidof >/dev/null 2>/dev/null; then local _cmd local _exe local _rl + local _ret=1 local i _cmd="$1" [ -z "$_cmd" ] && return 1 @@ -983,8 +998,9 @@ if ! command -v pidof >/dev/null 2>/dev/null; then fi i=${i%/exe} echo ${i##/proc/} + _ret=0 done - return 0 + return $_ret } 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
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor