]> git.pld-linux.org Git - packages/dss.git/commitdiff
- add initscript
authorElan Ruusamäe <glen@pld-linux.org>
Sun, 1 Aug 2010 14:11:43 +0000 (14:11 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    dss.init -> 1.1
    dss.spec -> 1.6

dss.init [new file with mode: 0644]
dss.spec

diff --git a/dss.init b/dss.init
new file mode 100644 (file)
index 0000000..e5eb2b0
--- /dev/null
+++ b/dss.init
@@ -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
index 5f0073f237eb6a64e37280ebcda3bc5848e91f22..e5146e7414690638738fe81622d8d0a9a7f604e6 100644 (file)
--- a/dss.spec
+++ b/dss.spec
@@ -1,7 +1,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
@@ -10,7 +10,11 @@ Patch0:              %{name}.patch
 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
@@ -110,7 +114,7 @@ Sample files for the Darwin Streaming Server.
        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 \
@@ -150,9 +154,12 @@ jobs=$(echo %{_smp_mflags} | cut -dj -f2)
 
 %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="\
@@ -171,6 +178,16 @@ rm $RPM_BUILD_ROOT/var/lib/%{name}/readme.txt
 %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
@@ -196,6 +213,7 @@ rm -rf $RPM_BUILD_ROOT
 %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
This page took 0.061921 seconds and 4 git commands to generate.