packages: dss/dss.spec, dss/dss.init (NEW) - add initscript

glen glen at pld-linux.org
Sun Aug 1 16:11:49 CEST 2010


Author: glen                         Date: Sun Aug  1 14:11:49 2010 GMT
Module: packages                      Tag: HEAD
---- Log message:
- add initscript

---- Files affected:
packages/dss:
   dss.spec (1.5 -> 1.6) , dss.init (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: packages/dss/dss.spec
diff -u packages/dss/dss.spec:1.5 packages/dss/dss.spec:1.6
--- packages/dss/dss.spec:1.5	Sun Aug  1 15:39:29 2010
+++ packages/dss/dss.spec	Sun Aug  1 16:11:43 2010
@@ -2,7 +2,7 @@
 Summary:	Darwin Streaming Server
 Name:		dss
 Version:	6.0.3
-Release:	0.2
+Release:	0.3
 License:	Apple Public Source License
 Group:		Applications
 Source0:	http://dss.macosforge.org/downloads/DarwinStreamingSrvr%{version}-Source.tar
@@ -11,7 +11,11 @@
 Patch1:		%{name}-x86_64.patch
 Patch2:		optflags.patch
 Patch3:		compile.patch
+Source1:	%{name}.init
 URL:		http://dss.macosforge.org/
+BuildRequires:	rpmbuild(macros) >= 1.228
+Requires(post,preun):	/sbin/chkconfig
+Requires:	rc-scripts
 BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
 
 %description
@@ -111,7 +115,7 @@
 	s|/''usr/local/movies|%{_localstatedir}/lib/%{name}/movies|g
 	s|/''usr/local/sbin/StreamingServerModules|%{_libdir}/%{name}/|g
 	s|/''usr/local/|%{_prefix}/|g
-	s|/etc/streaming|%{_sysconfdir}/%{name}|g
+	s|/''etc/streaming|%{_sysconfdir}/%{name}|g
 	s|/var/streaming/logs/|%{_localstatedir}/log/%{name}/|g
 	s|/var/streaming/|%{_localstatedir}/lib/%{name}/|g
 '	DSS_MakeRoot streamingserver.xml-POSIX \
@@ -151,9 +155,12 @@
 
 %install
 rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT/etc/rc.d/init.d
 ./DSS_MakeRoot \
 	$RPM_BUILD_ROOT
 
+install -p %{SOURCE1} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+
 # Create our default admin user and remove Apple's
 # Default login is root/pld -- please change it!
 qtpasswd="\
@@ -172,6 +179,16 @@
 %clean
 rm -rf $RPM_BUILD_ROOT
 
+%post
+/sbin/chkconfig --add %{name}
+%service %{name} restart
+
+%preun
+if [ "$1" = "0" ]; then
+	%service -q %{name} stop
+	/sbin/chkconfig --del %{name}
+fi
+
 %files
 %defattr(644,root,root,755)
 %doc APPLE_LICENSE ReleaseNotes.txt
@@ -197,6 +214,7 @@
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/streamingloadtool.conf
 %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/streamingserver.xml
 
+%attr(754,root,root) /etc/rc.d/init.d/dss
 %attr(755,root,root) %{_bindir}/MP3Broadcaster
 %attr(755,root,root) %{_bindir}/PlaylistBroadcaster
 %attr(755,root,root) %{_bindir}/StreamingLoadTool
@@ -224,6 +242,9 @@
 All persons listed below can be reached at <cvs_login>@pld-linux.org
 
 $Log$
+Revision 1.6  2010/08/01 14:11:43  glen
+- add initscript
+
 Revision 1.5  2010/08/01 13:39:29  glen
 - installing files
 

================================================================
Index: packages/dss/dss.init
diff -u /dev/null packages/dss/dss.init:1.1
--- /dev/null	Sun Aug  1 16:11:49 2010
+++ packages/dss/dss.init	Sun Aug  1 16:11:43 2010
@@ -0,0 +1,99 @@
+#!/bin/sh
+#
+# dss           Start/Stop MPEG-4 streaming server
+#
+# chkconfig:    345 13 87
+#
+# description:  An MPEG-4 video and audio streaming server. \
+#               Enable this if you wish to run an internet TV station.
+#
+# processname:  DarwinStreamingServer
+# config:
+# pidfile:		DarwinStreamingServer.pid
+#
+# $Id$
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+		msg_network_down "Darwin Streaming Server"
+		exit 1
+	fi
+else
+	exit 0
+fi
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/dss ] && . /etc/sysconfig/dss
+
+start() {
+	# Check if the service is already running?
+	if [ -f /var/lock/subsys/dss ]; then
+		msg_already_running "Darwin Streaming Server"
+		return
+	fi
+
+	msg_starting "Darwin Streaming Server"
+	daemon /usr/sbin/DarwinStreamingServer
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/dss
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/dss ]; then
+		msg_not_running "Darwin Streaming Server"
+		return
+	fi
+
+	# Stop daemons.
+	msg_stopping "Darwin Streaming Server"
+	killproc --pidfile /var/run/DarwinStreamingServer.pid DarwinStreamingServer
+	rm -f /var/lock/subsys/dss
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/dss ]; then
+		msg_not_running "Darwin Streaming Server"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status --pidfile /var/run/DarwinStreamingServer.pid dss DarwinStreamingServer
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/cgi-bin/cvsweb.cgi/packages/dss/dss.spec?r1=1.5&r2=1.6&f=u



More information about the pld-cvs-commit mailing list