X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_gconf;h=84a6a6cc91977f2cd95cba6d883f0c4d0ffbfe14;hb=ec666dc94becbdb665a12c1d741a1358cfde6338;hp=90ee14c33e989a053aadcb89b29e467aad683c7b;hpb=4366a26a9c0c1d41597ee9f5c4b1eebaf2ac8eb3;p=debhelper.git diff --git a/dh_gconf b/dh_gconf index 90ee14c..84a6a6c 100755 --- a/dh_gconf +++ b/dh_gconf @@ -11,44 +11,93 @@ use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS -B [S>] [B<-p>] +B [S>] [B<--priority=>] =head1 DESCRIPTION dh_gconf is a debhelper program that is responsible for registering GConf schemas. -It automatically generates the postinst and prerm sragments needed -to register and unregister the schemas in etc/gconf/schemas. -These fragements will use gconftool-2, so the package should depend on -gconf2. This rogram will add an apprioriate dependency to ${misc:Depends}. +It automatically generates the postinst and prerm fragments needed +to register and unregister the schemas in usr/share/gconf/schemas, using +gconf-schemas. + +If a file named debian/package.gconf-defaults exists, then it is +installed into usr/share/gconf/defaults/10_package in the package build +directory, with "package" replaced by the package name. Some postinst and +postrm fragments will be generated to launch update-gconf-defaults. + +The gconf-schemas and update-gconf-defaults scripts are provided by the +gconf2 package. An appropriate dependency will be generated in +${misc:Depends}. + +=head1 OPTIONS + +=over 4 + +=item B<--priority> I + +Use I (which should be a 2-digit number) as the defaults +priority instead of 10. Higher values than ten can be used by +derived distributions (20), CDD distributions (50), or site-specific +packages (90). + +=back =cut init(); +my $priority=10; +if (defined $dh{PRIORITY}) { + $priority=$dh{PRIORITY}; +} + foreach my $package (@{$dh{DOPACKAGES}}) { my $tmp=tmpdir($package); + + my $gconf_dep = 0; + my $defaults = pkgfile($package,"gconf-defaults"); + if ($defaults ne '') { + doit("mkdir","-p","$tmp/usr/share/gconf/defaults"); + doit("install","-p","-m644",$defaults,"$tmp/usr/share/gconf/defaults/${priority}_$package"); + autoscript($package,"postinst","postinst-gconf-defaults"); + autoscript($package,"postrm","postrm-gconf-defaults"); + addsubstvar($package, "misc:Depends", "gconf2 (>= 2.12.1-1)"); + $gconf_dep = 1; + } + + 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 "$tmp/etc/gconf/schemas") { + if (-d "$new_schemas_dir") { # Get a list of the schemas - my $schemas = `find debian/$package/etc/gconf/schemas -type f -name \*.schemas -printf '%P '`; + 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%"); - addsubstvar($package, "misc:Depends", "gconf2 >= 2.4.0"); + autoscript($package,"postrm","postrm-gconf","s%#SCHEMAS#%$schemas%"); + addsubstvar($package, "misc:Depends", "gconf2 (>= 2.10.1-2)") unless $gconf_dep; } } } =head1 SEE ALSO -L +L This program is a part of debhelper. =head1 AUTHOR Ross Burton +Josselin Mouette =cut