1
0
Fork 0

Improve runenv and share script

main
Ambrose Chua 2018-12-09 03:48:55 +08:00
parent 95f029a0c2
commit a931f09dbc
2 changed files with 10 additions and 3 deletions

View File

@ -1,6 +1,7 @@
#!/bin/sh #!/bin/sh
CONTAINER_IMAGE="registry.makerforce.io/ambrose/env" CONTAINER_IMAGE="registry.makerforce.io/ambrose/env"
CONTAINER_IMAGE_PWN="registry.makerforce.io/ambrose/pwn"
CONTAINER_HOME="/home/ambrose" CONTAINER_HOME="/home/ambrose"
OPTIND=1 OPTIND=1
@ -10,6 +11,7 @@ delete=""
name="" name=""
ports="\n\t" ports="\n\t"
volumes="" volumes=""
image="$CONTAINER_IMAGE"
show_help() { show_help() {
cat << EOF cat << EOF
@ -23,11 +25,12 @@ instead of a shell.
-n NAME give container a NAME -n NAME give container a NAME
-p PORT forward host PORT to container PORT -p PORT forward host PORT to container PORT
-v LIST mount volume LIST. specify as LOCAL:MOUNT -v LIST mount volume LIST. specify as LOCAL:MOUNT
-t run pwntools instead
EOF EOF
} }
while getopts "hxwn:p:v:" opt; do while getopts "hxwn:p:v:t" opt; do
case "$opt" in case "$opt" in
x) x)
delete="--rm " delete="--rm "
@ -49,6 +52,9 @@ while getopts "hxwn:p:v:" opt; do
show_help show_help
exit 0 exit 0
;; ;;
t)
image="$CONTAINER_IMAGE_PWN"
;;
:) :)
echo "Option -$OPTARG requires an argument." >&2 echo "Option -$OPTARG requires an argument." >&2
show_help show_help
@ -69,11 +75,11 @@ if [ "$ports" = "\n\t" ]; then
ports="" ports=""
fi fi
docker pull $CONTAINER_IMAGE docker pull $image
cmd="\n\ cmd="\n\
docker run -it $delete$name$ports$workdir$volumes\n\ docker run -it $delete$name$ports$workdir$volumes\n\
$CONTAINER_IMAGE \n\ $image \n\
$@\ $@\
" "

View File

@ -48,6 +48,7 @@ while getopts "hn:e:f:" opt; do
echo " -n NAME Share FILE at /$BUCKET/NAME" echo " -n NAME Share FILE at /$BUCKET/NAME"
echo " -e EXPIRES Set link expiry (NN[h|m|s] or 'none') (default: $EXPIRE)" echo " -e EXPIRES Set link expiry (NN[h|m|s] or 'none') (default: $EXPIRE)"
echo "" echo ""
exit 0
;; ;;
n) n)
NAME="$OPTARG" NAME="$OPTARG"