packages (upstart_native): syslog-ng/syslog-ng.init, syslog-ng/syslog-ng.sp...
jajcus
jajcus at pld-linux.org
Fri May 7 10:25:05 CEST 2010
Author: jajcus Date: Fri May 7 08:25:05 2010 GMT
Module: packages Tag: upstart_native
---- Log message:
- upstart even-based startup support
---- Files affected:
packages/syslog-ng:
syslog-ng.init (1.28 -> 1.28.2.1) , syslog-ng.spec (1.182 -> 1.182.2.1)
---- Diffs:
================================================================
Index: packages/syslog-ng/syslog-ng.init
diff -u packages/syslog-ng/syslog-ng.init:1.28 packages/syslog-ng/syslog-ng.init:1.28.2.1
--- packages/syslog-ng/syslog-ng.init:1.28 Mon Feb 2 08:44:22 2009
+++ packages/syslog-ng/syslog-ng.init Fri May 7 10:25:00 2010
@@ -42,7 +42,9 @@
# Check if the service is already running?
if [ ! -f /var/lock/subsys/syslog-ng ]; then
msg_starting "syslog-ng"
+ emit starting JOB=syslog-ng SERVICE=syslog
daemon /usr/sbin/syslog-ng -f /etc/syslog-ng/syslog-ng.conf $OPTIONS
+ emit started JOB=syslog-ng SERVICE=syslog
RETVAL=$?
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/syslog-ng
else
@@ -53,7 +55,9 @@
stop() {
if [ -f /var/lock/subsys/syslog-ng ]; then
msg_stopping "syslog-ng"
+ emit stopping JOB=syslog-ng SERVICE=syslog
killproc syslog-ng
+ emit stopped JOB=syslog-ng SERVICE=syslog
rm -f /var/lock/subsys/syslog-ng >/dev/null 2>&1
else
msg_not_running "syslog-ng"
@@ -94,6 +98,9 @@
exit 7
fi
}
+
+# configtest handled locally
+upstart_controlled start stop status restart reload force-reload try-restart flush-logs
RETVAL=0
# See how we were called.
================================================================
Index: packages/syslog-ng/syslog-ng.spec
diff -u packages/syslog-ng/syslog-ng.spec:1.182 packages/syslog-ng/syslog-ng.spec:1.182.2.1
--- packages/syslog-ng/syslog-ng.spec:1.182 Sun May 2 18:44:14 2010
+++ packages/syslog-ng/syslog-ng.spec Fri May 7 10:25:00 2010
@@ -11,7 +11,7 @@
Summary(pt_BR.UTF-8): Daemon de log nova geração
Name: syslog-ng
Version: 3.0.5
-Release: 2
+Release: 2.1
License: GPL v2
Group: Daemons
Source0: http://www.balabit.com/downloads/files/syslog-ng/sources/%{version}/source/%{name}_%{version}.tar.gz
@@ -22,6 +22,7 @@
Source4: http://www.balabit.com/dl/guides/%{name}-v3.0-guide-admin-en.pdf
# Source4-md5: 1a801f138a9a2245009ecb617be4338b
Source5: %{name}-simple.conf
+Source6: %{name}.upstart
Patch0: %{name}-link.patch
Patch1: %{name}-datadir.patch
Patch2: %{name}-pyssl.patch
@@ -73,6 +74,23 @@
Conflicts: syslog
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+## to be moved to rpm-build-macros
+## TODO: handle RPM_SKIP_AUTO_RESTART
+
+# migrate from init script to upstart job
+%define upstart_post() \
+ if [ -f /var/lock/subsys/"%1" ] ; then \
+ /sbin/service --no-upstart "%1" stop \
+ /sbin/service "%1" start \
+ fi
+
+# restart the job after upgrade or migrate to init script on removal
+%define upstart_postun() \
+ if [ -x /sbin/initctl ] && /sbin/initctl status "%1" 2>/dev/null | grep -q 'running' ; then \
+ /sbin/initctl stop "%1" 2>/dev/null \
+ [ -f "/etc/rc.d/init.d/%1" -o -f "/etc/init/%1.conf" ] && /sbin/service "%1" start \
+ fi
+
%description
syslog-ng is a syslogd replacement for Unix and Unix-like systems. It
has been tested on Solaris, BSDi and Linux, and were found to run
@@ -95,6 +113,20 @@
por seu conteúdo (usando expressões regulares) e não apenas pelo par
facility/prioridade como o syslog original.
+%package upstart
+Summary: Upstart job description for syslog-ng
+Summary(pl.UTF-8): Opis zadania Upstart dl syslog-ng
+Group: Daemons
+Requires: %{name} = %{version}-%{release}
+Requires: upstart
+Requires: rc-scripts > 0.4.2.8
+
+%description upstart
+Upstart job description for syslog-ng.
+
+%description upstart -l pl.UTF-8
+Opis zadania Upstart dl syslog-ng.
+
%prep
%setup -q
%patch0 -p1
@@ -131,7 +163,7 @@
%install
rm -rf $RPM_BUILD_ROOT
-install -d $RPM_BUILD_ROOT{/etc/{sysconfig,logrotate.d,rc.d/init.d},%{_sysconfdir}/syslog-ng} \
+install -d $RPM_BUILD_ROOT{/etc/{init,sysconfig,logrotate.d,rc.d/init.d},%{_sysconfdir}/syslog-ng} \
$RPM_BUILD_ROOT/var/{log,lib/%{name}}
%{__make} install \
@@ -149,6 +181,8 @@
rm $RPM_BUILD_ROOT%{_bindir}/loggen
+install %{SOURCE6} $RPM_BUILD_ROOT/etc/init/%{name}.conf
+
%clean
rm -rf $RPM_BUILD_ROOT
@@ -162,6 +196,12 @@
/sbin/chkconfig --del syslog-ng
fi
+%post upstart
+%upstart_post %{name}
+
+%postun upstart
+%upstart_postun %{name}
+
%triggerun -- syslog-ng < 3.0
sed -i -e 's#sync(\(.*\))#flush_lines(\1)#g' /etc/syslog-ng/syslog-ng.conf
sed -i -e 's#pipe ("/proc/kmsg"#file ("/proc/kmsg"#g' /etc/syslog-ng/syslog-ng.conf
@@ -192,12 +232,19 @@
%attr(640,root,root) %ghost /var/log/*
+%files upstart
+%defattr(644,root,root,755)
+%config(noreplace) %verify(not md5 mtime size) /etc/init/%{name}.conf
+
%define date %(echo `LC_ALL="C" date +"%a %b %d %Y"`)
%changelog
* %{date} PLD Team <feedback at pld-linux.org>
All persons listed below can be reached at <cvs_login>@pld-linux.org
$Log$
+Revision 1.182.2.1 2010/05/07 08:25:00 jajcus
+- upstart even-based startup support
+
Revision 1.182 2010/05/02 16:44:14 glen
- bump glib2 ver. LP#572862; rel 2
================================================================
---- CVS-web:
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/syslog-ng/syslog-ng.init?r1=1.28&r2=1.28.2.1&f=u
http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/syslog-ng/syslog-ng.spec?r1=1.182&r2=1.182.2.1&f=u
More information about the pld-cvs-commit
mailing list