[zaptel-commits] branch 1.2 r1064 - in /branches/1.2: Makefile build_tools/genudevrules udev/

zaptel-commits at lists.digium.com zaptel-commits at lists.digium.com
Wed May 17 09:49:47 MST 2006


Author: kpfleming
Date: Wed May 17 11:49:46 2006
New Revision: 1064

URL: http://svn.digium.com/view/zaptel?rev=1064&view=rev
Log:
move udev rules creating into a script, and generate it properly based on the installed udev version

Added:
    branches/1.2/build_tools/genudevrules   (with props)
Removed:
    branches/1.2/udev/
Modified:
    branches/1.2/Makefile

Modified: branches/1.2/Makefile
URL: http://svn.digium.com/view/zaptel/branches/1.2/Makefile?rev=1064&r1=1063&r2=1064&view=diff
==============================================================================
--- branches/1.2/Makefile (original)
+++ branches/1.2/Makefile Wed May 17 11:49:46 2006
@@ -104,9 +104,6 @@
   ifneq (,$(wildcard $(ROOT_PREFIX)/etc/udev/rules.d))
     DYNFS=yes
     UDEVRULES=yes
-    ifneq (,$(wildcard $(ROOT_PREFIX)/etc/udev/permissions.d))
-      UDEVPERMISSIONS=yes
-    endif
   endif
 endif
 
@@ -337,12 +334,7 @@
 	done
 else # DYNFS
   ifdef UDEVRULES
-    ifdef UDEVPERMISSIONS
-	install -m 644 udev/zaptel.rules $(INSTALL_PREFIX)/etc/udev/rules.d
-	install -m 644 udev/zaptel.permissions $(INSTALL_PREFIX)/etc/udev/permissions.d
-    else # !UDEVPERMISSIONS (newer, combined syntax)
-	install -m 644 udev/zaptel.rules-combined $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules
-    endif
+	build_tools/genudevrules > $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules
   else # !UDEVRULES
 	@echo "**** Dynamic filesystem detected -- not creating device nodes"
   endif
@@ -430,15 +422,7 @@
 	[ `id -u` = 0 ] && /sbin/depmod -a $(KVERS) || :
 	[ -f $(CONFIG_FILE) ] || install -D -m 644 zaptel.conf.sample $(CONFIG_FILE)
 
-install-udev:
-  ifdef UDEVRULES
-    ifdef UDEVPERMISSIONS
-	install -m 644 udev/zaptel.rules $(INSTALL_PREFIX)/etc/udev/rules.d
-	install -m 644 udev/zaptel.permissions $(INSTALL_PREFIX)/etc/udev/permissions.d
-    else # !UDEVPERMISSIONS (newer, combined syntax)
-	install -m 644 udev/zaptel.rules-combined $(INSTALL_PREFIX)/etc/udev/rules.d/zaptel.rules
-    endif
-  endif
+install-udev: devices
 
 config:
 	if [ -d $(INSTALL_PREFIX)/etc/rc.d/init.d ]; then \

Added: branches/1.2/build_tools/genudevrules
URL: http://svn.digium.com/view/zaptel/branches/1.2/build_tools/genudevrules?rev=1064&view=auto
==============================================================================
--- branches/1.2/build_tools/genudevrules (added)
+++ branches/1.2/build_tools/genudevrules Wed May 17 11:49:46 2006
@@ -1,0 +1,30 @@
+#!/bin/sh
+
+ver=`udevinfo -V | cut -f3 -d" "`
+
+if [ -z "${ver}" ]; then
+   echo Cannot determine the version of udev installed this system... exiting.
+   exit 1
+fi
+
+# udev versions prior to 055 use a single '=' for matching key values
+# udev versions 055 and later support '==' for that purpose, and versions
+# beyond 092 will probably make it mandatory
+#
+# very old versions of udev required naming rules and permissions rules to be
+# in separate files, but it's not clear at what version number that changed
+
+if [ ${ver} -gt 54 ]; then
+    match="=="
+else
+    match="="
+fi
+
+cat <<EOF
+# zaptel devices with ownership/permissions for running as non-root
+KERNEL${match}"zapctl", NAME="zap/ctl", OWNER="asterisk", GROUP="asterisk", MODE="0660"
+KERNEL${match}"zaptimer", NAME="zap/timer", OWNER="asterisk", GROUP="asterisk", MODE="0660"
+KERNEL${match}"zapchannel", NAME="zap/channel", OWNER="asterisk", GROUP="asterisk", MODE="0660"
+KERNEL${match}"zappseudo", NAME="zap/pseudo", OWNER="asterisk", GROUP="asterisk", MODE="0660"
+KERNEL${match}"zap[0-9]*", NAME="zap/%n", OWNER="asterisk", GROUP="asterisk", MODE="0660"
+EOF

Propchange: branches/1.2/build_tools/genudevrules
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: branches/1.2/build_tools/genudevrules
------------------------------------------------------------------------------
    svn:executable = *

Propchange: branches/1.2/build_tools/genudevrules
------------------------------------------------------------------------------
    svn:keywords = Author Id Date Revision

Propchange: branches/1.2/build_tools/genudevrules
------------------------------------------------------------------------------
    svn:mime-type = text/plain



More information about the zaptel-commits mailing list