genudevrules 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. ver=`udevinfo -V | cut -f3 -d" "`
  3. if [ -z "${ver}" ]; then
  4. # Not found - try udevadm
  5. ver=`udevadm info -V | cut -f3 -d" "`
  6. if [ -z "${ver}" ]; then
  7. # nobody has that old version, anyway.
  8. ver=54
  9. fi
  10. fi
  11. # udev versions prior to 055 use a single '=' for matching key values
  12. # udev versions 055 and later support '==' for that purpose, and versions
  13. # beyond 092 will probably make it mandatory
  14. #
  15. # very old versions of udev required naming rules and permissions rules to be
  16. # in separate files, but it's not clear at what version number that changed
  17. if [ ${ver} -gt 54 ]; then
  18. match="=="
  19. else
  20. match="="
  21. fi
  22. cat <<EOF
  23. # udev rules to generate the /dev/dahdi device files (if not yet provided
  24. # by your distribution):
  25. KERNEL${match}"dahdictl", NAME="dahdi/ctl"
  26. KERNEL${match}"dahditranscode", NAME="dahdi/transcode"
  27. KERNEL${match}"dahditimer", NAME="dahdi/timer"
  28. KERNEL${match}"dahdichannel", NAME="dahdi/channel"
  29. KERNEL${match}"dahdipseudo", NAME="dahdi/pseudo"
  30. KERNEL${match}"dahdi[0-9]*", NAME="dahdi/%n"
  31. # DAHDI devices with ownership/permissions for running as non-root
  32. SUBSYSTEM${match}"dahdi", OWNER="asterisk", GROUP="asterisk", MODE="0660"
  33. EOF