diff -Nru sysvinit-2.87dsf/debian/changelog sysvinit-2.87dsf/debian/changelog --- sysvinit-2.87dsf/debian/changelog 2009-09-14 21:29:12.000000000 -0500 +++ sysvinit-2.87dsf/debian/changelog 2009-09-17 10:21:56.000000000 -0500 @@ -1,3 +1,10 @@ +sysvinit (2.87dsf-4ubuntu4) karmic; urgency=low + + * debian/service/service: use upstart for service management, if an + upstart configuration exists, LP: #427277 + + -- Dustin Kirkland Thu, 17 Sep 2009 10:21:05 -0500 + sysvinit (2.87dsf-4ubuntu3) karmic; urgency=low FFE LP: #427356. diff -Nru sysvinit-2.87dsf/debian/service/service sysvinit-2.87dsf/debian/service/service --- sysvinit-2.87dsf/debian/service/service 2009-09-07 13:58:36.000000000 -0500 +++ sysvinit-2.87dsf/debian/service/service 2009-09-17 10:25:49.000000000 -0500 @@ -44,6 +44,7 @@ USAGE="Usage: `basename $0` < option > | --status-all | \ [ service_name [ command | --full-restart ] ]" SERVICE= +ACTION= SERVICEDIR="/etc/init.d" OPTIONS= @@ -104,6 +105,8 @@ fi elif [ -z "${SERVICE}" ]; then SERVICE="${1}" + elif [ -z "${ACTION}" ]; then + ACTION="${1}" else OPTIONS="${OPTIONS} ${1}" fi @@ -112,8 +115,19 @@ esac done +if [ -r "/etc/init/${SERVICE}.conf" ]; then + # Upstart configuration exists for this job + case "${ACTION}" in + start|stop|restart|status) + # Action is a valid upstart action + exec env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" ${ACTION} ${SERVICE} ${OPTIONS} + ;; + esac +fi + +# Otherwise, use the traditional sysvinit if [ -x "${SERVICEDIR}/${SERVICE}" ]; then - env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" ${OPTIONS} + exec env -i LANG="$LANG" PATH="$PATH" TERM="$TERM" "$SERVICEDIR/$SERVICE" ${ACTION} ${OPTIONS} else echo "${SERVICE}: unrecognized service" >&2 exit 1