1#!/bin/sh
2
3# $Id: lvm2udev,v 1.1.1.1 2008/12/22 00:18:58 haad Exp $
4
5# simple startup script to create lvm2 devices if /dev is a mountpoint, there
6# are active dm- devices, and an executable /sbin/vgscan.
7
8# this script is licensed under GPLv2.
9# See http://www.gnu.org/licenses/gpl.html
10
11case $1 in
12start)
13    # is /dev a mountpoint?
14    mountpoint -q /dev
15    DEVMNTPOINT=$?
16
17    # check to see if there are active dm entries under /sys
18    ls /sys/block/dm-*/dev 1>/dev/null 2>&1
19    ACTIVEDMDEVS=$?
20
21    # mknodes if conditions are right
22    if [ $DEVMNTPOINT -eq 0 -a $ACTIVEDMDEVS -eq 0 -a -x /sbin/vgscan ]; then
23        /sbin/vgscan --mknodes --ignorelockingfailure
24    fi
25    ;;
26stop)
27    exit 0
28    ;;
29*)
30    echo "usage:"
31    echo "    $0 start|stop"
32    ;;
33esac
34