~ubuntu-branches/ubuntu/precise/unattended-upgrades/precise

« back to all changes in this revision

Viewing changes to unattended-upgrade

  • Committer: Bazaar Package Importer
  • Author(s): Michael Vogt
  • Date: 2006-05-10 20:20:54 UTC
  • Revision ID: james.westby@ubuntu.com-20060510202054-5ox9ddmt3m1k9t78
Tags: 0.1ubuntu2
* unattended-upgrade:
  - fix log output (ubuntu: #43773)
  - fix configuration by providing a example config (ubuntu: #43778)

Show diffs side-by-side

added added

removed removed

Lines of Context:
109
109
    #    pass
110
110
    #apt_pkg.Config.Set("Dir::Cache::archives",dldir)
111
111
 
112
 
    # make it possible to ovverride this with a apt.Config variable
113
112
    # format (origin, archive), e.g. ("Ubuntu","dapper-security")
114
 
    allowed_origins = []
 
113
    allowed_origins = map(string.split, apt_pkg.Config.ValueList("Unattended-Upgrade::Allowed-Origins"))
115
114
 
116
115
    # pkgs that are (for some reason) not save to install
117
 
    blacklisted_pkgs = []
 
116
    blacklisted_pkgs = apt_pkg.Config.ValueList("Unattended-Upgrade::Package-Blacklist")
 
117
    logging.info("Initial blacklisted packages: %s", "".join(blacklisted_pkgs))
118
118
 
119
119
    logging.info("Starting unattended upgrades script")
120
120
 
121
 
    # read the distro from lsb_release
122
 
    p = Popen(["/bin/lsb_release","-c","-s"],stdout=PIPE)
123
 
    res = p.wait()
124
 
    if res != 0:
125
 
        log.error("lsb_release returned exitcode: %i " % res)
126
 
    archive = string.strip(p.stdout.readline())
127
 
    p = Popen(["/bin/lsb_release","-i","-s"],stdout=PIPE)
128
 
    res = p.wait()
129
 
    if res != 0:
130
 
        log.error("lsb_release returned exitcode: %i " % res)
131
 
    distributor = string.strip(p.stdout.readline())
132
 
 
133
 
    allowed_origins.append((distributor,"%s-security" % archive))
134
121
    # display available origin
135
 
    origins = ""
136
 
    for (origin, archive) in allowed_origins:
137
 
        origins += "(%s,%s) " % (origin, archive)
138
 
    logging.info("Allowed origins are: %s" % origins)
 
122
    logging.info("Allowed origins are: %s" % map(str,allowed_origins))
139
123
    
140
124
    # get a cache
141
125
    cache = MyCache()
144
128
    pkgs_to_upgrade = []
145
129
    for pkg in cache:
146
130
        if options.debug and pkg.isUpgradable:
147
 
            logging.debug("Checking: %s (%s)" % (pkg.name,pkg.candidateOrigin.archive))
 
131
            logging.debug("Checking: %s (%s)" % (pkg.name,map(str, pkg.candidateOrigin)))
148
132
        if pkg.isUpgradable and \
149
133
               is_allowed_origin(pkg,allowed_origins):
150
134
            try: