|
|
18971c |
From 43d6b9d0085c393c7cdb0fd1f1181654d0f87e61 Mon Sep 17 00:00:00 2001
|
|
|
18971c |
From: Pingfan Liu <piliu@redhat.com>
|
|
|
18971c |
Date: Mon, 4 Dec 2017 17:24:11 +0800
|
|
|
18971c |
Subject: [PATCH] dracut.sh: for_each_host_xx() function should indicate the
|
|
|
18971c |
empty case
|
|
|
18971c |
|
|
|
18971c |
The caller of "for_each_host_xx func" needs to tell three cases:
|
|
|
18971c |
func success/ fail / not be called.
|
|
|
18971c |
E.g, in kdump case, host_devs can be empty, and we want to know it.
|
|
|
18971c |
|
|
|
18971c |
Signed-off-by: Pingfan Liu <piliu@redhat.com>
|
|
|
18971c |
|
|
|
18971c |
Cherry-picked from: e6199960d9bbfe6d860a32716b7e9bac7e657a4f
|
|
|
18971c |
Resolves: #1520721
|
|
|
18971c |
---
|
|
|
18971c |
dracut-functions.sh | 7 ++++---
|
|
|
18971c |
1 file changed, 4 insertions(+), 3 deletions(-)
|
|
|
18971c |
|
|
|
18971c |
diff --git a/dracut-functions.sh b/dracut-functions.sh
|
|
|
18971c |
index 23768bdc..4051596b 100755
|
|
|
18971c |
--- a/dracut-functions.sh
|
|
|
18971c |
+++ b/dracut-functions.sh
|
|
|
18971c |
@@ -593,7 +593,8 @@ for_each_host_dev_fs()
|
|
|
18971c |
local _dev
|
|
|
18971c |
local _ret=1
|
|
|
18971c |
|
|
|
18971c |
- [[ "${#host_fs_types[@]}" ]] || return 0
|
|
|
18971c |
+ [[ "${#host_fs_types[@]}" ]] || return 2
|
|
|
18971c |
+
|
|
|
18971c |
|
|
|
18971c |
for _dev in "${!host_fs_types[@]}"; do
|
|
|
18971c |
$_func "$_dev" "${host_fs_types[$_dev]}" && _ret=0
|
|
|
18971c |
@@ -652,7 +653,7 @@ for_each_host_dev_and_slaves_all()
|
|
|
18971c |
local _dev
|
|
|
18971c |
local _ret=1
|
|
|
18971c |
|
|
|
18971c |
- [[ "${host_devs[@]}" ]] || return 0
|
|
|
18971c |
+ [[ "${host_devs[@]}" ]] || return 2
|
|
|
18971c |
|
|
|
18971c |
for _dev in "${host_devs[@]}"; do
|
|
|
18971c |
[[ -b "$_dev" ]] || continue
|
|
|
18971c |
@@ -668,7 +669,7 @@ for_each_host_dev_and_slaves()
|
|
|
18971c |
local _func="$1"
|
|
|
18971c |
local _dev
|
|
|
18971c |
|
|
|
18971c |
- [[ "${host_devs[@]}" ]] || return 0
|
|
|
18971c |
+ [[ "${host_devs[@]}" ]] || return 2
|
|
|
18971c |
|
|
|
18971c |
for _dev in "${host_devs[@]}"; do
|
|
|
18971c |
[[ -b "$_dev" ]] || continue
|