[packages/logrotate] move cron script to sources instead of patching 95% of the file

glen glen at pld-linux.org
Thu Aug 29 16:27:26 CEST 2013


commit 715253b24a57b96fa9873485d3376ed97a03ce98
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Thu Aug 29 17:25:59 2013 +0300

    move cron script to sources instead of patching 95% of the file

 logrotate-cron.patch | 23 -----------------------
 logrotate.cron       | 18 ++++++++++++++++++
 logrotate.spec       |  7 +++----
 3 files changed, 21 insertions(+), 27 deletions(-)
---
diff --git a/logrotate.spec b/logrotate.spec
index 44ac4a9..e8485ea 100644
--- a/logrotate.spec
+++ b/logrotate.spec
@@ -27,7 +27,7 @@ Source0:	https://fedorahosted.org/releases/l/o/logrotate/%{name}-%{version}.tar.
 # Source0-md5:	cd0082bbd7248e627ec659f2442fcdf9
 Source1:	%{name}.conf
 Source2:	%{name}.sysconfig
-Patch0:		%{name}-cron.patch
+Source3:	%{name}.cron
 Patch1:		%{name}-man.patch
 Patch2:		tabooext.patch
 URL:		https://fedorahosted.org/logrotate/
@@ -111,7 +111,6 @@ Logrotate призначений для полегшення адміністр
 
 %prep
 %setup -q
-%patch0 -p1
 %patch1 -p1
 %patch2 -p1
 
@@ -137,8 +136,8 @@ install -d $RPM_BUILD_ROOT/etc/{cron.daily,logrotate.d,sysconfig} \
 	MANDIR=$RPM_BUILD_ROOT%{_mandir}
 
 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.conf
-cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/logrotate
-install -p examples/logrotate.cron $RPM_BUILD_ROOT/etc/cron.daily/logrotate
+cp -p %{SOURCE2} $RPM_BUILD_ROOT/etc/sysconfig/logrotate
+install -p %{SOURCE3} $RPM_BUILD_ROOT/etc/cron.daily/logrotate
 > $RPM_BUILD_ROOT%{statdir}/logrotate.status
 
 %clean
diff --git a/logrotate-cron.patch b/logrotate-cron.patch
deleted file mode 100644
index 9c98454..0000000
--- a/logrotate-cron.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- logrotate-3.7.9/examples/logrotate.cron~	2010-06-28 11:04:56.000000000 +0300
-+++ logrotate-3.7.9/examples/logrotate.cron	2010-07-12 10:42:34.890404991 +0300
-@@ -1,8 +1,18 @@
- #!/bin/sh
- 
--/usr/sbin/logrotate /etc/logrotate.conf
-+MAILTO=""
-+ARG=""
-+
-+if [ -e /etc/sysconfig/logrotate ]; then
-+	. /etc/sysconfig/logrotate
-+fi
-+
-+/usr/sbin/logrotate $ARG /etc/logrotate.conf
- EXITVALUE=$?
- if [ $EXITVALUE != 0 ]; then
--    /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
-+	/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
-+	if [ -n "$MAILTO" ]; then
-+		echo "ALERT exited abnormally with [$EXITVALUE]" |  mail -s "logrotate exited abnormally" $MAILTO
-+	fi
- fi
- exit 0
diff --git a/logrotate.cron b/logrotate.cron
new file mode 100755
index 0000000..76a7a69
--- /dev/null
+++ b/logrotate.cron
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+MAILTO=""
+ARG=""
+
+if [ -e /etc/sysconfig/logrotate ]; then
+	. /etc/sysconfig/logrotate
+fi
+
+/usr/sbin/logrotate $ARG /etc/logrotate.conf
+EXITVALUE=$?
+if [ $EXITVALUE != 0 ]; then
+	/usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
+	if [ -n "$MAILTO" ]; then
+		echo "ALERT exited abnormally with [$EXITVALUE]" |  mail -s "logrotate exited abnormally" $MAILTO
+	fi
+fi
+exit 0
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/logrotate.git/commitdiff/715253b24a57b96fa9873485d3376ed97a03ce98



More information about the pld-cvs-commit mailing list