[pkg-fso-maint] packing udev rules

Josua Mayer josua.mayer97 at gmail.com
Sun Sep 25 11:31:15 UTC 2016


Good day to you all,

This time I would like some opinions on the technical side of packing
udev rules (for the letux-rules package):
As I see it there are at least 2 options on how to copy them to
debian/<package-dir>:

a) cp by hand (either in Makefile, or debian/rules)
This seems to be the most straight-forward approach to me, and it is
what I am using now.
This is a snippet of my current Makefile:

RULESDIR ?= lib/udev/rules.d
install-rules: *.rules
        install -v -m755 -d $(DESTDIR)/$(RULESDIR)
        install -v -m644 $? $(DESTDIR)/$(RULESDIR)/

The advantage to this approach is that the rules files can be stored at
the root of the package tree, using their destination filename.

A disadvantage seems to be that maintainer-scripts which would be
generated by the debhelper approach below, are missing.
Are they of any importance for this particular use-case? And is it worth
adding them by hand?


b) let debhelper do it
On first sight this seems to be the way to go. Give the files the right
name, and let them be handled automagically.
This approach is used by simply placing the rules files in debian?, with
a special filename format: debian/<package-name>.<rulesfilename>.udev
Here a real life sample:

debian/letux-rules.usb-realtek-net.udev
debian/letux-rules.charging.udev
debian/letux-rules.hso.udev
debian/letux-rules.input.udev
debian/letux-rules.sensor.udev

But that is not enough. Apparently it is also necessary to explicitly
call in debian/rules. Another sample:

dh_installudev --name=usb-realtek-net --priority=50
dh_installudev --name=charging
dh_installudev --name=hso
dh_installudev --name=input
dh_installudev --name=sensor

Now, the maintainer scripts are generated. A quick look however has
revealed that the generated scripts don't do much. It appears that their
only purpose is preserving user-changes to existing files in /etc.
What I expected was a call to udevadm manage --reload; udevadm trigger


Now do you have any wisdom to share which approach to pick?
Personally I lean towards approach a), and hardcoding the otherwise
copypasted maintainer scripts.
Is there a better way to have those scripts generated?

br
Josua Mayer




More information about the pkg-fso-maint mailing list