Control: tags -1 + patch

On Sat, Aug 08, 2015 at 09:41:57AM +0200, Harald Dunkel wrote:
> Package: apt-cacher-ng
> Version: 0.8.5-1
> 
> Obviously apt-cacher-ng depends upon systemd without telling. For a
> few days I got
> 
>       /etc/cron.daily/apt-cacher-ng:
>       /etc/cron.daily/apt-cacher-ng: line 14: systemctl: command not found
> 
> per EMail.

The attached patch fixes this by adding a check so that systemctl is
only used if it's installed.

Cheers,
Dominic.
>From ff18a96d80abb1e1e14250b20bfcfc3003558e1a Mon Sep 17 00:00:00 2001
From: Dominic Hargreaves <d...@earth.li>
Date: Sat, 5 Sep 2015 11:02:58 +0100
Subject: [PATCH] Only call systemctl if it is available

---
 debian/apt-cacher-ng.cron.daily | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/debian/apt-cacher-ng.cron.daily b/debian/apt-cacher-ng.cron.daily
index 423ce8b..339260c 100644
--- a/debian/apt-cacher-ng.cron.daily
+++ b/debian/apt-cacher-ng.cron.daily
@@ -11,7 +11,7 @@
 # export ACNGIP
 
 # make sure that the service runs on localhost
-if systemctl -q is-active apt-cacher-ng || test -e /var/run/apt-cacher-ng/pid ; then
+if (which systemctl > /dev/null && systemctl -q is-active apt-cacher-ng) || test -e /var/run/apt-cacher-ng/pid ; then
    if test -r /usr/lib/apt-cacher-ng/expire-caller.pl ; then
       perl /usr/lib/apt-cacher-ng/expire-caller.pl || echo Please check error messages in one of: $(ls -t /var/log/apt-cacher-ng/maint*.log.html | head -n5)
    fi
-- 
2.5.0

Reply via email to