dracut/0140-dracut.sh-Avoid-duplicate-devices-in-host_devs.patch
Thomas Renninger 9fd4bf22aa Accepting request 245581 from home:trenn:branches:Base:System
- dracut.sh: check for logfile (--logfile option) and create it if necessary
  Add 0139-dracut.sh-check-for-logfile-logfile-option-and-creat.patch
- Avoid duplicate names in host_devs
  Add 0140-dracut.sh-Avoid-duplicate-devices-in-host_devs.patch
- iscsi: Avoid bad ip route call on empty address
  Add 0141-iscsi-Avoid-bad-ip-route-call-on-empty-address.patch
- 40network: Don't report error for .../ifroute-* during module setup
  Add 0142-40network-Don-t-report-error-for-etc-sysconfig-netwo.patch
- iscsi: Fix up ipv6 in brackets , iterate over all needed iscsi mounts
  Add 0143-iscsi-Fix-up-ipv6-in-brackets-iterate-over-all-possi.patch
- 90crypt: Fixed crypttab_contains() to also work with device in /etc/crypttab
  Add 0144-90crypt-Fixed-crypttab_contains-to-also-work-with-de.patch
- 40network: handle 'ip=ifname:static' correctly (bnc#892801)
  Add 0145-40network-handle-ip-ifname-static-correctly.patch

OBS-URL: https://build.opensuse.org/request/show/245581
OBS-URL: https://build.opensuse.org/package/show/Base:System/dracut?expand=0&rev=180
2014-08-21 12:50:20 +00:00

95 lines
2.5 KiB
Diff

From 0151fb96092de63406f78ccfe0c2aa2c5bd04123 Mon Sep 17 00:00:00 2001
From: Thomas Renninger <trenn@suse.de>
Date: Mon, 18 Aug 2014 18:30:13 +0200
Subject: dracut.sh: Avoid duplicate devices in host_devs
Signed-off-by: Thomas Renninger <trenn@suse.de>
---
dracut.sh | 26 ++++++++++++++++++--------
1 file changed, 18 insertions(+), 8 deletions(-)
diff --git a/dracut.sh b/dracut.sh
index ffe4989..5d3536f 100755
--- a/dracut.sh
+++ b/dracut.sh
@@ -221,6 +221,16 @@ push() {
done
}
+# Fills up host_devs stack variable and makes sure there are no duplicates
+push_host_devs() {
+ local _dev
+ for _dev in ${host_devs[@]}; do
+ [ "$_dev" = "$1" ] && return
+ done
+ push host_devs "$1"
+}
+
+
# function pop()
# pops the last value from a stack
# assigns value to second argument variable
@@ -1007,25 +1017,25 @@ declare -A host_fs_types
for line in "${fstab_lines[@]}"; do
set -- $line
#dev mp fs fsopts
- push host_devs "$1"
+ push_host_devs "$1"
host_fs_types["$1"]="$3"
done
for f in $add_fstab; do
[[ -e $f ]] || continue
while read dev rest; do
- push host_devs "$dev"
+ push_host_devs "$dev"
done < "$f"
done
for dev in $add_device; do
- push host_devs "$dev"
+ push_host_devs "$dev"
done
if (( ${#add_device_l[@]} )); then
while pop add_device_l val; do
add_device+=" $val "
- push host_devs "$val"
+ push_host_devs "$val"
done
fi
@@ -1054,9 +1064,9 @@ if [[ $hostonly ]]; then
_dev=$(find_block_device "$mp")
_bdev=$(readlink -f "/dev/block/$_dev")
[[ -b $_bdev ]] && _dev=$_bdev
- push host_devs $_dev
+ push_host_devs $_dev
[[ "$mp" == "/" ]] && root_dev="$_dev"
- push host_devs "$_dev"
+ push_host_devs "$_dev"
done
if [[ $nowaitforswap != yes ]] && [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
@@ -1085,7 +1095,7 @@ if [[ $hostonly ]]; then
done < /etc/crypttab
fi
- push host_devs "$(readlink -f "$dev")"
+ push_host_devs "$(readlink -f "$dev")"
break
done < /etc/fstab
done < /proc/swaps
@@ -1150,7 +1160,7 @@ for dev in "${!host_fs_types[@]}"; do
fi
if [[ $journaldev ]]; then
dev="$(readlink -f "$dev")"
- push host_devs "$dev"
+ push_host_devs "$dev"
_get_fs_type "$dev"
check_block_and_slaves_all _get_fs_type "$(get_maj_min "$dev")"
fi
--
1.8.4.5