From: Harald Hoyer Date: Wed, 12 May 2021 13:13:52 +0000 (+0200) Subject: fix(iscsi): replace sed call with bash internals X-Git-Tag: 054~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=66b920c65143f4cac80385a51704ae9483305569;p=thirdparty%2Fdracut.git fix(iscsi): replace sed call with bash internals This removes a fork/exec and additionally gives more information in debug logs. --- diff --git a/modules.d/95iscsi/iscsiroot.sh b/modules.d/95iscsi/iscsiroot.sh index 63acd8587..1a6446508 100755 --- a/modules.d/95iscsi/iscsiroot.sh +++ b/modules.d/95iscsi/iscsiroot.sh @@ -214,7 +214,11 @@ handle_netroot() { if strglobin "$iscsi_target_ip" '*:*:*' && ! strglobin "$iscsi_target_ip" '['; then iscsi_target_ip="[$iscsi_target_ip]" fi - targets=$(iscsiadm -m discovery -t st -p "$iscsi_target_ip":${iscsi_target_port:+$iscsi_target_port} | sed 's/^.*iqn/iqn/') + targets=$(iscsiadm -m discovery -t st -p "$iscsi_target_ip":${iscsi_target_port:+$iscsi_target_port} | { + while read -r _ target _ || [ -n "$target" ]; do + echo "$target" + done + }) [ -z "$targets" ] && echo "Target discovery to $iscsi_target_ip:${iscsi_target_port:+$iscsi_target_port} failed with status $?" && exit 1 found=