iscsi-initiator revision d30a1dc56ac8d5e7462b900c98440ba40daa3a46
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
#
#
#
# checkmessage "fsck_device | mount_point"
#
# Simple auxilary routine to the shell function checkfs. Prints out
# instructions for a manual file system check before entering the shell.
#
if [ "$1" != "" ] ; then
echo "WARNING - Unable to repair one or more \c" \
else
echo "WARNING - Unable to repair one or more filesystems." \
fi
}
#
# checkfs raw_device fstype mountpoint
#
# Check the file system specified. The return codes from fsck have the
# following meanings.
# 0 - file system is unmounted and okay
# 32 - file system is unmounted and needs checking (fsck -m only)
# 33 - file system is already mounted
# 34 - cannot stat device
# 36 - uncorrectable errors detected - terminate normally (4.1 code 8)
# 37 - a signal was caught during processing (4.1 exit 12)
# 39 - uncorrectable errors detected - terminate rightaway (4.1 code 8)
# 40 - for root, same as 0 (used by rcS to remount root)
#
if [ $? -ne 0 ]
then
# Determine fsck options by file system type
;;
*) foptions="-y"
;;
esac
echo "The "$3" file system ("$1") is being checked."
case $? in
0|40) # file system OK
;;
*) # couldn't fix the file system
checkmessage "$1"
;;
esac
fi
}
err=0
iscsilist=""
'#'* | '' ) # Ignore comments, empty lines.
continue
;;
'-') # Ignore "no-action" lines.
continue
;;
esac
continue
fi
echo "iscsi-initiator: FSType of iscsi LUN \c" 1>&2
continue
fi
#
# Ignore entries already mounted
#
2>&1 && continue
#
# Can't fsck if no fsckdev is specified
#
continue
fi
#
# fsck everything else:
#
# fsck -m simply returns true if the filesystem is
# suitable for mounting.
#
case $? in
0|40) iscsilist="$iscsilist $mountp"
continue
;;
continue
;;
33) # already mounted
echo "$special already mounted"
;;
34) # bogus special device
echo "Cannot stat $fsckdev - ignoring"
err=1
;;
*) # uncorrectable errors
echo "$fsckdev uncorrectable error"
err=1
;;
esac
done
for iscsilun in $iscsilist
do
if [ $? -ne 0 ]; then
echo "Fail to mount $iscsilun"
err=1
fi
done
return $err
}
#
'#'* | '') continue;; # Ignore comments,
# empty lines.
'-') continue;; # Ignore "no-action lines.
esac
continue
fi
if [ $? -ne 0 ]; then
continue
fi
done
umount -a $iscsilist 1>&2
rc=$?
else
rc=0;
fi
return $rc
}
case "$1" in
'start')
if [ $? -ne 0 ]; then
fi
if [ $? -eq 0 ]; then
delay=60
if [ $? -eq 1 ]; then
sleep 1
continue
else
echo "iscsi-initiator: mount iscsi \c"
exit $SMF_EXIT_ERR_CONFIG
fi
else
exit $SMF_EXIT_OK
fi
done
else
exit $?
fi
;;
'stop')
exit 0
;;
*)
echo "Usage: $0 { start | stop }"
exit 1
;;
esac
exit $SMF_EXIT_OK