Definitions

Functional Design Ideas

Implementation Ideas

Let apt take up the task, see http://wiki.debian.org/AptMedium for a proof-of-concept.

The host and the target

Only profile creation and the actual installation will be done in the the target machine. Everything else like dependency calculation and the downloading of packages will be done on the host side. (Thin target, fat host)

The software requirements of both the host & the target will be minimal. We will assume that both have ubuntu-desktop & python-apt installed. [pitti: This should be python-gtk2 and python-apt, right?]

Profile Creation

The profile of a given target machine will contain two files, the /var/lib/dpkg/status & /etc/apt/sources.list. Any other source except http or ftp in the sources.list file will be ignored by the tool. The status file copied from the target may be optimised for size by dropping a few fields if possible.

Dependency Resolution

The package dependency of the target machine can be resolved by using the /var/lib/dpkg/status file contained in the target system profile. This can be done automatically from within python-apt by using

apt_pkg.Config.Set("Dir::Etc::Status","/path/to/target/var/lib/dpkg/status")

Updating packages list in the target

One issue is that of updating the packages list on the target machine. There may be two scenarios to this ---

Some python-apt examples

If we copy the targets /var/lib/dpkg/status (or the relevant parts of it, stripping descriptions etc) we can use python-apt to do most of the work. Here is some example code (warning, not tested) what can be done:

import apt
import apt_pkg

# setup some dirs
apt_pkg.Config.Set("Dir::Etc::Status","/path/to/targets/var/lib/dpkg/status")
apt_pkg.Config.Set("Dir::Etc::Sourceslist","/path/to/generated-for-the-target/e\tc/apt/sources.list")
apt_pkg.Config.Set("Dir::State","/path/to/for/profile/var/lib/apt")
apt_pkg.Config.Set("Dir::Cache::archives","/path/to/the/dir/of/the/packages")

# get a cache based on those information
cache = apt.Cache()

# do some work
cache["3dchess"].markInstall()

# FIXME: make this downloadArchives() without the cruft of fetcher,pm
fetcher = apt_pkg.GetFetcher()
pm = apt_pkg.GetPackageManager()
cache._fetchArchives(fetcher, pm)

# done, copy the stuff from
# "/path/to/the/dir/of/the/packages" to the users "zip","cdrw", whatever

OfflineUpdateSpec/DesignDiscussion (last edited 2008-08-06 16:22:17 by localhost)