Making offline updates easier

I’ve been messing with the idea of an easy way to get offline updates, or at least to download a package plus its dependencies in an easy fashion.

The scenario is basically this: I have an offline machine at home, and I want to install a package — any package, leafpad will work as an example. However, if I download the package from, I don’t get the requisite dependencies. I have to sort them out manually, track through them and download each in turn.

Aptitude has an outlet for disgorging the dependencies of a package, and if we lean on it a little, we can get even more out of it.

apt-cache depends leafpad | xargs apt-cache depends > leafpad-deps.txt

That spits out a terse list of dependencies for leafpad, then spins them right back around and feeds them through apt-cache again, for the dependencies of the dependencies. In a sense, you get a two-level list of all the dependencies for leafpad, in list form in a neat text file.

You could repeat that more than once, perhaps getting three levels or even four, if you knew your application had a lot of nested requirements. Offhand, and without any practical experience working with these things, it’s hard for me to say what is a reasonable level to stop at. Two? Three?

From there, screen out the warning lines (some of the recommended packages and conflicting packages are listed too) with sort -d and then … use mawk (or gawk?) to add hypertext links to a repository off the packages page. Such as …

(The Utah CS site is usually fast for me.) The result would be an html page with embedded links for each package, dependency and dependency’s dependency. Put that on a USB drive, take it to the library, open it in a browser and right-click to download.

Then take them home and install them manually, with dpkg -i one by one, or dpkg -i * the whole business at one time.

The tricky parts are, of course, that there is a nested subdirectory structure to the repository. You have to know what’s in universe, multiverse, etc., and the proper subfolder for each. So it might put mawk (gawk?) to work, getting the proper hyperlink inserted before each package name.

And then there’s the version number to contend with; there might be a way to get the full version number out of apt, but unless it has synced with the repositories, you won’t know the full version extension on your home machine, where the list is put together.

If you have any ideas about this, please share. I’ll tinker with it some more, when I’m not playing Warzone 2100, and see what I come up with.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s