Skip to content

Commit

Permalink
Process arguments in packcheck-safe before passing it to packcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
adithyaov committed May 26, 2021
1 parent c63358c commit 0346615
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions packcheck-safe.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
#!/usr/bin/env bash

PACKCHECK_DIR=$(dirname $0)
PACKCHECK_DIR=$(dirname "$0")
echo "Running ${PACKCHECK_DIR}/packcheck.sh with clean environment and CHECK_ENV on..."
echo "No environment variables are honored, you have to specifiy ALL the"
echo "parameters explicitly on the command line, including PATH."
echo

/usr/bin/env -i CHECK_ENV=y $(dirname $0)/packcheck.sh $*
PACKCHECK_CLI_OPTS_ARR=("$@")
PACKCHECK_CLI_OPTS=""

for i in "${PACKCHECK_CLI_OPTS_ARR[@]}"
do
case $i in
*=*)
key=${1%%=*}
val=${1#*=}
PACKCHECK_CLI_OPTS="$PACKCHECK_CLI_OPTS $key=\"$val\""
shift
;;
*)
PACKCHECK_CLI_OPTS="$PACKCHECK_CLI_OPTS $i"
shift
;;
esac
done

eval "/usr/bin/env -i CHECK_ENV=y $PACKCHECK_DIR/packcheck.sh $PACKCHECK_CLI_OPTS"

0 comments on commit 0346615

Please sign in to comment.