From 49ac4006ec43c8a3989192110aeec8c139d80196 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 11 May 2006 17:37:43 +0200 Subject: * SoftwareProperties/SoftwareProperties.py: - create a empty file if no config exists --- SoftwareProperties/SoftwareProperties.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'SoftwareProperties/SoftwareProperties.py') 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): -- cgit v1.2.3