dmsetup_env 833 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/sh
  2. #
  3. # Debian's dmsetup is lacking the export patch, so gather the minimum
  4. # information here in order to get proper partition mappings via kpartx
  5. #
  6. # See: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=434241
  7. # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=487881
  8. # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=493078
  9. MAJOR=$1
  10. MINOR=$2
  11. if [ -z "$MAJOR" -o -z "$MINOR" ]; then
  12. echo "usage: $0 major minor"
  13. exit 1
  14. fi
  15. DMSETUP="/sbin/dmsetup -c --noheadings info -j$MAJOR -m$MINOR"
  16. DM_UUID=`$DMSETUP -oUUID`
  17. if [ -n "$DM_UUID" ]; then
  18. echo DM_UUID=$DM_UUID
  19. ATTRS=`$DMSETUP -oattr`
  20. case "$ATTRS" in
  21. L-*) # this is the only state needed for the kpartx udev rules
  22. echo DM_TABLE_STATE=LIVE
  23. echo DM_STATE=ACTIVE
  24. ;;
  25. esac
  26. fi
  27. echo DM_NAME=`$DMSETUP -oname`