diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-05-11 17:37:43 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-05-11 17:37:43 +0200 |
| commit | 49ac4006ec43c8a3989192110aeec8c139d80196 (patch) | |
| tree | 961c0d2c35e1a9daf269306e073e955dcb1c2fff /SoftwareProperties/SoftwareProperties.py | |
| parent | bd43d9d7add3430e939cdb28d9a71189ad3cc72d (diff) | |
| download | python-apt-49ac4006ec43c8a3989192110aeec8c139d80196.tar.gz | |
* SoftwareProperties/SoftwareProperties.py:
- create a empty file if no config exists
Diffstat (limited to 'SoftwareProperties/SoftwareProperties.py')
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 8c3e4878..9d041468 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -319,9 +319,19 @@ class SoftwareProperties(SimpleGladeApp): def write_config(self): # update the adept file as well if it is there - for periodic in ["/etc/apt/apt.conf.d/10periodic", - "/etc/apt/apt.conf.d/15adept-periodic-update"]: + conffiles = ["/etc/apt/apt.conf.d/10periodic", + "/etc/apt/apt.conf.d/15adept-periodic-update"] + # check (beforehand) if one exists, if not create one + for f in conffiles: + if os.path.isfile(f): + break + else: + print "No config found, creating one" + open(conffiles[0], "w") + + # now update them + for periodic in conffiles: # read the old content first content = [] if os.path.isfile(periodic): |
