In the past I have used a shell script to do this between servers but for the desktop and in particular the mini9 I am now attempting to bring up to speed, I thought I might give python a try.
First I looked a little at urllib2 to see about trial fetching the debs concerned to see if they exist.
Later I read up about python-apt and so the script below is a work in progress that includes a bit of code from both.
#!/usr/bin/python import apt from urllib2 import Request, urlopen, URLError, HTTPError #import urllib2 #http://packages.debian.org/lenny/latex-beamer #http://ftp.uk.debian.org/debian/pool/main/l/latex-beamer/latex-beamer_3.07-1_all.deb #http://ftp.uk.debian.org/debian/pool/main/e/emacs22/emacs22-nox_22.2+2-5_i386.deb #http://packages.ubuntu.com/hardy/latex-beamer # #http://ppa.launchpad.net/dell-team/ubuntu # Dell Inspiron 1525 2008Q2 version #http://dell-mini.archive.canonical.com/ubuntu/ # Dell mini9 2009Q1 ver is 8.04 LTS urlstub_default="http://www.mirrorservice.org/sites/archive.ubuntu.com/ubuntu" urlstub_default="http://archive.ubuntu.com/ubuntu" release_name_lower="intrepid" release_name_lower="hardy" # Dell mini9 2009Q1 version uses 8.04 LTS req = Request(urlstub_default) try: response = urlopen(req) except HTTPError, e: print 'The server failed to fulfill the request.' print 'Error code: ', e.code except URLError, e: print 'URL problem so we fail to reach the server.' print 'Reason: ', e.reason #else: # response okay all_packages = apt.Cache() installed_packages = [i for i in all_packages if i.isInstalled] upgradable_packages = [i for i in installed_packages if i.isUpgradable] print "Total available packages: %d\n" % len(all_packages) print "Total installed packages: %d\n" % len(installed_packages) for i in upgradable_packages: print (i.name, i.candidateVersion, i.architecture, i.installedPriority)
Hopefully when I get back from the weekend break I can finish this
and bring the mini9 into line.