]> git.donarmstrong.com Git - debhelper.git/blob - dh_gconf
Fix pod.
[debhelper.git] / dh_gconf
1 #!/usr/bin/perl -w
2
3 =head1 NAME
4
5 dh_gconf - generate GConf schema registration scripts
6
7 =cut
8
9 use strict;
10 use Debian::Debhelper::Dh_Lib;
11
12 =head1 SYNOPSIS
13
14 B<dh_gconf> [S<I<debhelper options>>] [B<--priority=<number>>]
15
16 =head1 DESCRIPTION
17
18 dh_gconf is a debhelper program that is responsible for registering
19 GConf schemas.
20
21 It automatically generates the postinst and prerm fragments needed
22 to register and unregister the schemas in usr/share/gconf/schemas, using
23 gconf-schemas.
24
25 If a file named debian/package.gconf-defaults exists, then it is
26 installed into usr/share/gconf/defaults/10_package in the package build
27 directory, with "package" replaced by the package name. Some postinst and
28 postrm fragments will be generated to launch update-gconf-defaults.
29
30 The gconf-schemas and update-gconf-defaults scripts are provided by the
31 gconf2 package. An appropriate dependency will be generated in
32 ${misc:Depends}.
33
34 =head1 OPTIONS
35
36 =over 4
37
38 =item B<--priority> I<priority>
39
40 Use I<priority> (which should be a 2-digit number) as the defaults
41 priority instead of 10. Higher values than ten can be used by 
42 derived distributions (20), CDD distributions (50), or site-specific
43 packages (90).
44
45 =back
46
47 =cut
48
49 init();
50
51 my $priority=10;
52 if (defined $dh{PRIORITY}) {
53         $priority=$dh{PRIORITY};
54 }
55
56 foreach my $package (@{$dh{DOPACKAGES}}) {
57         my $tmp=tmpdir($package);
58         
59         my $gconf_dep = 0;
60         my $defaults = pkgfile($package,"gconf-defaults");
61         if ($defaults ne '') {
62                 doit("mkdir","-p","$tmp/usr/share/gconf/defaults");
63                 doit("install","-p","-m644",$defaults,"$tmp/usr/share/gconf/defaults/${priority}_$package");
64                 autoscript($package,"postinst","postinst-gconf-defaults");
65                 autoscript($package,"postrm","postrm-gconf-defaults");
66                 addsubstvar($package, "misc:Depends", "gconf2 (>= 2.12.1-1)");
67                 $gconf_dep = 1;
68         }
69
70         my $old_schemas_dir = "$tmp/etc/gconf/schemas";
71         my $new_schemas_dir = "$tmp/usr/share/gconf/schemas";
72
73         # Migrate schemas from /etc/gconf/schemas to /usr/share/gconf/schemas
74         if (-d $old_schemas_dir) {
75                 doit("mkdir -p $new_schemas_dir") unless -d $new_schemas_dir;
76                 doit("mv $old_schemas_dir/*.schemas $new_schemas_dir/");
77                 doit("rmdir -p --ignore-fail-on-non-empty $old_schemas_dir");
78         }
79
80         if (-d "$new_schemas_dir") {
81                 # Get a list of the schemas
82                 my $schemas = `find $new_schemas_dir -type f -name \\*.schemas -printf '%P '`;
83                 if ($schemas ne '') {
84                         autoscript($package,"postinst","postinst-gconf","s%#SCHEMAS#%$schemas%");
85                         autoscript($package,"prerm","prerm-gconf","s%#SCHEMAS#%$schemas%");
86                         autoscript($package,"postrm","postrm-gconf","s%#SCHEMAS#%$schemas%");
87                         addsubstvar($package, "misc:Depends", "gconf2 (>= 2.10.1-2)") unless $gconf_dep;
88                 }
89         }
90 }
91
92 =head1 SEE ALSO
93
94 L<debhelper(7)>
95
96 This program is a part of debhelper.
97
98 =head1 AUTHOR
99
100 Ross Burton <ross@burtonini.com>
101 Josselin Mouette <joss@debian.org>
102
103 =cut