~ubuntu-branches/ubuntu/quantal/gconf/quantal

« back to all changes in this revision

Viewing changes to debian/update-gconf-defaults

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2009-04-28 19:26:50 UTC
  • mfrom: (7.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090428192650-kj3uxu5f04h862p0
Tags: 2.26.0-1ubuntu1
* Merge with Debian unstable; remaining Ubuntu changes:
  - debian/default.path: Add /etc/gconf/gconf.xml.system to the search path,
    which is were 8.10 kept some system wide gconf settings. This is
    deprecated, but required for backwards compatibility.
  - 01_xml-gettext-domain.patch: Support calling gettext at runtime, see
    patch header for details.
  - 02_gconf2-pk-default-path.patch: Set Ubuntu location of gconf defaults
    (gconf.xml.system → gconf.xml.defaults). Renamed from
    05_from_vuntz_gconf2-pk-default-path.patch.
* debian/patches/01_xml-gettext-domain.patch: 
  - Include bind_textdomain_codeset calls, to avoid crashes with non-UTF 8
    locales.
  - Use g_intern_string() instead of g_strdup() to save some memory.
  - Thanks to Matthias Clasen for these improvements!
* debian/control.in: Bump gconf-defaults-service conflicts/replaces to
  libgconf2-4 to the Ubuntu version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
# © 2005 Josselin Mouette <joss@debian.org>
5
5
# Licensed under the GNU LGPL, see /usr/share/common-licenses/LGPL-2.1
6
6
 
7
 
 
8
 
defaults_dir = '/usr/share/gconf/defaults'
9
 
outdir = '/var/lib/gconf/debian.defaults'
10
7
treefile = '%gconf-tree.xml'
11
8
 
12
9
import os,tempfile,shutil,sys
13
 
 
14
 
if os.geteuid():
15
 
  sys.stderr.write("%s needs to be run as root.\n"%sys.argv[0])
16
 
  sys.exit(1)
 
10
from optparse import OptionParser
 
11
 
 
12
parser = OptionParser()
 
13
parser.add_option("--source", dest="source_dir", default="/usr/share/gconf/defaults",
 
14
                  help="directory where to find the defaults", metavar="DIR")
 
15
parser.add_option("--destination", dest="dest_dir", default="/var/lib/gconf/debian.defaults",
 
16
                  help="directory where to build the GConf tree", metavar="DIR")
 
17
parser.add_option("--mandatory", action="store_true", default=False, dest="mandatory",
 
18
                  help="select mandatory settings directories")
 
19
parser.add_option("--no-signal", action="store_false", default=True, dest="signal",
 
20
                  help="do not send SIGHUP the running gconfd-2 processes")
 
21
 
 
22
(options, args) = parser.parse_args()
 
23
 
 
24
if options.mandatory:
 
25
    options.source_dir="/usr/share/gconf/mandatory"
 
26
    options.dest_dir="/var/lib/gconf/debian.mandatory"
 
27
 
 
28
if not os.path.isdir(options.source_dir):
 
29
    parser.error("Source directory does not exist.")
 
30
if not os.path.isdir(options.dest_dir):
 
31
    parser.error("Destination directory does not exist.")
 
32
if not os.access(options.source_dir,os.R_OK|os.X_OK):
 
33
    parser.error("Source directory is not readable.")
 
34
if not os.access(options.dest_dir,os.W_OK|os.X_OK):
 
35
    parser.error("Destination directory is not writable.")
17
36
 
18
37
tmp_dir=tempfile.mkdtemp(prefix="gconf-")
19
38
tmp_home=tmp_dir+'/home'
103
122
      gconf_val[l[0]] = l[1]
104
123
 
105
124
 
106
 
defaults_files = os.listdir(defaults_dir)
 
125
defaults_files = os.listdir(options.source_dir)
107
126
defaults_files.sort()
108
127
for f in defaults_files:
109
 
  realname=defaults_dir+'/'+f
110
 
  if f.endswith('.dpkg-tmp'):
111
 
    pass
112
 
  elif f.endswith('.entries'):
 
128
  realname=options.source_dir+'/'+f
 
129
  for ext in ['.dpkg-tmp', '.bak', '.tmp', '~', '.sav', '.save']:
 
130
    if f.endswith(ext):
 
131
      continue
 
132
  if f.endswith('.entries'):
113
133
    if gconf_val:
114
134
      write_and_apply_entries(tmp_file)
115
135
      gconf_val={}
120
140
  write_and_apply_entries(tmp_file)
121
141
 
122
142
try:
123
 
  shutil.copyfile(tmp_gconf+'/'+treefile,outdir+'/'+treefile+'.tmp')
124
 
  os.rename(outdir+'/'+treefile+'.tmp',outdir+'/'+treefile)
 
143
  shutil.copyfile(tmp_gconf+'/'+treefile,options.dest_dir+'/'+treefile+'.tmp')
 
144
  os.rename(options.dest_dir+'/'+treefile+'.tmp',options.dest_dir+'/'+treefile)
125
145
except IOError:
126
146
  # No %gconf-tree.xml file was created.
127
147
  try:
128
 
    os.remove(outdir+'/'+treefile)
 
148
    os.remove(options.dest_dir+'/'+treefile)
129
149
  except OSError:
130
150
    # No existing file
131
151
    pass
132
152
 
133
153
cleanup()
134
154
 
135
 
os.system('kill -s HUP `pidof gconfd-2` >/dev/null 2>&1')
 
155
if options.signal:
 
156
    os.system('kill -s HUP `pidof gconfd-2` >/dev/null 2>&1')