5 dh_installcatalogs - install and register SGML Catalogs
10 use Debian::Debhelper::Dh_Lib;
12 my $sgmlbasever = "1.17";
16 B<dh_installcatalogs> [S<I<debhelper options>>] [B<-n>]
20 dh_installcatalogs is a debhelper program that installs and
21 registers SGML catalogs. (Note: it will be extended for XML catalog
22 registration when xml-core is available.) It complies with the Debian
25 The file F<debian/I<package>.sgmlcatalogs> contains the catalogs to be
26 installed per package. Each line in that file should be of the form
27 C<source dest>, where C<source> indicates where the catalog resides in
28 the source tree, and C<dest> indicates the destination location for
29 the catalog under the package build area. C<dest> should start with
32 Catalogs will be registered in a supercatalog, in
33 F</etc/sgml/I<package>.cat>.
35 This command automatically adds maintainer script snippets for
36 registering and unregistering the catalogs and "supercatalogs" (unless
37 B<-n> is used). These snippets are inserted into the maintainer scripts
38 by dh_installdeb; see L<dh_installdeb(1)> for an explanation of
39 Debhelper maintainer script snippets.
41 A dependency on B<sgml-base> will be added to C<${misc:Depends}>, so be
42 sure your package uses that variable in F<debian/control>.
48 =item B<-n>, B<--noscripts>
50 Do not modify F<postinst>/F<postrm>/F<prerm> scripts.
56 Note that this command is not idempotent. "dh_clean -k" should be
57 called between invocations of this command. Otherwise, it may cause
58 multiple instances of the same text to be added to maintainer scripts.
64 foreach my $package (@{$dh{DOPACKAGES}}) {
65 my $tmpdir = tmpdir($package);
66 my $sgmlcatlistfile = pkgfile($package, "sgmlcatalogs");
67 my @sgmlinstalled; # catalogs we've installed
69 error("extra command-line arguments");
71 if ($sgmlcatlistfile) {
72 foreach my $line (filedoublearray($sgmlcatlistfile)) {
73 my $source = $line->[0];
74 my $dest = $line->[1];
75 my $fulldest = "$tmpdir/$dest";
76 $fulldest =~ s|//|/|g; # beautification
78 if (! -d dirname($fulldest)) {
79 doit("install","-d","-m755",$tmpdir."/".dirname($dest));
82 doit("install","-p","-m644",$source,$fulldest);
84 push(@sgmlinstalled,$dest);
88 addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever");
90 if (! -d "$tmpdir/etc/sgml") {
91 doit("install","-d","-m755","$tmpdir/etc/sgml");
94 if (! $dh{NOSCRIPTS}) {
95 my $ordcats = join(" ", @sgmlinstalled);
96 my $centralcat = "/etc/sgml/$package.cat";
97 autoscript($package, "postinst", "postinst-sgmlcatalog",
98 "s%#CENTRALCAT#%$centralcat%g; s%#ORDCATS#%$ordcats%g;");
99 autoscript($package, "prerm", "prerm-sgmlcatalog",
100 "s%#CENTRALCAT#%$centralcat%g;");
101 autoscript($package, "postrm", "postrm-sgmlcatalog",
102 "s%#CENTRALCAT#%$centralcat%g;");
106 # remove the dependency
107 addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever", 1);
115 F</usr/share/doc/sgml-base-doc/>
119 Adam Di Carlo <aph@debian.org>