home *** CD-ROM | disk | FTP | other *** search
- #! /bin/bash
- #
- # Copyright (c) 2002-2006 SuSE Linux AG Nuernberg, Germany.
- # All rights reserved.
- #
- # This program is free software; you can redistribute it and/or modify it under
- # the terms of the GNU General Public License as published by the Free Software
- # Foundation; either version 2 of the License, or (at your option) any later
- # version.
- #
- # This program is distributed in the hope that it will be useful, but WITHOUT
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
- # details.
- #
- # You should have received a copy of the GNU General Public License along with
- # this program; if not, write to the Free Software Foundation, Inc., 59 Temple
- # Place, Suite 330, Boston, MA 02111-1307 USA
- #
- # Author: Christian Zoz <zoz@suse.de>
- # Stefan Scheler <sscheler@suse.de>
- #
- # $Id: $
- #
-
- NODES="$DEVNAME $DEVLINKS"
-
- # scan /etc/fstab
- HOTPLUG="no"
- while read dn mp fs opts dump fsck x; do
- case $opts in
- *hotplug*)
- for n in $NODES; do
- if [ "$n" == "$dn" ] ; then
- HOTPLUG="yes"
- fi
- done
- ;;
- esac
- done < /etc/fstab
-
- # make sure to touch only hotplug devices
- if [ "$HOTPLUG" == "no" ]; then
- exit 0
- fi
-
- . /etc/sysconfig/hardware/scripts/functions
-
- # fsck options:
- # -M : respect fs_pass_no, emulate mount
- # -a : auto repair
- MESSAGE="`fsck -M -a $DEVNAME 2>&1`"
- RET=$?
- case $RET in
- 0|1) : ;;
- 2|3)
- err_mesg $MESSAGE
- err_mesg "Please unplug device '$DEVNAME' and plug it again."
- exit $RET
- ;;
- *)
- err_mesg $MESSAGE
- err_mesg "fsck failed on '$DEVNAME'. Please fsck filesystem manually."
- exit $RET
- ;;
- esac
-
- # mount options:
- # -v : be verbose
- # -a : respect noauto option
- MESSAGE="`mount -av $DEVNAME 2>&1`"
- RET=$?
- test $? != 0 && err_mesg "Could not mount '$DEVNAME'."
- exit $RET
-