summaryrefslogtreecommitdiff
path: root/dh_gconf
blob: 19341af1c42defffe99e6c298a3d605578a59314 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/perl -w

=head1 NAME

dh_gconf - generate GConf schema registration scripts

=cut

use strict;
use Debian::Debhelper::Dh_Lib;

=head1 SYNOPSIS

B<dh_gconf> [S<I<debhelper options>>] [B<-p<package>>]

=head1 DESCRIPTION

dh_gconf is a debhelper program that is responsible for registering
GConf schemas.

It automatically generates the postinst and prerm fragments needed
to register and unregister the schemas in usr/share/gconf/schemas.
These fragements will use gconftool-2, so the package should depend on
gconf2. This program will add an appropriate dependency to ${misc:Depends}.

The postinst script will also signal gconfd-2 so that the newly installed
schemas are available straight away.

=cut

init();


foreach my $package (@{$dh{DOPACKAGES}}) {
	my $tmp=tmpdir($package);
	my $old_schemas_dir = "$tmp/etc/gconf/schemas";
	my $new_schemas_dir = "$tmp/usr/share/gconf/schemas";

	# Migrate schemas from /etc/gconf/schemas to /usr/share/gconf/schemas
	if (-d $old_schemas_dir) {
		doit("mkdir -p $new_schemas_dir") unless -d $new_schemas_dir;
		doit("mv $old_schemas_dir/*.schemas $new_schemas_dir/");
		doit("rmdir -p --ignore-fail-on-non-empty $old_schemas_dir");
	}

	if (-d "$new_schemas_dir") {
		# Get a list of the schemas
		my $schemas = `find $new_schemas_dir -type f -name \\*.schemas -printf '%P '`;
		if ($schemas ne '') {
			autoscript($package,"postinst","postinst-gconf","s%#SCHEMAS#%$schemas%");
			autoscript($package,"prerm","prerm-gconf","s%#SCHEMAS#%$schemas%");
			autoscript($package,"postrm","postrm-gconf","s%#SCHEMAS#%$schemas%");
			addsubstvar($package, "misc:Depends", "gconf2 (>= 2.6.2-1)");
		}
	}
}

=head1 SEE ALSO

L<debhelper(7)>

This program is a part of debhelper.

=head1 AUTHOR

Ross Burton <ross@burtonini.com>

=cut