summaryrefslogtreecommitdiffstats
path: root/scripts/lvm2create_initrd/lvm2udev
blob: 2e733cfca0b8ee7cbac4b42abe4f1a24b847dca2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh

# $Id$

# simple startup script to create lvm2 devices if /dev is a mountpoint, there
# are active dm- devices, and an executable /sbin/vgscan.

# this script is licensed under GPLv2.
# See http://www.gnu.org/licenses/gpl.html

case $1 in
start)
    # is /dev a mountpoint?
    mountpoint -q /dev
    DEVMNTPOINT=$?

    # check to see if there are active dm entries under /sys
    ls /sys/block/dm-*/dev 1>/dev/null 2>&1
    ACTIVEDMDEVS=$?

    # mknodes if conditions are right
    if [ $DEVMNTPOINT -eq 0 -a $ACTIVEDMDEVS -eq 0 -a -x /sbin/vgscan ]; then
        /sbin/vgscan --mknodes --ignorelockingfailure
    fi
    ;;
stop)
    exit 0
    ;;
*)
    echo "usage:"
    echo "    $0 start|stop"
    ;;
esac