Changed init-script again to deal with empty discovery

git-svn-id: svn+ssh://svnintern.kmrc.de/projects/gentoo/iwm-overlay@4230 cbe59ace-07ea-0310-918e-868702b5370d
This commit is contained in:
Torsten Kurbad 2007-05-02 11:31:32 +00:00
parent da52fd0828
commit 3a292f19ec

View File

@ -69,7 +69,9 @@ start() {
ebegin "Mounting all disks with entries in /etc/fstab"
PARTITIONS=""
DISKS="`iscsiadm -m session -i | grep '^Attached scsi disk ' | awk '{ print $4; }'`"
ISCSI_SESSION="`iscsiadm -m session -i 2>/dev/null | grep '^Attached scsi disk '`"
if [ "x${?}" == "x0" ] ; then
DISKS="`echo ${ISCSI_SESSION} | awk '{ print $4; }'`"
for DISK in "${DISKS}" ; do
PARTITIONS="`find /dev -name \"${DISK}[0-9]*\" | grep -v '\.udev/'` ${PARTITIONS}"
@ -84,19 +86,30 @@ start() {
fi
done
ret=$?
eend $ret
else
echo "No automatic nodes or attached disks found!"
ret=0
fi
eend $ret
return $ret
}
stop() {
NETDEV_GREP="`grep _netdev /etc/mtab`"
if [ "x${?}" == "x0" ] ; then
ebegin "Unmounting all disks with entries in /etc/mtab"
ISCSI_MOUNTS="`grep _netdev /etc/mtab | awk '{ print $1; }'`"
ISCSI_MOUNTS="`echo ${NETDEV_GREP} | awk '{ print $1; }'`"
for ISCSI_MOUNT in "${ISCSI_MOUNTS}" ; do
umount ${ISCSI_MOUNT}
done
ret=$?
eend $ret
fi
ebegin "Logging out of all nodes"
${ADM} -m node -U all