Default aws cli directory for commands

This commit is contained in:
Arnie 2018-03-02 10:02:08 +01:00
parent ec252ee502
commit b4f509d90d
2 changed files with 35 additions and 15 deletions

5
aws-cli/.gitignore vendored Normal file
View File

@ -0,0 +1,5 @@
*
!.gitignore
!Dockerfile
!README.md
!run.sh

View File

@ -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