From a1d815b665229fe24511c8bada6a4e3ef6a9ba63 Mon Sep 17 00:00:00 2001 From: Tomas Mraz Date: Tue, 23 Aug 2016 15:33:09 +0200 Subject: [PATCH] query power status directly from kernel --- cronie-1.5.1-power.patch | 21 +++++++++++++++++++++ cronie.spec | 8 +++++++- 2 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 cronie-1.5.1-power.patch diff --git a/cronie-1.5.1-power.patch b/cronie-1.5.1-power.patch new file mode 100644 index 0000000..f2f9776 --- /dev/null +++ b/cronie-1.5.1-power.patch @@ -0,0 +1,21 @@ +diff --git a/contrib/0anacron b/contrib/0anacron +index 7bcb684..72a613d 100644 +--- a/contrib/0anacron ++++ b/contrib/0anacron +@@ -4,14 +4,11 @@ if test -r /var/spool/anacron/cron.daily; then + day=`cat /var/spool/anacron/cron.daily` + fi + if [ `date +%Y%m%d` = "$day" ]; then +- exit 0; ++ exit 0 + fi + + # Do not run jobs when on battery power +-if test -x /usr/bin/on_ac_power; then +- /usr/bin/on_ac_power >/dev/null 2>&1 +- if test $? -eq 1; then ++if [ `cat /sys/class/power_supply/AC/online 2>/dev/null`x = 0x ]; then + exit 0 +- fi + fi + /usr/sbin/anacron -s diff --git a/cronie.spec b/cronie.spec index b2f4ca1..3274b51 100644 --- a/cronie.spec +++ b/cronie.spec @@ -6,12 +6,14 @@ Summary: Cron daemon for executing programs at set times Name: cronie Version: 1.5.1 -Release: 1%{?dist} +Release: 2%{?dist} License: MIT and BSD and ISC and GPLv2+ Group: System Environment/Base URL: https://fedorahosted.org/cronie Source0: https://fedorahosted.org/releases/c/r/cronie/%{name}-%{version}.tar.gz +Patch1: cronie-1.5.1-power.patch + Requires: dailyjobs %if %{with selinux} @@ -75,6 +77,7 @@ extra features. %prep %setup -q +%patch1 -p1 -b .power %build %configure \ @@ -201,6 +204,9 @@ exit 0 %attr(0644,root,root) %config(noreplace) %{_sysconfdir}/cron.d/dailyjobs %changelog +* Tue Aug 23 2016 Tomáš Mráz - 1.5.1-2 +- query power status directly from kernel + * Thu Jun 23 2016 Tomáš Mráz - 1.5.1-1 - new upstream release