]> git.donarmstrong.com Git - debhelper.git/blob - dh_gconf
Remove autoscripts for GConf
[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 An appropriate dependency on gconf2 will be generated in ${misc:Depends}.
26
27 =head1 FILES
28
29 =over 4
30
31 =item debian/I<package>.gconf-defaults
32
33 Installed into usr/share/gconf/defaults/10_package in the package build
34 directory, with "I<package>" replaced by the package name. Some postinst
35 and postrm fragments will be generated to run update-gconf-defaults.
36
37 =item debian/I<package>.gconf-mandatory
38
39 Installed into usr/share/gconf/mandatory/10_package in the package build
40 directory, with "I<package>" replaced by the package name, and similar
41 postinst and postrm fragments will be generated.
42
43 =back
44
45 =head1 OPTIONS
46
47 =over 4
48
49 =item B<--priority> I<priority>
50
51 Use I<priority> (which should be a 2-digit number) as the defaults
52 priority instead of 10. Higher values than ten can be used by 
53 derived distributions (20), CDD distributions (50), or site-specific
54 packages (90).
55
56 =back
57
58 =cut
59
60 init();
61
62 my $priority=10;
63 if (defined $dh{PRIORITY}) {
64         $priority=$dh{PRIORITY};
65 }
66
67 foreach my $package (@{$dh{DOPACKAGES}}) {
68         my $tmp=tmpdir($package);
69         
70         my $gconf_dep = 0;
71         my $mandatory = pkgfile($package, "gconf-mandatory");
72         if ($mandatory ne '') {
73                 doit("mkdir","-p","$tmp/usr/share/gconf/mandatory");
74                 doit("install","-p","-m644",$mandatory,"$tmp/usr/share/gconf/mandatory/${priority}_$package");
75                 addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)");
76                 $gconf_dep = 1;
77         }
78         my $defaults = pkgfile($package,"gconf-defaults");
79         if ($defaults ne '') {
80                 doit("mkdir","-p","$tmp/usr/share/gconf/defaults");
81                 doit("install","-p","-m644",$defaults,"$tmp/usr/share/gconf/defaults/${priority}_$package");
82                 addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)") unless $gconf_dep;
83                 $gconf_dep = 1;
84         }
85
86         my $old_schemas_dir = "$tmp/etc/gconf/schemas";
87         my $new_schemas_dir = "$tmp/usr/share/gconf/schemas";
88
89         # Migrate schemas from /etc/gconf/schemas to /usr/share/gconf/schemas
90         if (-d $old_schemas_dir) {
91                 doit("mkdir -p $new_schemas_dir") unless -d $new_schemas_dir;
92                 doit("mv $old_schemas_dir/*.schemas $new_schemas_dir/");
93                 doit("rmdir -p --ignore-fail-on-non-empty $old_schemas_dir");
94         }
95
96         if (-d "$new_schemas_dir") {
97                 # Get a list of the schemas
98                 my $schemas = `find $new_schemas_dir -type f -name \\*.schemas -printf '%P '`;
99                 if ($schemas ne '') {
100                         addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)") unless $gconf_dep;
101                 }
102         }
103 }
104
105 =head1 SEE ALSO
106
107 L<debhelper(7)>
108
109 This program is a part of debhelper.
110
111 =head1 AUTHOR
112
113 Ross Burton <ross@burtonini.com>
114 Josselin Mouette <joss@debian.org>
115
116 =cut