]> git.donarmstrong.com Git - debhelper.git/blobdiff - dh_installdebconf
r420: big monsta changes
[debhelper.git] / dh_installdebconf
index 489db99a49a34f4646c3a62a73afbcc677b62f13..7be03ca7a0f200d415a5602a115ca208e8224901 100755 (executable)
@@ -2,30 +2,39 @@
 #
 # Integration with debconf.
 
-BEGIN { push @INC, "debian", "/usr/share/debhelper" }
-use Dh_Lib;
+use strict;
+use Debian::Debhelper::Dh_Lib;
 init();
 
-foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
-       $TMP=tmpdir($PACKAGE);
-       $config=pkgfile($PACKAGE,"config");
-       $templates=pkgfile($PACKAGE,"templates");
+foreach my $package (@{$dh{DOPACKAGES}}) {
+       my $tmp=tmpdir($package);
+       my $config=pkgfile($package,"config");
+       my $templates=pkgfile($package,"templates");
 
-       if (! -d "$TMP/DEBIAN") {
-               doit("install","-o","root","-g","root","-d","$TMP/DEBIAN");
+       if (! -d "$tmp/DEBIAN") {
+               doit("install","-o",0,"-g",0,"-d","$tmp/DEBIAN");
        }
 
        if ($config ne '') {
-               doit("install", "-o", "root", "-g", "root", "-m", 755, "-p",
-                    $config, "$TMP/DEBIAN/config");
+               doit("install", "-o", 0, "-g", 0, "-m", 755, "-p",
+                    $config, "$tmp/DEBIAN/config");
        }
        
        if ($templates ne '') {
-               doit("install", "-o", "root", "-g", "root", "-m", 644, "-p",
-                    $templates, "$TMP/DEBIAN/templates");
+               # Are there translated templates too?
+               my @trans=(glob("$templates.??"), glob("$templates.??_??"));
+               if (@trans) {
+                       complex_doit("debconf-mergetemplate @trans $templates > $tmp/DEBIAN/templates");
+                       chmod 0644, "$tmp/DEBIAN/templates";
+                       chown 0, 0, "$tmp/DEBIAN/templates";
+               }
+               else {
+                       doit("install", "-o", 0, "-g", 0, "-m", 644, "-p",
+                            $templates, "$tmp/DEBIAN/templates");
+               }
        }
 
        if (($config ne ''|| $templates ne '') && ! $dh{NOSCRIPTS}) {
-               autoscript($PACKAGE,"postrm","postrm-debconf");
+               autoscript($package,"postrm","postrm-debconf");
        }
 }