From 4590f6e33ba37652ce8422d578fc05ac048d3bfd Mon Sep 17 00:00:00 2001 From: Baoquan He Date: Thu, 13 Dec 2012 14:17:26 +0800 Subject: [PATCH] Optimize redundent code fetching server of network dump Code in function kdump_install_net used to get server of network dump is is a little redundent, can be optimized into one line. For nfs/ssh, this line of code is enough. Test passed on local kvm guest with Fedora 18. Signed-off-by: Baoquan He Acked-by: Dave Young --- dracut-module-setup.sh | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dracut-module-setup.sh b/dracut-module-setup.sh index 9741c84..f354c80 100755 --- a/dracut-module-setup.sh +++ b/dracut-module-setup.sh @@ -165,11 +165,7 @@ kdump_install_net() { local _server _netdev local config_val="$1" - if strstr "$config_val" "@"; then - _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1` - else - _server=$(echo $config_val | sed -e 's#\(.*\):.*#\1#') - fi + _server=`echo $config_val | sed 's/.*@//' | cut -d':' -f1` _need_dns=`echo $_server|grep "[a-zA-Z]"` [ -n "$_need_dns" ] && _server=`getent hosts $_server|cut -d' ' -f1`