process the case where the parent can't be find out, i.e. missing ps

This commit is contained in:
George Danchev
2012-04-21 09:44:48 +00:00
parent a30b05dd70
commit 12e3fb0c76
2 changed files with 27 additions and 14 deletions

View File

@ -9,19 +9,31 @@ CLEANUP=1
SPECIFIC_HELP=0
START_DIR_DONT_CHANGE=`pwd`
GEN_DATA_DIR=releng_generated_data/${SELF}
RELENG_STANDALONE=1
RELENG_PARENT=`ps -p $PPID -o comm=`
RELENG_STANDALONE=-1
RELENG_PARENT=unknown_parent
#############################################
standalone_or_supervised() {
if test x"$RELENG_PARENT" = x"run_all_auto"
then
echo "${SELF}: Running Supervised by ${RELENG_PARENT}"
RELENG_STANDALONE=0
else
echo "${SELF}: Running Standalone"
RELENG_STANDALONE=1
fi
which ps >/dev/null 2>&1
ret="$?"
case "$ret" in
0)
RELENG_PARENT=`ps -p $PPID -o comm=`
if test x"$RELENG_PARENT" = x"run_all_auto"
then
echo "${SELF}: Running in Supervised mode by ${RELENG_PARENT}"
RELENG_STANDALONE=0
else
echo "${SELF}: Running in Standalone mode"
RELENG_STANDALONE=1
fi
;;
*)
echo "${SELF}: Running in Unknown mode by ${RELENG_PARENT}"
;;
esac
}
# Unconditionally initialize the invocation mode - standalone or supervised