tag 688665 + patch
thanks
Hi,
Please find attached here a patch for this.
The systemd service is not using the /etc/default/anacron to control
whether anacron should run on battery as I'm using the native way to
detect this (ConditionACPower=true). I've added a comment in the
README.Debian file to explain how to override this.
Tell me what you think.
Cheers
Laurent Bigonville
diff -Nru anacron-2.3/debian/anacron.service anacron-2.3/debian/anacron.service
--- anacron-2.3/debian/anacron.service 1970-01-01 01:00:00.000000000 +0100
+++ anacron-2.3/debian/anacron.service 2013-11-26 14:29:39.000000000 +0100
@@ -0,0 +1,11 @@
+[Unit]
+Description=Run anacron jobs
+After=remote-fs.target time-sync.target
+ConditionACPower=true
+
+[Service]
+Type=oneshot
+ExecStart=/usr/sbin/anacron -s
+
+[Install]
+WantedBy=multi-user.target
diff -Nru anacron-2.3/debian/control anacron-2.3/debian/control
--- anacron-2.3/debian/control 2012-05-21 21:11:15.000000000 +0200
+++ anacron-2.3/debian/control 2013-11-26 14:30:26.000000000 +0100
@@ -1,7 +1,7 @@
Source: anacron
Section: admin
Priority: optional
-Build-Depends: debhelper (>= 9.20120410)
+Build-Depends: debhelper (>= 9.20120410), dh-systemd (>= 1.5)
Maintainer: Peter Eisentraut <[email protected]>
Uploaders: Antonio Radici <[email protected]>
Standards-Version: 3.9.3
diff -Nru anacron-2.3/debian/README.debian anacron-2.3/debian/README.debian
--- anacron-2.3/debian/README.debian 2012-03-21 19:32:11.000000000 +0100
+++ anacron-2.3/debian/README.debian 2013-11-26 15:00:21.000000000 +0100
@@ -14,3 +14,6 @@
By default, anacron does not run while on battery power. See
/etc/default/anacron to change that.
+If you are using systemd and want to change this behaviour, you should copy
+/lib/systemd/system/anacron.service to /etc/systemd/system/anacron.service and
+remove or comment the "ConditionACPower=true" line.
diff -Nru anacron-2.3/debian/rules anacron-2.3/debian/rules
--- anacron-2.3/debian/rules 2012-05-21 20:48:57.000000000 +0200
+++ anacron-2.3/debian/rules 2013-11-26 14:31:15.000000000 +0100
@@ -3,7 +3,7 @@
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
%:
- dh $@
+ dh $@ --with systemd
override_dh_auto_install:
$(MAKE) install PREFIX=debian/anacron MANDIR=debian/anacron/usr/share/man
@@ -18,3 +18,6 @@
override_dh_installinit:
dh_installinit --no-start -u"start 89 2 3 4 5 ."
+
+override_dh_systemd_start:
+ dh_systemd_start --no-start