diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2006-04-12 20:57:31 +0200 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2006-04-12 20:57:31 +0200 |
| commit | 3dbbb375ff7a77872ae811d9cef31b55d082077a (patch) | |
| tree | f8bee98990b38a107245da38e69e462484dbd096 | |
| parent | cc818961d3cae94e1240bf33b2349381aa1750fc (diff) | |
| download | python-apt-3dbbb375ff7a77872ae811d9cef31b55d082077a.tar.gz | |
* update the adept-periodic-config file as well
| -rw-r--r-- | SoftwareProperties/SoftwareProperties.py | 48 |
1 files changed, 23 insertions, 25 deletions
diff --git a/SoftwareProperties/SoftwareProperties.py b/SoftwareProperties/SoftwareProperties.py index 296c71dc..aa3114f0 100644 --- a/SoftwareProperties/SoftwareProperties.py +++ b/SoftwareProperties/SoftwareProperties.py @@ -317,31 +317,29 @@ 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") - - # 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) - - # append the updated keys - for i in cnf.List(): - f.write("APT::Periodic::%s \"%s\";\n" % (i, cnf.FindI(i))) - f.close() + # 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"]: + + # read the old content first + content = [] + if os.path.isfile(periodic): + content = open(periodic, "r").readlines() + cnf = apt_pkg.Config.SubTree("APT::Periodic") + + # then write a new file without the updated keys + f = open(periodic, "w") + for line in content: + for key in cnf.List(): + if line.find("APT::Periodic::%s" % (key)) >= 0: + break + else: + f.write(line) + + # and append the updated keys + for i in cnf.List(): + f.write("APT::Periodic::%s \"%s\";\n" % (i, cnf.FindI(i))) + f.close() def save_sourceslist(self): #location = "/etc/apt/sources.list" |
