summaryrefslogtreecommitdiff
path: root/dh_installinfo
diff options
context:
space:
mode:
authorjoey <joey>1999-08-17 05:12:07 +0000
committerjoey <joey>1999-08-17 05:12:07 +0000
commit430dd853a0827cf0419d2531cf163d4c1e19c4f9 (patch)
treeae457262f779a02c68718788b46c4c5bf7038626 /dh_installinfo
parent540263202bcd5666ba65cd40e8587fdc9d48109a (diff)
r189: Initial revision
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 0000000..b6ae40f
--- /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:");
+ }
+ }
+}