~ubuntu-installer/ubiquity/trunk

« back to all changes in this revision

Viewing changes to ubiquity/gsettings.py

  • Committer: Iain Lane
  • Date: 2018-04-24 09:55:27 UTC
  • Revision ID: iain.lane@canonical.com-20180424095527-jw8zue7gm162jtax
Keep the XDG_RUNTIME_DIR too

Show diffs side-by-side

added added

removed removed

Lines of Context:
48
48
        user = os.getenv("SUDO_USER", os.getenv("USER", "root"))
49
49
 
50
50
    subp = subprocess.Popen(
51
 
        ['sudo', '--preserve-env=DBUS_SESSION_BUS_ADDRESS', '-H', '-u', user,
52
 
         'gsettings', 'get', schema, key],
 
51
        ['sudo', '--preserve-env=DBUS_SESSION_BUS_ADDRESS,XDG_RUNTIME_DIR',
 
52
         '-H', '-u', user, 'gsettings', 'get', schema, key],
53
53
        stdout=subprocess.PIPE, stderr=subprocess.PIPE,
54
54
        preexec_fn=misc.drop_all_privileges, universal_newlines=True)
55
55
    value = subp.communicate()[0].rstrip('\n')
104
104
        value = "true" if value else "false"
105
105
 
106
106
    subprocess.call(
107
 
        ['sudo', '--preserve-env=DBUS_SESSION_BUS_ADDRESS', '-H', '-u', user,
108
 
         'gsettings', 'set', schema, key, str(value)],
 
107
        ['sudo', '--preserve-env=DBUS_SESSION_BUS_ADDRESS,XDG_RUNTIME_DIR',
 
108
         '-H', '-u', user, 'gsettings', 'set', schema, key, str(value)],
109
109
        preexec_fn=misc.drop_all_privileges)
110
110
 
111
111
 
125
125
        user = os.getenv("SUDO_USER", os.getenv("USER", "root"))
126
126
 
127
127
    subprocess.call(
128
 
        ['sudo', '--preserve-env=DBUS_SESSION_BUS_ADDRESS', '-H', '-u', user,
129
 
         'gsettings', 'reset', schema, key],
 
128
        ['sudo', '--preserve-env=DBUS_SESSION_BUS_ADDRESS,XDG_RUNTIME_DIR',
 
129
         '-H', '-u', user, 'gsettings', 'reset', schema, key],
130
130
        preexec_fn=misc.drop_all_privileges)