SPECS: darkice.spec - rel 1 with init script, dropping privs and l...

mmazur mmazur at pld-linux.org
Sat Jan 6 01:26:44 CET 2007


Author: mmazur                       Date: Sat Jan  6 00:26:44 2007 GMT
Module: SPECS                         Tag: HEAD
---- Log message:
- rel 1 with init script, dropping privs and logging

---- Files affected:
SPECS:
   darkice.spec (1.25 -> 1.26) 

---- Diffs:

================================================================
Index: SPECS/darkice.spec
diff -u SPECS/darkice.spec:1.25 SPECS/darkice.spec:1.26
--- SPECS/darkice.spec:1.25	Thu Jan  4 12:17:11 2007
+++ SPECS/darkice.spec	Sat Jan  6 01:26:38 2007
@@ -1,13 +1,19 @@
 # $Revision$, $Date$
+# TODO:
+# - logrotate support?
+# - add /etc/sysconfig/darkice with log level selection and maybe not dropping
+#   privs (so that realtime=yes could work)
+# - or some other way to keep realtime scheduling while not running as root
 Summary:	DarkIce live IceCast / ShoutCast streamer
 Summary(pl):	DarkIce - dostarczyciel strumieni IceCast/ShoutCast
 Name:		darkice
 Version:	0.17.1
-Release:	0.1
+Release:	1
 License:	GPL
 Group:		Networking/Daemons
 Source0:	http://dl.sourceforge.net/darkice/%{name}-%{version}.tar.gz
 # Source0-md5:	91221134cec3d52af842a9d50c06ee7d
+Source1:	%{name}.init
 Patch0:		%{name}-shared.patch
 Patch1:		%{name}-no_libnsl.patch
 Patch2:		%{name}-amd64.patch
@@ -20,6 +26,20 @@
 BuildRequires:	libvorbis-devel >= 1:1.0
 BuildRequires:	pkgconfig
 BuildRequires:	readline-devel
+BuildRequires:  rpmbuild(macros) >= 1.165
+Requires(post,preun):	/sbin/chkconfig
+Requires(postun):	/usr/sbin/groupdel
+Requires(postun):	/usr/sbin/userdel
+Requires(pre):	/bin/id
+Requires(pre):	/usr/bin/getgid
+Requires(pre):	/usr/lib/rpm/user_group.sh
+Requires(pre):	/usr/sbin/groupadd
+Requires(pre):	/usr/sbin/useradd
+Requires(pre):	/usr/sbin/usermod
+Requires:	daemon
+Requires:	rc-scripts
+Provides:	group(darkice)
+Provides:	user(darkice)
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -48,25 +68,56 @@
 %{__automake}
 %configure \
 	--with-lame \
-	--with-vorbis
+	--with-vorbis \
+	--with-alsa \
+	--without-twolame \
+	--without-faac
 
 %{__make}
 
 %install
 rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{/etc/rc.d/init.d,/var/run/darkice,/var/log}
 
 %{__make} install \
 	DESTDIR=$RPM_BUILD_ROOT
 
+install %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/darkice
+touch $RPM_BUILD_ROOT/var/log/darkice.log
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%pre
+%groupadd -g 85 darkice
+%useradd -u 59 -r -d /usr/share/empty -s /bin/false -c "Darkice" -g darkice darkice
+%addusertogroup darkice audio
+
+%post
+/sbin/chkconfig --add darkice
+%service darkice restart "darkice daemon"
+
+%preun
+if [ "$1" = "0" ] ; then
+	%service darkice stop
+	/sbin/chkconfig --del darkice >&2
+fi
+
+%postun
+if [ "$1" = "0" ]; then
+	%userremove darkice
+	%groupremove darkice
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc AUTHORS ChangeLog NEWS README TODO
-%config(noreplace) %attr(600,root,root) %{_sysconfdir}/*.cfg
+%config(noreplace) %attr(640,root,darkice) %{_sysconfdir}/*.cfg
+%attr(754,root,root) /etc/rc.d/init.d/darkice
 %attr(755,root,root) %{_bindir}/*
 %{_mandir}/man?/*
+%dir %attr(775,root,darkice) /var/run/darkice
+%attr(660,root,darkice) /var/log/darkice.log
 
 %define date	%(echo `LC_ALL="C" date +"%a %b %d %Y"`)
 %changelog
@@ -74,6 +125,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.26  2007/01/06 00:26:38  mmazur
+- rel 1 with init script, dropping privs and logging
+
 Revision 1.25  2007/01/04 11:17:11  tommat
 - updated md5sum
 
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SPECS/darkice.spec?r1=1.25&r2=1.26&f=u



More information about the pld-cvs-commit mailing list