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,34 +69,47 @@ 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}"
done
for DISK in "${DISKS}" ; do
PARTITIONS="`find /dev -name \"${DISK}[0-9]*\" | grep -v '\.udev/'` ${PARTITIONS}"
done
for PARTITION in "${PARTITIONS}" ; do
PART_LABEL="`${UDEVINFO} -q env -n ${PARTITION} | grep '^ID_FS_LABEL=' | awk -F '=' '{ print $2; }'`"
IN_FSTAB="`grep ${PART_LABEL} /etc/fstab`"
for PARTITION in "${PARTITIONS}" ; do
PART_LABEL="`${UDEVINFO} -q env -n ${PARTITION} | grep '^ID_FS_LABEL=' | awk -F '=' '{ print $2; }'`"
IN_FSTAB="`grep ${PART_LABEL} /etc/fstab`"
if [ "x${IN_FSTAB}" != "x" ] ; then
mount -s /dev/disk/by-label/${PART_LABEL}
fi
done
ret=$?
else
echo "No automatic nodes or attached disks found!"
ret=0
fi
if [ "x${IN_FSTAB}" != "x" ] ; then
mount -s /dev/disk/by-label/${PART_LABEL}
fi
done
ret=$?
eend $ret
return $ret
}
stop() {
ebegin "Unmounting all disks with entries in /etc/mtab"
ISCSI_MOUNTS="`grep _netdev /etc/mtab | awk '{ print $1; }'`"
for ISCSI_MOUNT in "${ISCSI_MOUNTS}" ; do
umount ${ISCSI_MOUNT}
done
ret=$?
eend $ret
NETDEV_GREP="`grep _netdev /etc/mtab`"
if [ "x${?}" == "x0" ] ; then
ebegin "Unmounting all disks with entries in /etc/mtab"
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