- autoscript($package,"postinst","postinst-udev",
- "s/#FILE#/$filename/g;s/#PRIO#/$dh{PRIORITY}/g");
- autoscript($package,"postrm","postrm-udev",
- "s/#FILE#/$filename/g;s/#PRIO#/$dh{PRIORITY}/g");
+ # Remove old rule from /etc, unless it's modified,
+ # in which case we rename it to match the new
+ # file in /lib, so it will override.
+ my $old="/etc/udev/rules.d/$old_priority$oldfilename";
+ $rule=~s/^\/lib/\/etc/;
+ autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g;s!#PACKAGE#!$package!g");
+ autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g");