udev-install.sh 852 B

123456789101112131415161718192021222324252627282930313233
  1. # install the aoe-specific udev rules from udev.txt into
  2. # the system's udev configuration
  3. #
  4. me="`basename $0`"
  5. # find udev.conf, often /etc/udev/udev.conf
  6. # (or environment can specify where to find udev.conf)
  7. #
  8. if test -z "$conf"; then
  9. if test -r /etc/udev/udev.conf; then
  10. conf=/etc/udev/udev.conf
  11. else
  12. conf="`find /etc -type f -name udev.conf 2> /dev/null`"
  13. if test -z "$conf" || test ! -r "$conf"; then
  14. echo "$me Error: no udev.conf found" 1>&2
  15. exit 1
  16. fi
  17. fi
  18. fi
  19. # find the directory where udev rules are stored, often
  20. # /etc/udev/rules.d
  21. #
  22. rules_d="`sed -n '/^udev_rules=/{ s!udev_rules=!!; s!\"!!g; p; }' $conf`"
  23. if test -z "$rules_d" ; then
  24. rules_d=/etc/udev/rules.d
  25. fi
  26. if test ! -d "$rules_d"; then
  27. echo "$me Error: cannot find udev rules directory" 1>&2
  28. exit 1
  29. fi
  30. sh -xc "cp `dirname $0`/udev.txt $rules_d/60-aoe.rules"