LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   apt-proxy and cron-apt - download once for the whole LAN (http://www.linuxquestions.org/questions/debian-26/apt-proxy-and-cron-apt-download-once-for-the-whole-lan-195682/)

Abject 06-20-2004 02:39 PM

apt-proxy and cron-apt - download once for the whole LAN
 
First, a long story about how I got here, since there is no mention of apt-proxy in the forum.
First reply is my question for you cron and bash experts.

I have 2 desktops, a laptop and a server all running mixed sarge/sid on my home LAN, behind a 384/128 DSL connection. Of course, doing apt-get update / apt-get upgrade makes all 4 of them gobble up bandwidth and, because I'm too nervous to apt-get clean the old ones (just in case...) I end up with 4 copies of every package ever downloadedl

I thought: There's got to be a better way! and there is!

I looked at building a local mirror and rsyncing, etc., but this path looks to be complex and error-prone. Bleh.

apt-proxy is a dandy little package, available from your local Debian mirror, that allows you to set one node up as the "proxy" for all your apt-getting. This node fetches from a mirror the first time anyone asks for a specific version of a package and keeps a local copy. After that, anytime another node requests that package, the local copy is supplied (at LAN speeds). Way cool. The package includes a script that will convert your carefully hand-crafted sources.list into apt-proxy's equivalent config file.

So, then, being greedy of my limited primetime bandwidth, I started looking for something that would prime the pump for apt-get update / upgrade in the dark of night. As usual, I wasn't the first one to have this problem.

cron-apt (also at your nearby Debian mirror) is a cron job that runs every night (week, hour, 5 minutes, whatever) and, essentially does an apt-get update / upgrade in the background. Just the thing.

Just one problem ... (see my first reply)

Abject 06-20-2004 02:53 PM

how to cron-apt with mixed sarge/sid?
 
I'm sure this is an easy one... just not for me.

cron-apt (out of the box) has 2 "action" files, one for [apt-get] updating and one for downloading - as in
Code:

# apt-get -d -y upgrade
i.e., download-only and answer Yes to all questions.

If you keep a mixed sarge/sid (testing/unstable) environment (like me), then you probably do the three-step apt-get, like so:
Code:

# apt-get update    # update your package lists
# apt-get install `apt-show-versions -u -b | grep unstable` # upgrade the unstable ones first
# apt-get upgrade  # upgrade the testing ones

So, I added that middle line to the 3-download file for cron-apt. But, it doesn't like the substitution of the output from apt-show-versions. The log file says:
Code:

...
CRON-APT ACTION: 3-download, Sun Jun 20 08:28:06 PDT 2004
CRON-APT LINE: install -d -y `apt-show-versions -u -b | grep unstable`, Sun Jun
 20 08:28:05 PDT 2004
Reading Package Lists...
Building Dependency Tree...
E: Couldn't find package `apt-show-versions

SO: What's the right syntax to make the apt-show-versions work in cron?

Thanks!


All times are GMT -5. The time now is 10:12 AM.