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:
parent
dd99e09e5a
commit
6d06013173
@ -69,39 +69,41 @@ 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
|
|
||||||
|
|
||||||
IN_FSTAB=""
|
|
||||||
|
|
||||||
PART_LABEL_RAW="`${UDEVINFO} -q env -n ${PARTITION} 2>/dev/null | grep '^ID_FS_LABEL='`"
|
|
||||||
if [ "${PART_LABEL_RAW}x" != "x" ] ; then
|
|
||||||
PART_LABEL="`echo ${PART_LABEL_RAW} | awk -F '=' '{ print $2; }'`"
|
|
||||||
IN_FSTAB="`grep ${PART_LABEL} /etc/fstab`"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "x${IN_FSTAB}" != "x" ] ; then
|
|
||||||
mount -s /dev/disk/by-label/${PART_LABEL}
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
done
|
done
|
||||||
ret=$?
|
fi
|
||||||
|
|
||||||
else
|
for PARTITION in ${PARTITIONS[@]} ; do
|
||||||
echo "No automatic nodes or attached disks found!"
|
IN_FSTAB=""
|
||||||
|
|
||||||
|
PART_LABEL_RAW="`${UDEVINFO} -q env -n ${PARTITION} 2>/dev/null | grep '^ID_FS_LABEL='`"
|
||||||
|
if [ "${PART_LABEL_RAW}x" != "x" ] ; then
|
||||||
|
PART_LABEL="`echo ${PART_LABEL_RAW} | awk -F '=' '{ print $2; }'`"
|
||||||
|
IN_FSTAB="`grep ${PART_LABEL} /etc/fstab`"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "x${IN_FSTAB}" != "x" ] ; then
|
||||||
|
ebegin "Mounting disk ${PART_LABEL}"
|
||||||
|
mount -s /dev/disk/by-label/${PART_LABEL}
|
||||||
|
eend $?
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ "${#PATITIONS[*]}" == "0" ] ; then
|
||||||
|
einfo "No automatic nodes or attached disks found!"
|
||||||
ret=0
|
ret=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eend $ret
|
return $?
|
||||||
return $ret
|
|
||||||
}
|
}
|
||||||
|
|
||||||
stop() {
|
stop() {
|
||||||
|
Loading…
Reference in New Issue
Block a user