Browse Source

sde: make `sde` ensure usage of ./run.sh when available

Signed-off-by: Alejandro Mery <amery@geeks.cl>
master
Alejandro Mery 4 years ago
parent
commit
0571bdad8c
1 changed files with 31 additions and 3 deletions
  1. +31
    -3
      bin/sde

+ 31
- 3
bin/sde

@ -39,6 +39,7 @@ readlink -f /bin/sh 2>&1 > /dev/null
if [ "x-x" = "x${1:-}" ]; then
XTRACE=yes
PS4='+${BASH_SOURCE:+$BASH_SOURCE:}$LINENO> '
shift
set -x
else
@ -68,12 +69,39 @@ fi
# switching to the right sde wrapper (SDEROOT specific)
#
if [ "$( readlink -f "$0" )" != "$SDEROOT/bin/sde" ]; then
if [ "$1" = "--loop" ]; then
if [ "--loop" = "${1:-}" ]; then
echo_abort 2 'loop detected, abort.'
fi
set -- ${XTRACE:+-x }--loop "$@"
if [ -x "$SDEROOT/run.sh" ]; then
exec "$SDEROOT/run.sh" sde --run-loop "$@"
else
exec "$SDEROOT/bin/sde" ${XTRACE:+-x }--loop "$@"
exec "$SDEROOT/bin/sde" "$@"
fi
elif [ -x "$SDEROOT/run.sh" ]; then
if [ "yes" = "${SDE_VIA_RUN_SH:-}" ]; then
# good
while [ $# -gt 0 ]; do
case "$1" in
--run-loop|--loop)
;;
*)
break ;;
esac
shift
done
elif [ "--run-loop" = "${1:-}" ]; then
echo_abort 2 'loop detected, abort.'
else
if [ "--loop" = "${1:-}" ]; then
shift
fi
exec "$SDEROOT/run.sh" sde ${XTRACE:+-x }--run-loop "$@"
fi
elif [ "$1" = "--loop" ]; then
elif [ "--loop" = "${1:-}" ]; then
shift
fi

Loading…
Cancel
Save