Setting gconf/dconf keys in kickstart

Hugh Brown hbrown at divms.uiowa.edu
Tue Aug 2 14:40:29 UTC 2011



On 08/02/2011 09:15 AM, Patrick Lists wrote:
> Hi,
>
> Not sure if this is considered OT. If so my apologies.
>
> I had a nicely working kickstart setup for rolling out F14 to my laptop.
> Even setting gconf keys worked (after many late nights fighting with
> it). Setting those gconf keys no longer works with F15. Does anyone have
> any snippets where they use gconf & dconf to tweak some GNOME 3 desktop
> settings?
>
> For example, here are some snippets from the kickstart file in the %post
> section that do not work:
>
> # Show weekdays in the calendar
> gsettings set org.gnome.shell.calendar show-weekdate true
>
> # Show the date in the panel
> gsettings set org.gnome.shell.clock show-date true
>
> # Enable min,max,close buttons
> gconftool-2 --direct --config-source
> xml:readwrite:/etc/gconf/gconf.xml.defaults --set
> "/desktop/gnome/shell/windows/button_layout" --type string
> ":minimize,maximize,close"
>
> After the kickstart install has finished and I log in, none of these
> settings are active. But when I issue those commands manually as user
> patrick they have the desired result (only for that user).
>
> What am I doing wrong? How can I set those keys in %post, preferably for
> all users?
>
> Thanks!
> Patrick


I've done similar things in a script that gets called from %post and 
they were successfully set.

One difference is that these were made to the mandatory tree instead of 
defaults, though I don't think that should make a difference. The script 
follows.

Hugh

GCONFTOOL="gconftool-2 --direct 
--config-source=xml:readwrite:/etc/gconf/gconf.xml.mandatory"

# add the minimize/maximize buttons to windows
$GCONFTOOL -t string --set /desktop/gnome/shell/windows/button_layout 
":minimize,maximize,close"

# disable user_switch
$GCONFTOOL -t bool --set /desktop/gnome/lockdown/disable_user_switching true

# if regular users can't read these keys, it doesn't work
find /etc/gconf/gconf.xml.mandatory -type d -exec chmod 755 {} \;
find /etc/gconf/gconf.xml.mandatory -type f -exec chmod 644 {} \;

# create an area for our dconf configuration
cat >/etc/dconf/profile/user <<EOF
user
local
EOF

# w/o the locks dir, dconf update gets cranky
# the local.d is a standin for the missing "local" db since there don't
# seem to be any ready made tools for creating these binary dbs
[ ! -d /etc/dconf/db/local.d/locks ] && mkdir -p /etc/dconf/db/local.d/locks

cat >/etc/dconf/db/local.d/foo <<EOF
[org.gnome.shell.clock]
show-date = true

[org.gnome.desktop.session]
session-name = gnome-fallback

[org/gnome/desktop/lockdown]
disable-user-switching = true

[org/gnome/desktop/background]
show-desktop-icons = true

[org/gnome/desktop/thumbnail-cache]
# days
maximum-age = 30
# mb
maximum-size = 32
EOF

chmod 644 /etc/dconf/db/local.d/foo

/usr/bin/dconf update

chmod 644 /etc/dconf/db/local




More information about the Kickstart-list mailing list