0.5.2
This commit is contained in:
parent
c7fd990d5c
commit
bbfb1d63f0
@ -5,20 +5,38 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# Support three arguments (this recommend but not required):
|
# Support three arguments (this recommend but not required):
|
||||||
# -f <file> Execute file on host, print the result and exit
|
# -f <file> Execute file on host, print the result and exit
|
||||||
# -c <command> Execute command on host, print the result and exit
|
# -c <command> Execute command on host, print the result and exit
|
||||||
# -v <level> Verbose mode: 1 - verbose, 2 - super verbose
|
# -v <level> Verbose mode: 1 - verbose, 2 - super verbose
|
||||||
|
# -e <NAME=B64> -e ... Environement variables (B64 is base64 encoded string)
|
||||||
#
|
#
|
||||||
while getopts f:c:v: option
|
while getopts f:c:v:e: option
|
||||||
do
|
do
|
||||||
case "${option}"
|
case "${option}"
|
||||||
in
|
in
|
||||||
f) EXECUTE_FILE=${OPTARG};;
|
f) EXECUTE_FILE=${OPTARG};;
|
||||||
c) EXECUTE_COMMAND=${OPTARG};;
|
c) EXECUTE_COMMAND=${OPTARG};;
|
||||||
v) VERBOSE=${OPTARG};;
|
v) VERBOSE=${OPTARG};;
|
||||||
|
e) ENV+=("$OPTARG");;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ $VERBOSE != '' ]]; then
|
||||||
|
export XXH_VERBOSE=$VERBOSE
|
||||||
|
fi
|
||||||
|
|
||||||
|
for env in "${ENV[@]}"; do
|
||||||
|
name="$( cut -d '=' -f 1 <<< "$env" )";
|
||||||
|
val="$( cut -d '=' -f 2- <<< "$env" )";
|
||||||
|
val=`echo $val | base64 -d`
|
||||||
|
|
||||||
|
if [[ $XXH_VERBOSE == '1' ]]; then
|
||||||
|
echo Environment variable "$env": name=$name, value=$val
|
||||||
|
fi
|
||||||
|
|
||||||
|
export $name="$val"
|
||||||
|
done
|
||||||
|
|
||||||
## Example disabling option:
|
## Example disabling option:
|
||||||
#if [[ $EXECUTE_COMMAND ]]; then
|
#if [[ $EXECUTE_COMMAND ]]; then
|
||||||
# echo '<THIS> entrypoint is not support command execution.'
|
# echo '<THIS> entrypoint is not support command execution.'
|
||||||
@ -34,10 +52,6 @@ done
|
|||||||
# EXECUTE_COMMAND=""
|
# EXECUTE_COMMAND=""
|
||||||
#fi
|
#fi
|
||||||
|
|
||||||
if [[ $VERBOSE != '' ]]; then
|
|
||||||
export XXH_VERBOSE=$VERBOSE
|
|
||||||
fi
|
|
||||||
|
|
||||||
## Example of adding argument `-f` before
|
## Example of adding argument `-f` before
|
||||||
#EXECUTE_FILE=`[ $EXECUTE_FILE ] && echo -n "-f $EXECUTE_FILE" || echo -n ""`
|
#EXECUTE_FILE=`[ $EXECUTE_FILE ] && echo -n "-f $EXECUTE_FILE" || echo -n ""`
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user