SOURCES: rc-scripts-initng.patch (NEW) - implement start, stop, rest...

glen glen at pld-linux.org
Wed Mar 15 13:57:10 CET 2006


Author: glen                         Date: Wed Mar 15 12:57:10 2006 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- implement start,stop,restart via ngc if initng is running

---- Files affected:
SOURCES:
   rc-scripts-initng.patch (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/rc-scripts-initng.patch
diff -u /dev/null SOURCES/rc-scripts-initng.patch:1.1
--- /dev/null	Wed Mar 15 13:57:10 2006
+++ SOURCES/rc-scripts-initng.patch	Wed Mar 15 13:57:05 2006
@@ -0,0 +1,54 @@
+--- service	2006-02-10 21:27:45.000000000 +0200
++++ /sbin/service	2006-03-15 14:55:49.117496239 +0200
+@@ -9,11 +9,13 @@
+ [ service_name [ command | --full-restart ] ]"
+ 
+ SERVICE=
++INITNG=
+ 
+-if [ -d /etc/rc.d/init.d ]; then
+-	SERVICEDIR="/etc/rc.d/init.d"
++if [ -x /sbin/ngc ] && ngc -n > /dev/null; then
++	INITNG=1
++	SERVICEDIR="/etc/initng/daemon"
+ else
+-	SERVICEDIR="/etc/init.d"
++	SERVICEDIR="/etc/rc.d/init.d"
+ fi
+ 
+ if [ $# -eq 0 ]; then
+@@ -65,8 +67,33 @@
+ 	esac
+ done
+ 
+-if [ -x "${SERVICEDIR}/${SERVICE}" ]; then
++if [ -n "$INITNG" -a -f "${SERVICEDIR}/${SERVICE}.i" ]; then
++	OPT=
++	CMD="${OPTIONS# *}"
++	CMD="${CMD% *}"
++	case "${CMD}" in
++	start)
++		OPT=-u
++		;;
++	stop)
++		OPT=-d
++		;;
++	restart)
++		OPT=-r
++		;;
++	'')
++		echo "Usage: service ${SERVICE} {start|stop|restart}" >&2
++		exit 1
++		;;
++	*)
++		echo "${SERVICE}: ${CMD} unhandled by initng" >&2
++		exit 1
++	esac
++	/sbin/ngc $OPT "daemon/${SERVICE}"
++
++elif [ -x "${SERVICEDIR}/${SERVICE}" ]; then
+ 	env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}" ${OPTIONS}
++
+ else
+ 	echo "${SERVICE}: unrecognized service" >&2
+ 	exit 1
================================================================


More information about the pld-cvs-commit mailing list