SOURCES: flixengine.init - cleanups, more pldize - do not depend o...

glen glen at pld-linux.org
Wed Dec 13 19:06:29 CET 2006


Author: glen                         Date: Wed Dec 13 18:06:29 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- cleanups, more pldize
- do not depend on bash

---- Files affected:
SOURCES:
   flixengine.init (1.2 -> 1.3) 

---- Diffs:

================================================================
Index: SOURCES/flixengine.init
diff -u SOURCES/flixengine.init:1.2 SOURCES/flixengine.init:1.3
--- SOURCES/flixengine.init:1.2	Wed Dec 13 17:49:07 2006
+++ SOURCES/flixengine.init	Wed Dec 13 19:06:23 2006
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
 #
 # On2 Technologies Flix Engine init script
 # Website: www.on2.com
@@ -8,62 +8,48 @@
 . /etc/rc.d/init.d/functions
 
 # set some variables
-export PATH=/usr/sbin:/usr/libexec/on2/flixengine:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
-export LD_LIBRARY_PATH=/usr/lib:/usr/lib:/lib:/usr/lib:/usr/local/lib:$LIBRARY_PATH
-export C_INCLUDE_PATH=/usr/include:/usr/include:/usr/local/include:$C_INCLUDE_PATH
-##Specify the mencoder binary for flixd to use when decoding source files.
-##If running flixd from the command line or using su within this script to run
-##it as another user ensure that this environment variable is set. The default
-##install path for mencoder will not be in PATH so without this variable set
-##flixd will be unable to decode source files.
+export PATH=$PATH:/usr/libexec/on2/flixengine
+## Specify the mencoder binary for flixd to use when decoding source files.
+## If running flixd from the command line or using su within this script to run
+## it as another user ensure that this environment variable is set. The default
+## install path for mencoder will not be in PATH so without this variable set
+## flixd will be unable to decode source files.
 export FLIXD_MENCODER=/usr/libexec/on2/flixengine/mencoder
 
-# test for running portmapper
-if ! rpcinfo -p 1>/dev/null 2>&1; then
-	echo "WARNING: portmap does not appear to be running."
-	echo "Flix Engine requires the portmap service to run."
-	if [ -e /etc/rc.d/rc.portmap ];then
-		if [ ! -x /etc/rc.d/rc.portmap ]; then
-			echo "/etc/rc.d/rc.portmap not executable. Try chmod 755 /etc/rc.d/rc.portmap"
-			echo "and then run /etc/rc.d/rc.portmap"
-			exit
-		fi
-	fi
-	sysvstart=`ls /etc/rc3.d/*portmap 2>/dev/null`
-	if [ "$sysvstart" != "" ]; then
-		echo "Found $sysvstart."
-		echo "This needs to be setup to execute on startup."
-		exit
-	fi
+AUTHDIR=/var/lib/on2
 
-	echo "If portmap is not installed you must install it first.  See your distro documentation."
-	exit
-fi
-
-fstart(){
-	/usr/sbin/flixd --authdir=/home/glen/.on2 --pidfile /usr/var/run/flixd.pid
-	if [ "$?" = "0" ]; then
-		echo "Started Flix Engine."
-		return 0
-	else
-		echo "Problem starting Flix Engine."
-		return 1
+check_portmap() {
+	if [ ! -f /var/lock/subsys/portmap ]; then
+		echo >&2 "ERROR: portmap does not appear to be running."
+		echo >&2 "Flix Engine requires the portmap service to run."
+		exit 1
 	fi
+	# test for running portmapper
 }
 
-fstop(){
-	if [ ! -e /usr/var/run/flixd.pid ]; then
-		echo "PID file /usr/var/run/flixd.pid not found."
-		if [ "$1" = "restart" ]; then
-			echo "Still attempting to restart service."
+start(){
+	# Check if the service is already running?
+	if [ ! -f /var/lock/subsys/flixd ]; then
+		check_portmap
+		msg_starting "Flix Engine"
+		/usr/sbin/flixd --authdir=$AUTHDIR --pidfile /var/run/flixd.pid
+		RETVAL=$?
+		if [ $RETVAL = 0 ]; then
+			ok
 		else
-			exit
+			fail
 		fi
 	else
-		kill `cat /usr/var/run/flixd.pid`
-		if [ "$?" = "0" ]; the
-			echo "Stopped Flix Engine"
-		fi
+		msg_already_running "Flix Engine"
+	fi
+}
+
+stop() {
+	# Stop daemons.
+	if [ -f /var/lock/subsys/flixd ]; then
+		killproc --pidfile flixd.pid flixd
+	else
+		msg_not_running "Flix Engine"
 	fi
 }
 
@@ -71,15 +57,15 @@
 # See how we were called.
 case "$1" in
 start)
-	fstart
+	start
 	;;
 stop)
-	fstop
+	stop
 	;;
 restart)
-	fstop
+	stop
 	sleep 1
-	fstart
+	start
 	;;
 *)
 	msg_usage "$0 {start|stop|restart}"
================================================================

---- CVS-web:
    http://cvs.pld-linux.org/SOURCES/flixengine.init?r1=1.2&r2=1.3&f=u



More information about the pld-cvs-commit mailing list