From: Pingfan Liu Date: Mon, 4 Dec 2017 09:24:11 +0000 (+0800) Subject: dracut.sh: for_each_host_xx() function should indicate the empty case X-Git-Tag: 047~74^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F311%2Fhead;p=thirdparty%2Fdracut.git dracut.sh: for_each_host_xx() function should indicate the empty case The caller of "for_each_host_xx func" needs to tell three cases: func success/ fail / not be called. E.g, in kdump case, host_devs can be empty, and we want to know it. Signed-off-by: Pingfan Liu --- diff --git a/dracut-functions.sh b/dracut-functions.sh index 112b2434c..575bd4a69 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -468,7 +468,8 @@ for_each_host_dev_fs() local _dev local _ret=1 - [[ "${#host_fs_types[@]}" ]] || return 0 + [[ "${#host_fs_types[@]}" ]] || return 2 + for _dev in "${!host_fs_types[@]}"; do $_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0 @@ -527,7 +528,7 @@ for_each_host_dev_and_slaves_all() local _dev local _ret=1 - [[ "${host_devs[@]}" ]] || return 0 + [[ "${host_devs[@]}" ]] || return 2 for _dev in "${host_devs[@]}"; do [[ -b "$_dev" ]] || continue @@ -543,7 +544,7 @@ for_each_host_dev_and_slaves() local _func="$1" local _dev - [[ "${host_devs[@]}" ]] || return 0 + [[ "${host_devs[@]}" ]] || return 2 for _dev in "${host_devs[@]}"; do [[ -b "$_dev" ]] || continue