Handle missing auth file.

Skip empty lines.
This commit is contained in:
mlelstv 2023-02-18 07:51:52 +00:00
parent 00473bc1c0
commit 469d9aaeac
1 changed files with 12 additions and 10 deletions

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $NetBSD: iscsid_volumes,v 1.2 2023/02/06 11:53:03 martin Exp $
# $NetBSD: iscsid_volumes,v 1.3 2023/02/18 07:51:52 mlelstv Exp $
#
# PROVIDE: iscsid_volumes
@ -20,7 +20,7 @@ iscsid_volumes_start()
while read host target digest auth user alias; do
case $host in
\#*) ;;
\#*|"") ;;
*)
topts=''
case $digest in
@ -33,13 +33,15 @@ iscsid_volumes_start()
pass="-"
mpass="-"
while read entry dummy; do
case $entry in
\#*) ;;
"$user":*) pass=${entry#*:} ;;
"$target":*) mpass=${entry#*:} ;;
esac
done < /etc/iscsi/auths
if [ -f /etc/iscsi/auths ]; then
while read entry dummy; do
case $entry in
\#*|"") ;;
"$user":*) pass=${entry#*:} ;;
"$target":*) mpass=${entry#*:} ;;
esac
done < /etc/iscsi/auths
fi
case $host in
*:*)
@ -82,7 +84,7 @@ iscsid_volumes_stop()
while read host target digest auth user alias; do
case $host in
\#*) ;;
\#*|"") ;;
*)
echo "Remove target ${alias:-$target}"