source: udev/mount.sh @ 7e161ea

clfs-1.2clfs-2.1clfs-3.0.0-systemdclfs-3.0.0-sysvinitsystemdsysvinit
Last change on this file since 7e161ea was 7e161ea, checked in by Jim Gifford <clfs@…>, 18 years ago

r833@server (orig r831): jim | 2005-12-05 10:42:24 -0800
Added: udev package for Cross-LFS. Work in Progress

  • Property mode set to 100755
File size: 1.3 KB
Line 
1#! /bin/bash
2
3. /etc/sysconfig/hardware/scripts/functions
4. /etc/sysconfig/storage
5
6test "$HOTPLUG_MOUNT_FSTAB" != yes && exit
7
8# Handle only partitions of sd
9case "$DEVNAME" in
10        /dev/sd*|/dev/hd*) : ;;
11        *) exit 0 ;;
12esac
13case "$DEVNAME" in
14        *sd[a-z]|*hd[a-z]) exit 0 ;;
15esac
16
17
18NODES=$DEVNAME
19for sl in `udevinfo -q symlink -p $DEVPATH`; do
20        NODES="$NODES /dev/$sl"
21done
22info_mesg "Avilable nodes: $NODES"
23
24NODE=
25declare -i FSCK=0
26while read dn mp fs opts dump fsck x; do
27        for n in $NODES; do
28                if [ "$n" == "$dn" ] ; then
29                        case $opts in
30                                *hotplug*) : ;;
31                                *) exit 0 ;;
32                        esac
33                        NODE="$n"
34                        FSCK="$fsck"
35                        info_mesg "matching line for $DEVNAME:"
36                        info_mesg "$dn $mp $fs $opts $dump $fsck $x"
37                        break 2
38                fi
39        done
40done < /etc/fstab
41
42if [ "$HOTPLUG_CHECK_FILESYSTEMS" == yes -a "$FSCK" -gt 0 ] ; then
43        MESSAGE="`fsck -a $DEVNAME`"
44        RET=$?
45        info_mesg "$MESSAGE"
46        case $RET in
47                0|1) : ;;
48                2|3) 
49                        info_mesg "Please unplug device $DEVNAME, and plug it again" 
50                        logger -t $0 "fsck for '$DEVNAME' failed. Will not mount it."
51                        exit 0
52                        ;;
53                *) 
54                        err_mesg "fsck failed on $DEVNAME. Please fsck filesystem manually." 
55                        logger -t $0 "fsck for '$DEVNAME' failed. Will not mount it."
56                        exit 1
57                        ;;
58        esac
59fi
60
61
62if [ -n "$NODE" ] ; then
63        MESSAGE="`mount -av "$NODE"`"
64        test $? != 0 && logger -t $0 "Could not mount '$DEVNAME'."
65        info_mesg "$MESSAGE"
66fi
Note: See TracBrowser for help on using the repository browser.