diff --git a/aws-cli/.gitignore b/aws-cli/.gitignore new file mode 100644 index 0000000..f85f5c1 --- /dev/null +++ b/aws-cli/.gitignore @@ -0,0 +1,5 @@ +* +!.gitignore +!Dockerfile +!README.md +!run.sh diff --git a/aws-cli/run.sh b/aws-cli/run.sh index d01eb0e..7e3c530 100755 --- a/aws-cli/run.sh +++ b/aws-cli/run.sh @@ -17,6 +17,12 @@ source ${SCRIPT_PATH}/../common.shinc AWS_DEFAULT_REGION=eu-central-1 CUSTOM_ARGS="" +# This directory will be mounted if no other directory is specified on the command line +DEFAULT_DIRECTORY=${SCRIPT_PATH} + +# To enable the default directory mount point, override this setting to 1 in env.shinc +USE_DEFAULT_DIRECTORY=0 + CURRENT_DATE="$(date +%Y-%m-%d)" platform=$(uname) @@ -52,17 +58,22 @@ init() { cmd() { local localDir - __msg "Specify a mount point to /mnt/host inside the docker container" - read localDir + if [[ ${USE_DEFAULT_DIRECTORY} -eq 1 ]]; then + localDir=${DEFAULT_DIRECTORY} + else + __msg "Specify a mount point to /mnt/host inside the docker container" - if [[ ${localDir} = "" ]]; then - localDir="$(pwd -P)" - __warn "You have not provided a directory, using current path: ${localDir}" - __msg "Continue? [(y)/n]" - read CONTINUE - if [[ ${CONTINUE} != "" ]] && [[ ${CONTINUE} != "y" ]] && [[ ${CONTINUE} != "Y" ]]; then - return 0 + read localDir + + if [[ ${localDir} = "" ]]; then + localDir="$(pwd -P)" + __warn "You have not provided a directory, using default directory path: ${localDir}" + __msg "Continue? [(y)/n]" + read CONTINUE + if [[ ${CONTINUE} != "" ]] && [[ ${CONTINUE} != "y" ]] && [[ ${CONTINUE} != "Y" ]]; then + return 0 + fi fi fi @@ -242,12 +253,16 @@ exec() { local source_dir="$1" if [[ ${source_dir} = "" ]]; then - source_dir=$(pwd -P) - __warn "You have not provided a directory, using current path: ${source_dir}" - __msg "Continue? [(y)/n]" - read CONTINUE - if [[ ${CONTINUE} != "" ]] && [[ ${CONTINUE} != "y" ]] && [[ ${CONTINUE} != "Y" ]]; then - return 0 + if [[ ${USE_DEFAULT_DIRECTORY} -eq 1 ]]; then + source_dir=${DEFAULT_DIRECTORY} + else + source_dir=$(pwd -P) + __warn "You have not provided a directory, using current path: ${source_dir}" + __msg "Continue? [(y)/n]" + read CONTINUE + if [[ ${CONTINUE} != "" ]] && [[ ${CONTINUE} != "y" ]] && [[ ${CONTINUE} != "Y" ]]; then + return 0 + fi fi fi