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_installcatalog 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). A dependancy on B<sgml-base> will be added to
38 C<${misc:Depends}>, so be sure your package uses that variable in
39 F<debian/control>. See L<dh_installdeb(1)> for an explantion of
40 Debhelper maintainer script snippets.
46 =item B<-n>, B<--noscripts>
48 Do not modify F<postinst>/F<postrm>/F<prerm> scripts.
54 Note that this command is not idempotent. "dh_clean -k" should be
55 called between invocations of this command. Otherwise, it may cause
56 multiple instances of the same text to be added to maintainer scripts.
62 foreach my $package (@{$dh{DOPACKAGES}}) {
63 my $tmpdir = tmpdir($package);
64 my $sgmlcatlistfile = pkgfile($package, "sgmlcatalogs");
65 my @sgmlinstalled; # catalogs we've installed
67 error("extra command-line arguments");
69 if ($sgmlcatlistfile) {
70 foreach my $line (filedoublearray($sgmlcatlistfile)) {
71 my $source = $line->[0];
72 my $dest = $line->[1];
73 my $fulldest = "$tmpdir/$dest";
74 $fulldest =~ s|//|/|g; # beautification
76 if (! -d dirname($fulldest)) {
77 doit("install","-d","-m755",dirname($dest));
80 doit("install","-p","-m644",$source,$fulldest);
82 push(@sgmlinstalled,$dest);
86 addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever");
88 if (! $dh{NOSCRIPTS}) {
89 my $ordcats = join(" ", @sgmlinstalled);
90 my $centralcat = "/etc/sgml/$package.cat";
91 autoscript($package, "postinst", "postinst-sgmlcatalog",
92 "s%#CENTRALCAT#%$centralcat%g; s%#ORDCATS#%$ordcats%g;");
93 autoscript($package, "prerm", "prerm-sgmlcatalog",
94 "s%#CENTRALCAT#%$centralcat%g;");
95 autoscript($package, "postrm", "postrm-sgmlcatalog",
96 "s%#CENTRALCAT#%$centralcat%g;");
100 # remove the dependency
101 addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever", 1);
109 F</usr/share/doc/sgml-base-doc/>
113 Adam Di Carlo <aph@debian.org>