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. It complies with the Debian XML/SGML policy.
23 Catalogs will be registered in a supercatalog, in
24 F</etc/sgml/I<package>.cat>.
26 This command automatically adds maintainer script snippets for
27 registering and unregistering the catalogs and supercatalogs (unless
28 B<-n> is used). These snippets are inserted into the maintainer scripts
29 by dh_installdeb; see L<dh_installdeb(1)> for an explanation of
30 Debhelper maintainer script snippets.
32 A dependency on B<sgml-base> will be added to C<${misc:Depends}>, so be
33 sure your package uses that variable in F<debian/control>.
39 =item debian/I<package>.sgmlcatalogs
41 Lists the catalogs to be installed per package. Each line in that file
42 should be of the form C<source dest>, where C<source> indicates where the
43 catalog resides in the source tree, and C<dest> indicates the destination
44 location for the catalog under the package build area. C<dest> should
45 start with F</usr/share/sgml/>.
53 =item B<-n>, B<--noscripts>
55 Do not modify F<postinst>/F<postrm>/F<prerm> scripts.
61 Note that this command is not idempotent. L<dh_prep(1)> should be
62 called between invocations of this command. Otherwise, it may cause
63 multiple instances of the same text to be added to maintainer scripts.
69 foreach my $package (@{$dh{DOPACKAGES}}) {
70 my $tmpdir = tmpdir($package);
71 my $sgmlcatlistfile = pkgfile($package, "sgmlcatalogs");
72 my @sgmlinstalled; # catalogs we've installed
74 error("extra command-line arguments");
76 if ($sgmlcatlistfile) {
77 foreach my $line (filedoublearray($sgmlcatlistfile)) {
78 my $source = $line->[0];
79 my $dest = $line->[1];
80 my $fulldest = "$tmpdir/$dest";
81 $fulldest =~ s|//|/|g; # beautification
83 if (! -d dirname($fulldest)) {
84 doit("install","-d","-m755",$tmpdir."/".dirname($dest));
87 doit("install","-p","-m644",$source,$fulldest);
89 push(@sgmlinstalled,$dest);
93 addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever");
95 if (! -d "$tmpdir/etc/sgml") {
96 doit("install","-d","-m755","$tmpdir/etc/sgml");
99 if (! $dh{NOSCRIPTS}) {
100 my $ordcats = join(" ", @sgmlinstalled);
101 my $centralcat = "/etc/sgml/$package.cat";
102 autoscript($package, "postinst", "postinst-sgmlcatalog",
103 "s%#CENTRALCAT#%$centralcat%g; s%#ORDCATS#%$ordcats%g;");
104 autoscript($package, "prerm", "prerm-sgmlcatalog",
105 "s%#CENTRALCAT#%$centralcat%g;");
106 autoscript($package, "postrm", "postrm-sgmlcatalog",
107 "s%#CENTRALCAT#%$centralcat%g;");
111 # remove the dependency
112 addsubstvar($package, "misc:Depends", "sgml-base", ">= $sgmlbasever", 1);
120 F</usr/share/doc/sgml-base-doc/>
124 Adam Di Carlo <aph@debian.org>