5 # Generates ID information for device-mapper tables.
7 # Copyright (C) 2006 SUSE Linux Products GmbH
9 # Hannes Reinecke <hare@suse.de>
12 # This program is free software; you can redistribute it and/or modify it
13 # under the terms of the GNU General Public License as published by the
14 # Free Software Foundation version 2 of the License.
16 # This script generates ID information used to generate persistent symlinks.
17 # It relies on the UUID strings generated by the various programs; the name
18 # of the tables are of no consequence.
20 # Please note that dmraid does not provide the UUIDs (yet); a patch has been
21 # sent upstream but has not been accepted yet.
30 if [ -z "$MAJOR" -o -z "$MINOR" ]; then
31 echo "usage: $0 major minor"
35 # Device-mapper not installed; not an error
36 if [ ! -x $DMSETUP ] ; then
41 # Table UUIDs are always '<type>-<uuid>'.
45 # kpartx types are 'part<num>'
46 if [ "$dmpart" = "$dmtbl" ] ; then
52 # Set the name of the table. We're only interested in dmraid,
53 # multipath, and kpartx tables; everything else is ignored.
54 if [ "$dmtbl" = "part" ] ; then
55 # The name of the kpartx table is the name of the parent table
56 dmname=$($DMSETUP info -c --noheadings -o name -u $dmuuid)
57 echo "DM_NAME=$dmname"
58 # We need the dependencies of the parent table to figure out
59 # the type if the parent is a multipath table
62 dmdeps=$($DMSETUP deps -u $dmuuid)
65 elif [ "$dmtbl" = "mpath" ] ; then
67 # We need the dependencies of the table to figure out the type
68 dmdeps=$($DMSETUP deps -u $UUID)
69 elif [ "$dmtbl" = "dmraid" ] ; then
73 [ -n "$dmpart" ] && echo "DM_PART=$dmpart"
75 # Figure out the type of the map. For non-multipath maps it's
77 if [ -n "$dmdeps" ] ; then