On Sun, 25, Jan, 2009 at 01:43:35PM +0100, Josselin Mouette spoke thus..
> I think this would only be of interest for files shipped in a package,
> so that they can be shipped on several machines. Therefore, there needs
> to be debhelper integration as well for such settings.
Would something like the attached do?
> If you only want to set mandatory settings for one machine, you can
> simply use gconftool or gconf-editor as root, so there’s no need to
> write the XML by hand.
Yeah, but we've found for batches of machines it's much easier to handle
using the update-gconf-defaults method along with the desktop package we
ship around anyways.
Cheers,
Mark
--
Mark Hymers <mhy at debian dot org>
"I never make predictions. I never have and I never will."
Tony Blair
diff -Naur debhelper-7.0.17/autoscripts/postinst-gconf-mandatory debhelper-7.0.17-gconf/autoscripts/postinst-gconf-mandatory
--- debhelper-7.0.17/autoscripts/postinst-gconf-mandatory 1970-01-01 01:00:00.000000000 +0100
+++ debhelper-7.0.17-gconf/autoscripts/postinst-gconf-mandatory 2009-01-25 14:48:15.000000000 +0000
@@ -0,0 +1,3 @@
+if [ "$1" = "configure" ] && which update-gconf-defaults >/dev/null 2>&1; then
+ update-gconf-defaults --mandatory
+fi
diff -Naur debhelper-7.0.17/autoscripts/postrm-gconf-mandatory debhelper-7.0.17-gconf/autoscripts/postrm-gconf-mandatory
--- debhelper-7.0.17/autoscripts/postrm-gconf-mandatory 1970-01-01 01:00:00.000000000 +0100
+++ debhelper-7.0.17-gconf/autoscripts/postrm-gconf-mandatory 2009-01-25 14:48:15.000000000 +0000
@@ -0,0 +1,3 @@
+if which update-gconf-defaults >/dev/null 2>&1; then
+ update-gconf-defaults --mandatory
+fi
diff -Naur debhelper-7.0.17/dh_gconf debhelper-7.0.17-gconf/dh_gconf
--- debhelper-7.0.17/dh_gconf 2008-07-31 17:27:07.000000000 +0100
+++ debhelper-7.0.17-gconf/dh_gconf 2009-01-25 14:51:51.000000000 +0000
@@ -27,6 +27,11 @@
directory, with "package" replaced by the package name. Some postinst and
postrm fragments will be generated to launch update-gconf-defaults.
+If a file named debian/package.gconf-mandatory exists, then it is installed
+into usr/share/gconf/mandatory/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 with the --mandatory option.
+
The gconf-schemas and update-gconf-defaults scripts are provided by the
gconf2 package. An appropriate dependency will be generated in
${misc:Depends}.
@@ -58,12 +63,30 @@
my $gconf_dep = 0;
my $defaults = pkgfile($package,"gconf-defaults");
+ my $version = undef;
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)");
+ # This version handles defaults
+ $version = '2.12.1-1';
+ }
+
+ my $mandatory = pkgfile($package,"gconf-mandatory");
+ if ($mandatory ne '') {
+ doit("mkdir","-p","$tmp/usr/share/gconf/mandatory");
+ doit("install","-p","-m644",$defaults,"$tmp/usr/share/gconf/mandatory/${priority}_$package");
+ autoscript($package,"postinst","postinst-gconf-mandatory");
+ autoscript($package,"postrm","postrm-gconf-mandatory");
+ # TODO: Change to the first version of gconf which supports the
+ # --mandatory flag (which will be higher than the one for
+ # defaults, meaning the dep is always correct)
+ $version = '2.12.1-1';
+ }
+
+ if ($version) {
+ addsubstvar($package, "misc:Depends", "gconf2 (>= $version)");
$gconf_dep = 1;
}