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