- my $old="/etc/udev/$filename";
- my $rule="/etc/udev/rules.d/$dh{PRIORITY}$filename";
- autoscript($package,"preinst","preinst-udev","s!#OLD#!$old!g;s!#RULE#!$rule!g;s!#PACKAGE#!$package!g");
- autoscript($package,"postinst","postinst-udev","s!#OLD#!$old!g;s!#RULE#!$rule!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");