Steinar H. Gunderson wrote: > dh_installudev installs a #DEBHELPER# fragment that makes a symlink from > /etc/udev/package.rules to /etc/udev/rules.d/package.rules, but only if > the installation is brand new (ie. [ -z "$2" ]). This is, AFAICS, > because an admin should be free to rm this symlink without worrying that > it will be reintroduced on the next upgrade. > > However, if a package doesn't include this .rules file from the very > start, the symlink won't be created: version 1 will install as usual, > and when the .rules file is installed in an upgrade to version 2, $2 is > of course not empty (it's "1"), and the symlink is never created. > > dh_installudev should probably take a parameter saying what version the > .rules files were introduced in, and check $2 against that with > dpkg --compare-versions. I can see there's problems here if multiple > independent files are introduced at different times by the same package, > but I guess that's a narrow enough use case that it won't be a problem > in practice?
Ugh, this is a nasty bug that I should have caught before. I don't like the idea of passing a version parameter. I would rather avoid that if possible. On reviewing how these links are supposed to work, I don't understand why these symlinks are used at all. If files were placed directly in /etc/udev/rules.d and were conffiles, then admins could simply directly remove them and they would not be put back on upgrade due to normal conffile handling. (hal already handles its rules file this way FWIW.) Is there actually a good reason for the symlinks, which I am not seeing? The best reason I have come up with so far is that it allows the link to be renamed to a higher/lower number while still having the file contents updated by dpkg. With the symlinks, the best approach I've come up with for postinst scripts is for them to check for a flag file, create the symlink and touch the flag if the flag is missing. I'm not sure where to put the flag files, possibly somewhere under /var. postinst: if [ "$1" = configure -a ! -e /var/lib/udev/rules-links/##FILE## ]; then ln -s ../#FILE# /etc/udev/rules.d/#PRIO##FILE# mkdir -p /var/lib/udev/rules-links/ touch /var/lib/udev/rules-links/##FILE## fi postrm: if [ "$1" = purge ]; then [ -L /etc/udev/rules.d/#PRIO##FILE# ] && \ rm /etc/udev/rules.d/#PRIO##FILE# rm -f /var/lib/udev/rules-links/##FILE## rmdir -p --ignore-fail-on-non-empty /var/lib/udev/rules-links/ fi It might be better to have a script in udev, analagous to update-rc.d, that handles this, rather than duplicating the code in all the maintainer scripts. I would not want to implement this in debhelper unless Marco signed off on it and documented it as the right way to go in udev's README.Debian. -- see shy jo
signature.asc
Description: Digital signature