On Thu, Jun 17, 2004 at 02:04:52PM +0200, Thomas Hood wrote: > Don't try to control the exit status with an environment variable. > Let the initscript return a nonzero status. If you need to ignore > the status (because you have "set -e") then append '|| :' to the > line that returns the error status.
You got me a little wrong. This is what I want to do, but I do not want the initscript to return a nonzero status all the time. An error status code returned by the init script is a very nice feature e.g. if an admin starts the script manually he might want to check the status code. Making it return a nonzero status code all the time is a bad idea because of this. However - my problem is that the start of the daemon might fail (because a video device is not attached e.g.) during postinst. This failure should not break the postinst but simply display a message or similar. So I put the following into the start segment of the init script: if [ "$RUNNING_IN_POSTINST" = "1" ]; then start-stop-daemon --start --quiet --chuid camsource:video \ --exec $DAEMON || \ echo "Please make sure that a video device exists or"\ "configure camsource to use a different source." else start-stop-daemon --start --quiet --chuid camsource:video \ --exec $DAEMON fi $RUNNING_IN_POSTINST is set in postinst then and will start the daemon, but return a non-error status code and print a message. The problem then will not break postinst. If $RUNNING_IN_POSTINST is not set - the daemon gets started as it should be and returns the correct error code. My question is just if there is a variable I can check that already exists in contrast to creating my own $RUNNING_IN_POSTINST. -- Balu