From d7093cd4e9873a637da1ea81facad09c2d735879 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 5 Jan 2006 12:38:07 +0100 Subject: * fix a indention that lead to absurdly large file in /etc/apt/apt.conf.d/10periodic --- SoftwareProperties/SoftwareProperties.py | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'SoftwareProperties') diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index db9e3e26..3572e8e8 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -64,7 +64,7 @@ class SoftwareProperties(SimpleGladeApp): SimpleGladeApp.__init__(self, datadir+"glade/SoftwareProperties.glade", None, domain="update-manager") self.modified = False - + self.gnome_program = gnome.init("Software Properties", "0.41") self.gconfclient = gconf.client_get_default() @@ -156,25 +156,28 @@ class SoftwareProperties(SimpleGladeApp): self.write_config() def write_config(self): + #print "write_config()" periodic = "/etc/apt/apt.conf.d/10periodic" - + + # read the old content content = [] - if os.path.isfile(periodic): content = open(periodic, "r").readlines() - - cnf = apt_pkg.Config.SubTree("APT::Periodic") - f = open(periodic, "w+") + cnf = apt_pkg.Config.SubTree("APT::Periodic") + + # write a new file without the updated keys + f = open(periodic, "w") for line in content: found = False for key in cnf.List(): if line.find("APT::Periodic::%s" % (key)) >= 0: found = True break - if not found: - f.write(line) - + if not found: + f.write(line) + + # append the updated keys for i in cnf.List(): f.write("APT::Periodic::%s \"%s\";\n" % (i, cnf.FindI(i))) f.close() -- cgit v1.2.3