Package: udev
Version: 204-7
Severity: wishlist
Tags: patch
User: ubuntu-de...@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch trusty

Hello,

in Ubuntu we've had some documentation about /lib/udev/rules.d/ vs.
/etc/udev/rules.d/ for many years now, as their semantics is not quite
obvious. Do you want such a thing for Debian at all? If so, this would
be an initial patch. Presumably the number ranges in
lib/udev/rules.d/README could use some adjustments, I'm happy to do
that unless you say that you don't want READMEs.

Thanks for considering,

Martin

-- 
Martin Pitt                        | http://www.piware.de
Ubuntu Developer (www.ubuntu.com)  | Debian Developer  (www.debian.org)
>From 86558770abb852ad26a711f31e9cb257da16145a Mon Sep 17 00:00:00 2001
From: Martin Pitt <martin.p...@ubuntu.com>
Date: Wed, 6 Nov 2013 14:22:09 +0100
Subject: [PATCH] Add debian/extra/README-{etc,lib}-rules.d

These document /{etc,lib}/udev/rules.d/. Their semantics is not quite obvious,
so describe how /etc can replace or amend the behaviour from /lib/.
---
 debian/changelog                |  6 ++++++
 debian/extra/README-etc-rules.d | 24 ++++++++++++++++++++++++
 debian/extra/README-lib-rules.d | 40 ++++++++++++++++++++++++++++++++++++++++
 debian/rules                    |  5 +++++
 4 files changed, 75 insertions(+)
 create mode 100644 debian/extra/README-etc-rules.d
 create mode 100644 debian/extra/README-lib-rules.d

diff --git a/debian/changelog b/debian/changelog
index 0490e3d..2bde9ce 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,14 @@
 systemd (204-8) UNRELEASED; urgency=low
 
+  [ Michael Stapelberg ]
   * move manpages from systemd to libsystemd-*-dev as appropriate
     (Closes: #738723)
 
+  [ Martin Pitt ]
+  * Add debian/extra/README-{etc,lib}-rules.d documentation for
+    /{etc,lib}/udev/rules.d/. Their semantics is not quite obvious, so
+    describe how /etc can replace or amend the behaviour from /lib/.
+
  -- Michael Stapelberg <stapelb...@debian.org>  Thu, 13 Feb 2014 22:52:45 +0100
 
 systemd (204-7) unstable; urgency=low
diff --git a/debian/extra/README-etc-rules.d b/debian/extra/README-etc-rules.d
new file mode 100644
index 0000000..df558f8
--- /dev/null
+++ b/debian/extra/README-etc-rules.d
@@ -0,0 +1,24 @@
+The files in this directory are read by udev(7) and used when events
+are performed by the kernel.  The udev daemon watches this directory
+with inotify so that changes to these files are automatically picked
+up, for this reason they must be files and not symlinks to another
+location as in the case in Debian.
+
+Packages do not generally install rules here, this directory is for
+local rules.  If you want to override behaviour of package-supplied
+rules, which can be found in /lib/udev/rules.d, you can do one of
+two things:
+
+ 1) Write your own rules in this directory that assign the name,
+    symlinks, permissions, etc. that you want.  Pick a number higher
+    than the rules you want to override, and yours will be used.
+
+ 2) Copy the file from /lib/udev/rules.d and edit it here; you
+    should generally only do this if you want to prevent a program
+    from being run.
+
+
+If the ordering of files in this directory are not important to you,
+it's recommended that you simply name your files "descriptive-name.rules"
+such that they are processed AFTER all numbered rules in both this
+directory and /lib/udev/rules.d and thus override anything set there.
diff --git a/debian/extra/README-lib-rules.d b/debian/extra/README-lib-rules.d
new file mode 100644
index 0000000..c00052a
--- /dev/null
+++ b/debian/extra/README-lib-rules.d
@@ -0,0 +1,40 @@
+The files in this directory are read by udev(7) and used when events
+are performed by the kernel.  The udev daemon watches this directory
+with inotify so that changes to these files are automatically picked
+up, for this reason they must be files and not symlinks to another
+location as in the case in Debian.
+
+These are not conffiles.  If you want to override the behaviour, you
+can do one of two things:
+
+ 1) Write your own rules in /etc/udev/rules.d that assign the name,
+    symlinks, permissions, etc. that you want.  Pick a number higher
+    than the rules you want to override, and yours will be used.
+
+ 2) Copy the file to /etc/udev/rules.d and edit it there; you
+    should generally only do this if you want to prevent a program
+    from being run.
+
+
+Files should be named xx-descriptive-name.rules, the xx should be
+chosen first according to the following sequence points:
+
+ < 60  rules shipped in packages; these can be overriden by later or
+       default rules unless := is used in assignment.
+
+       these cannot access persistent information such as that from
+       blkid
+
+ < 70  rules that run helpers such as blkid to populate the udev db
+
+ < 90  rules that run other programs (often using information in the
+       udev db)
+
+ >=90  rules that should run last
+
+Common locations for package rules:
+
+ 40-xx general rules, setting names and permissions
+ 65-xx rules to populate the udev db
+ 85-xx rules to run programs
+
diff --git a/debian/rules b/debian/rules
index 677e3e2..cbbce39 100755
--- a/debian/rules
+++ b/debian/rules
@@ -139,6 +139,11 @@ override_dh_install:
 		debian/extra/write_cd_rules \
 		debian/extra/write_net_rules \
 		debian/udev/lib/udev/
+	# udev rules documentation
+	install -m 644 -o root -g root debian/extra/README-etc-rules.d \
+		debian/udev/etc/udev/rules.d/README
+	install -m 644 -o root -g root debian/extra/README-lib-rules.d \
+		debian/udev/lib/udev/rules.d/README
 	# systemd
 	cp -a debian/pam-configs debian/libpam-systemd/usr/share/
 	install -D --mode=644 debian/init-functions.d/40-systemd \
-- 
1.9.rc1

Reply via email to