E-mail alert with apticron and apt-listchanges (dietpi specific fi)

Problem

When using apticron together with apt-listchanges to receive package changelogs via email, the changelog section in the apticron mail only shows the usage help of apt-listchanges instead of the actual changelogs:

Package Details:

Verwendung: apt-listchanges [Optionen] {--apt | Dateiname.deb …}

Root Cause

apticron determines the path to the cached .deb files by reading Dir::Cache from the APT configuration and appending /archives/ to it:

bash

eval `/usr/bin/apt-config shell DIRCACHE Dir::Cache`
PKGPATH="/${DIRCACHE}/archives/"

On a standard Debian system Dir::Cache is /var/cache/apt, so PKGPATH correctly becomes /var/cache/apt/archives/.

However, DietPi sets Dir::Cache to /tmp/apt while separately setting Dir::Cache::archives to /var/cache/apt/archives/. This causes apticron to look for .deb files in /tmp/apt/archives/ which does not exist. As a result $DEBS is always empty and apt-listchanges is called without any file arguments, which causes it to print its usage help instead of changelogs.

Solution

Edit /usr/sbin/apticron and change line 66 from:

bash

eval `/usr/bin/apt-config shell DIRCACHE Dir::Cache`

to:

bash

eval `/usr/bin/apt-config shell DIRCACHE Dir::Cache::archives`

And change line 197 from:

bash

PKGPATH="/${DIRCACHE}/archives/"

to:

bash

PKGPATH="/${DIRCACHE}/"

This makes apticron read the correct archive path directly from Dir::Cache::archives instead of constructing it from Dir::Cache.

Note

This is arguably a bug in apticron since it should use Dir::Cache::archives directly instead of assuming the archives directory is always a subdirectory of Dir::Cache. A proper fix would ideally be submitted upstream to the apticron package.