]> git.donarmstrong.com Git - debhelper.git/commitdiff
conffile moving idiocy
authorJoey Hess <joey@gnu.kitenet.net>
Tue, 3 Mar 2009 02:20:29 +0000 (21:20 -0500)
committerJoey Hess <joey@gnu.kitenet.net>
Tue, 3 Mar 2009 02:20:29 +0000 (21:20 -0500)
* dh_installmodules: Give files in /etc/modprobe.d a .conf
  syntax, as required by new module-init-tools.
* dh_installmodules: Add preinst and postinst code to handle
  cleanly renaming the modprobe.d files on upgrade.
* Two updates to conffile moving code from wiki:
  - Support case where the conffile name is a substring of another
    conffile's name.
  - Support case where dpkg-query says the file is obsolete.

autoscripts/postinst-moveconffile [new file with mode: 0644]
autoscripts/postinst-udev [deleted file]
autoscripts/preinst-moveconffile [new file with mode: 0644]
autoscripts/preinst-udev
debian/changelog
dh_installmodules
dh_installudev

diff --git a/autoscripts/postinst-moveconffile b/autoscripts/postinst-moveconffile
new file mode 100644 (file)
index 0000000..28f061e
--- /dev/null
@@ -0,0 +1,9 @@
+if [ "$1" = configure ]; then
+       if [ -e "#OLD#" ]; then
+               echo "Preserving user changes to #NEW# ..."
+               if [ -e "#NEW#" ]; then
+                       mv -f "#NEW#" "#NEW#.dpkg-new"
+               fi
+               mv -f "#OLD#" "#NEW#"
+       fi
+fi
diff --git a/autoscripts/postinst-udev b/autoscripts/postinst-udev
deleted file mode 100644 (file)
index 40b953d..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-if [ "$1" = configure ]; then
-       if [ -e "#OLD#" ]; then
-               echo "Preserving user changes to #RULE# ..."
-               if [ -e "#RULE#" ]; then
-                       mv -f "#RULE#" "#RULE#.dpkg-new"
-               fi
-               mv -f "#OLD#" "#RULE#"
-       fi
-fi
diff --git a/autoscripts/preinst-moveconffile b/autoscripts/preinst-moveconffile
new file mode 100644 (file)
index 0000000..619b4ce
--- /dev/null
@@ -0,0 +1,9 @@
+if [ "$1" = install ] || [ "$1" = upgrade ]; then
+       if [ -e "#OLD#" ]; then
+               if [ "`md5sum \"#OLD#\" | sed -e \"s/ .*//\"`" = \
+                    "`dpkg-query -W -f='${Conffiles}' #PACKAGE# | sed -n -e \"\\\\' #OLD# '{s/ obsolete$//;s/.* //p}\"`" ]
+               then
+                       rm -f "#OLD#"
+               fi
+       fi
+fi
index 2b6ede305231a16b192a7a41957bb5162d68dba6..7874fdb7f4e3da067b45d6ad99e1afce78908e21 100644 (file)
@@ -1,11 +1,4 @@
 if [ "$1" = install ] || [ "$1" = upgrade ]; then
-       if [ -e "#OLD#" ]; then
-               if [ "`md5sum \"#OLD#\" | sed -e \"s/ .*//\"`" = \
-                    "`dpkg-query -W -f='${Conffiles}' #PACKAGE# | sed -n -e \"\\\\' #OLD#'s/.* //p\"`" ]
-               then
-                       rm -f "#OLD#"
-               fi
-       fi
        if [ -L "#RULE#" ]; then
                rm -f "#RULE#"
        fi
index b1199feb713501d9d254f2ac6cfd353bff10717c..1240b99a366c9667c36c50954cabe310a74e38fe 100644 (file)
@@ -1,3 +1,16 @@
+debhelper (7.2.2) UNRELEASED; urgency=low
+
+  * dh_installmodules: Give files in /etc/modprobe.d a .conf
+    syntax, as required by new module-init-tools.
+  * dh_installmodules: Add preinst and postinst code to handle
+    cleanly renaming the modprobe.d files on upgrade.
+  * Two updates to conffile moving code from wiki:
+    - Support case where the conffile name is a substring of another
+      conffile's name.
+    - Support case where dpkg-query says the file is obsolete.
+
+ -- Joey Hess <joeyh@debian.org>  Mon, 02 Mar 2009 20:46:10 -0500
+
 debhelper (7.2.1) experimental; urgency=low
 
   * Merged debhelper 7.0.52.
index 6a08eb774bb194cad2d2da588258eedd85157a87..6bb2250054f81641f72a48156c41f194778f54f4 100755 (executable)
@@ -21,7 +21,7 @@ dh_installmodules is a debhelper program that is responsible for
 registering kernel modules.
 
 Files named debian/package.modprobe will be installed in
-etc/modprobe.d/package in the package build directory, to be used by
+etc/modprobe.d/package.conf in the package build directory, to be used by
 module-init-tools's version of modprobe.
 
 Kernel modules are searched for in the package build directory and if
@@ -102,7 +102,11 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                if (! -e "$tmp/etc/modprobe.d") {
                        doit("install","-d","$tmp/etc/modprobe.d");
                }
-               doit("install","-m","0644",$modprobe_file,"$tmp/etc/modprobe.d/".pkgfilename($package));
+               my $old="/etc/modprobe.d/".pkgfilename($package);
+               my $new=$old.".conf";
+               doit("install","-m","0644",$modprobe_file,"$tmp/$new");
+               autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#PACKAGE#!$package!g");
+               autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$new!g");
        }
        
        if (! $dh{NOSCRIPTS}) {
index 9dd4e18c5deefe0d95fce3b12e75f680e4757ed9..243dc732435d4c67046a1e6ba57573a4b7d57b70 100755 (executable)
@@ -79,8 +79,9 @@ foreach my $package (@{$dh{DOPACKAGES}}) {
                if (! $dh{NOSCRIPTS}) {
                        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");
+                       autoscript($package,"preinst","preinst-moveconffile","s!#OLD#!$old!g;s!#PACKAGE#!$package!g");
+                       autoscript($package,"postinst","postinst-moveconffile","s!#OLD#!$old!g;s!#NEW#!$rule!g");
+                       autoscript($package,"preinst","preinst-udev","s!#RULE#!$rule!g");
                }
        }
 }