Module Name: src Committed By: kre Date: Mon Dec 25 08:29:05 UTC 2023
Modified Files: src/etc/rc.d: iscsid_volumes Log Message: Clean up obsolere test(1) -a option/operator - use sh && instead. Take the opportunity to do a little sh formatting cleanups, the \ line continuation can ususually be avoided by placing sh operators at the appropriate places. Note the [ x"$var" = x"$other" ] usage no longer needs the 'x', avoiding that kind of nonsense is partly why test was much more precisely specified, and a lot of the unnecessary stuff made obsolete. Those however I did not remove (they're harmless). To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/etc/rc.d/iscsid_volumes Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/etc/rc.d/iscsid_volumes diff -u src/etc/rc.d/iscsid_volumes:1.4 src/etc/rc.d/iscsid_volumes:1.5 --- src/etc/rc.d/iscsid_volumes:1.4 Sat Jul 22 10:31:35 2023 +++ src/etc/rc.d/iscsid_volumes Mon Dec 25 08:29:05 2023 @@ -1,6 +1,6 @@ #!/bin/sh # -# $NetBSD: iscsid_volumes,v 1.4 2023/07/22 10:31:35 mlelstv Exp $ +# $NetBSD: iscsid_volumes,v 1.5 2023/12/25 08:29:05 kre Exp $ # # PROVIDE: iscsid_volumes @@ -98,17 +98,19 @@ iscsid_volumes_stop() *) echo "Remove target ${alias:-$target}" - /sbin/iscsictl list_sessions \ - | while read key1 num key2 sesstarget; do - if [ x"$key1" = x"Session" -a \ - x"$key2" = x"Target" -a \ - x"$sesstarget" = x"$target" ]; then - /sbin/iscsictl logout -I "$num" | grep -v '^OK$' + /sbin/iscsictl list_sessions | + while read key1 num key2 sesstarget; do + if [ x"$key1" = x"Session" ] && + [ x"$key2" = x"Target" ] && + [ x"$sesstarget" = x"$target" ] + then + /sbin/iscsictl logout -I "$num" | + grep -v '^OK$' fi done - /sbin/iscsictl list_targets \ - | while read num talias ttarget; do + /sbin/iscsictl list_targets | + while read num talias ttarget; do if [ x"$ttarget" = x"$target" ]; then /sbin/iscsictl remove_target -I "$num" fi