New init script for open-iscsi

git-svn-id: svn+ssh://svnintern.kmrc.de/projects/gentoo/iwm-overlay@6588 cbe59ace-07ea-0310-918e-868702b5370d
This commit is contained in:
Torsten Kurbad 2008-05-28 09:24:38 +00:00
parent dd99e09e5a
commit 6d06013173

View File

@ -69,17 +69,20 @@ start() {
sleep 5
ebegin "Mounting all disks with entries in /etc/fstab"
PARTITIONS=""
ISCSI_SESSION="`iscsiadm -m session -i 2>/dev/null | grep '^Attached scsi disk ' | grep 'State: running$'`"
einfo "Mounting all disks with entries in /etc/fstab"
NUM_PARTS=0
ISCSI_SESSION="`iscsiadm -m session -P 3 2>/dev/null | grep 'Attached scsi disk ' | grep 'State: running$'`"
if [ "x${?}" == "x0" ] ; then
DISKS="`echo ${ISCSI_SESSION} | awk '{ print }' | sed -e 's@Attached scsi disk @@g' -e 's@State: running@@g'`"
for DISK in ${DISKS} ; do
PARTITIONS="`find /dev -name \"${DISK}[0-9]*\" | grep -v '\.udev/'` ${PARTITIONS}"
for PARTITION in ${PARTITIONS} ; do
(( NUM_PARTS += 1 ))
PARTITIONS[NUM_PARTS]="`find /dev -name \"${DISK}[0-9]*\" | grep -v '\.udev/'` ${PARTITIONS}"
done
fi
for PARTITION in ${PARTITIONS[@]} ; do
IN_FSTAB=""
PART_LABEL_RAW="`${UDEVINFO} -q env -n ${PARTITION} 2>/dev/null | grep '^ID_FS_LABEL='`"
@ -89,19 +92,18 @@ start() {
fi
if [ "x${IN_FSTAB}" != "x" ] ; then
ebegin "Mounting disk ${PART_LABEL}"
mount -s /dev/disk/by-label/${PART_LABEL}
eend $?
fi
done
done
ret=$?
else
echo "No automatic nodes or attached disks found!"
if [ "${#PATITIONS[*]}" == "0" ] ; then
einfo "No automatic nodes or attached disks found!"
ret=0
fi
eend $ret
return $ret
return $?
}
stop() {