X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=dh_gconf;h=1f3070e3dc0b899a1c8234e00c154fd0d2184018;hb=18a0da8092ea9f3dc48bca92b36f592af25a608d;hp=2ca325de15b72a76b426491bcba0c1474f7cdea0;hpb=34439b97ac9a0581e1273af3a3125cad6d6bfc6f;p=debhelper.git diff --git a/dh_gconf b/dh_gconf index 2ca325d..1f3070e 100755 --- a/dh_gconf +++ b/dh_gconf @@ -2,7 +2,7 @@ =head1 NAME -dh_gconf - generate GConf schema registration scripts +dh_gconf - install GConf defaults files and register schemas =cut @@ -11,32 +11,87 @@ use Debian::Debhelper::Dh_Lib; =head1 SYNOPSIS -B [S>] [B<-p>] +B [S>] [B<--priority=>I] =head1 DESCRIPTION -dh_gconf is a debhelper program that is responsible for registering -GConf schemas. +B is a debhelper program that is responsible for installing GConf +defaults files and registering GConf schemas. -It automatically generates the postinst and prerm fragments 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}. +An appropriate dependency on gconf2 will be generated in B<${misc:Depends}>. + +=head1 FILES + +=over 4 + +=item debian/I.gconf-defaults + +Installed into F in the package build +directory, with I replaced by the package name. + +=item debian/I.gconf-mandatory + +Installed into F in the package build +directory, with I replaced by the package name. + +=back + +=head1 OPTIONS + +=over 4 + +=item B<--priority> I + +Use I (which should be a 2-digit number) as the defaults +priority instead of B<10>. Higher values than ten can be used by +derived distributions (B<20>), CDD distributions (B<50>), or site-specific +packages (B<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 $mandatory = pkgfile($package, "gconf-mandatory"); + if ($mandatory ne '') { + doit("mkdir","-p","$tmp/usr/share/gconf/mandatory"); + doit("install","-p","-m644",$mandatory,"$tmp/usr/share/gconf/mandatory/${priority}_$package"); + addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)"); + $gconf_dep = 1; + } + 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"); + addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)") unless $gconf_dep; + $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"); + addsubstvar($package, "misc:Depends", "gconf2 (>= 2.28.1-2)") unless $gconf_dep; } } } @@ -50,5 +105,6 @@ This program is a part of debhelper. =head1 AUTHOR Ross Burton +Josselin Mouette =cut