$OpenBSD: patch-scripts_kismet_in,v 1.2 2006/11/01 21:13:20 kili Exp $ # Kill some bashisms (doesn't help much, though). --- scripts/kismet.in.orig Wed Jun 22 06:22:08 2005 +++ scripts/kismet.in Sun Jun 26 12:22:44 2005 @@ -7,8 +7,6 @@ BIN=@bindir@ GREP_OPTIONS="" -set -m - gui=`grep -e "^gui=" ${ETC}/kismet_ui.conf | cut -d= -f2 | tr -d " \t"` piddir=`grep -e "^piddir=" ${ETC}/kismet.conf | cut -d= -f2 | tr -d " \t"` @@ -61,21 +59,18 @@ servpid=$! echo "Waiting for server to start before starting UI..." sleep 4 -kill -0 $servpid 2>/dev/null -if test "$?" != "0" ; then - # Don't print anything here so that users don't get confused, just die and let - # them read the server fatal errors +exit_kismet() { + kill -0 $servpid && echo Killing server... && kill $servpid + echo Kismet exited. +} + +if kill -0 $servpid 2>/dev/null; then + trap exit_kismet EXIT INT TERM +else + # Don't print anything here so that users don't get confused, + # just die and let them read the server fatal errors exit 1 fi echo "Starting UI..." ${BIN}/kismet_client $client - -if test "$?" != "5"; then - echo "Killing server..." - kill $servpid - wait %- -fi - -echo "Kismet exited." -