summaryrefslogtreecommitdiff
path: root/dh_installinfo
diff options
context:
space:
mode:
Diffstat (limited to 'dh_installinfo')
-rwxr-xr-xdh_installinfo61
1 files changed, 61 insertions, 0 deletions
diff --git a/dh_installinfo b/dh_installinfo
new file mode 100755
index 00000000..b6ae40f9
--- /dev/null
+++ b/dh_installinfo
@@ -0,0 +1,61 @@
+#!/usr/bin/perl -w
+#
+# Reads debian/info, installs all files listed there into /usr/info
+# and puts appropriate commands into the postinst.
+
+BEGIN { push @INC, "debian", "/usr/lib/debhelper" }
+use Dh_Lib;
+init();
+
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+ $TMP=tmpdir($PACKAGE);
+ $file=pkgfile($PACKAGE,"info");
+
+ undef @info;
+
+ if ($file) {
+ @info=filearray($file);
+ }
+
+ if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+ push @info, @ARGV;
+ }
+
+ if (@info) {
+ if ( ! -d "$TMP/usr/info") {
+ doit("install","-d","$TMP/usr/info");
+ }
+ doit("cp",@info,"$TMP/usr/info");
+ doit("chmod","-R", "go=rX","$TMP/usr/info/");
+ doit("chmod","-R", "u+rw","$TMP/usr/info/");
+ }
+
+ foreach $file (@info) {
+ # Only register with install-info if this is a head file in
+ # a tree of info files.
+ if ($file=~/\.info$/ && ! $dh{NOSCRIPTS}) {
+ # Figure out what section this file goes in.
+ my $section;
+ open (IN, "<$file") || die "$file: $!";
+ while (<IN>) {
+ if (/INFO-DIR-SECTION\s+(.*)/) {
+ $section=$1;
+ last;
+ }
+ }
+ close IN;
+
+ my $fn="/usr/info/".Dh_Lib::basename($file);
+
+ if ($section ne '') {
+ autoscript($PACKAGE,"postinst","postinst-info",
+ "s/#SECTION#/$section/;s:#FILE#:$fn:");
+ }
+ else {
+ autoscript($PACKAGE,"postinst","postinst-info-nosection",
+ "s/#FILE#/$fn/");
+ }
+ autoscript($PACKAGE,"prerm","prerm-info", "s:#FILE#:$fn:");
+ }
+ }
+}