Use different variables for echo command for notes and errors, $ECHO_NOTE and $ECHO_ERROR instead of just $ECHO as before, but use the same defaults. If file $UPSTART_JOB_CONF (here /etc/upstart-job.conf) exists, source it so the variables can be overridden if desired. --- upstart-0.6.5.orig/debian/upstart-job +++ upstart-0.6.5/debian/upstart-job @@ -5,6 +5,8 @@ set -e +UPSTART_JOB_CONF="/etc/upstart-job.conf" + INITSCRIPT="$(basename "$0")" JOB="${INITSCRIPT%.sh}" @@ -27,27 +29,32 @@ COMMAND="$1" shift - if [ -z "$DPKG_MAINTSCRIPT_PACKAGE" ]; then - ECHO=echo + ECHO_NOTE=echo + ECHO_ERROR=echo else - ECHO=: + ECHO_NOTE=: + ECHO_ERROR=: +fi + +if [ -e "$UPSTART_JOB_CONF" ]; then + . "$UPSTART_JOB_CONF" fi -$ECHO "Rather than invoking init scripts through /etc/init.d, use the service(8)" -$ECHO "utility, e.g. service $INITSCRIPT $COMMAND" +$ECHO_NOTE "Rather than invoking init scripts through /etc/init.d, use the service(8)" +$ECHO_NOTE "utility, e.g. service $INITSCRIPT $COMMAND" case $COMMAND in status) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" + $ECHO_NOTE + $ECHO_NOTE "Since the script you are attempting to invoke has been converted to an" + $ECHO_NOTE "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" $COMMAND "$JOB" ;; start|stop|restart) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" + $ECHO_NOTE + $ECHO_NOTE "Since the script you are attempting to invoke has been converted to an" + $ECHO_NOTE "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" PID=$(status "$JOB" 2>/dev/null | awk '/[0-9]$/ { print $NF }') if [ -z "$PID" ] && [ "$COMMAND" = "stop" ]; then exit 0 @@ -60,14 +67,14 @@ $COMMAND "$JOB" ;; reload|force-reload) - $ECHO - $ECHO "Since the script you are attempting to invoke has been converted to an" - $ECHO "Upstart job, you may also use the $COMMAND(8) utility, e.g. $COMMAND $JOB" + $ECHO_NOTE + $ECHO_NOTE "Since the script you are attempting to invoke has been converted to an" + $ECHO_NOTE "Upstart job, you may also use the reload(8) utility, e.g. reload $JOB" reload "$JOB" ;; *) - $ECHO - $ECHO "The script you are attempting to invoke has been converted to an Upstart" 1>&2 - $ECHO "job, but $COMMAND is not supported for Upstart jobs." 1>&2 + $ECHO_ERROR + $ECHO_ERROR "The script you are attempting to invoke has been converted to an Upstart" 1>&2 + $ECHO_ERROR "job, but $COMMAND is not supported for Upstart jobs." 1>&2 exit 1 esac