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