On 02/15/15 at 03:45pm, Minfei Huang wrote:
In general, the dracut will setup the ipv4 or ipv6 mode exclusively,
If
we specify the config to use the ssh or nfs to dump the core.
Modify the function to get the first filered ip address as the dumping
directory, and does not concern the ip address is ipv4 or ipv6.
Signed-off-by: Minfei Huang <mhuang(a)redhat.com>
ACK
---
dracut-kdump.sh | 4 ++--
dracut-module-setup.sh | 1 +
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dracut-kdump.sh b/dracut-kdump.sh
index fa8908f..db3af7a 100755
--- a/dracut-kdump.sh
+++ b/dracut-kdump.sh
@@ -114,9 +114,9 @@ get_host_ip()
then
kdumpnic=$(getarg kdumpnic=)
[ -z "$kdumpnic" ] && echo "kdump: failed to get
kdumpnic!" && return 1
- _host=`ip addr show dev $kdumpnic|grep 'inet '`
+ _host=`ip addr show dev $kdumpnic|grep 'inet'`
[ $? -ne 0 ] && echo "kdump: wrong kdumpnic: $kdumpnic"
&& return 1
- _host="${_host##*inet }"
+ _host=`echo $_host | head -n 1 | cut -d' ' -f2`
_host="${_host%%/*}"
[ -z "$_host" ] && echo "kdump: wrong kdumpnic:
$kdumpnic" && return 1
HOST_IP=$_host
diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh
index 0b5b66e..107a2d6 100755
--- a/dracut-module-setup.sh
+++ b/dracut-module-setup.sh
@@ -622,6 +622,7 @@ install() {
inst "/bin/tail" "/bin/tail"
inst "/bin/date" "/bin/date"
inst "/bin/getent" "/bin/getent"
+ inst "/bin/head" "/bin/head"
inst "/bin/sync" "/bin/sync"
inst "/bin/cut" "/bin/cut"
inst "/sbin/makedumpfile" "/sbin/makedumpfile"
--
2.2.2