I need to automate desktop configuration via Puppet, virtual terminal or ssh.
Unfortunately, invocation of gsettings
via ssh or virtual terminal gives:
gsettings set org.compiz.core:/org/compiz/profiles/unity/plugins/core/ hsize "4"
(process:29520): dconf-WARNING **: failed to commit changes to dconf: Cannot autolaunch D-Bus without X11 $DISPLAY
When I set the $DISPLAY
with export DISPLAY=:0.0
it gives another error:
(process:29862): dconf-WARNING **: failed to commit changes to dconf: Could not connect: Connection refused
What can I do?
The key is to set the
DBUS_SESSION_BUS_ADDRESS
environment variable.On this thread I found the following script, that helps to get the correct value of that variable. It requires name of the process, that is running on the desktop, on which we want to change the dbus settings. (There can be more than 1 running graphical sessions in parallel). Lets call it
discover_session_bus_address.sh
With this script we can do the following, assuming that
unity
process is running on the desktop, on which we want to apply our settings:And things should work OK.
I have a POST-Install script that sets my gsetting. Because I run the script as sudo the EUID is 0, there fore I have to find the $RUID (Real User ID).
here is my approach: