Default aws cli directory for commands
This commit is contained in:
parent
ec252ee502
commit
b4f509d90d
5
aws-cli/.gitignore
vendored
Normal file
5
aws-cli/.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
*
|
||||
!.gitignore
|
||||
!Dockerfile
|
||||
!README.md
|
||||
!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,19 +58,24 @@ init() {
|
||||
cmd() {
|
||||
local localDir
|
||||
|
||||
|
||||
if [[ ${USE_DEFAULT_DIRECTORY} -eq 1 ]]; then
|
||||
localDir=${DEFAULT_DIRECTORY}
|
||||
else
|
||||
__msg "Specify a mount point to /mnt/host inside the docker container"
|
||||
|
||||
read localDir
|
||||
|
||||
if [[ ${localDir} = "" ]]; then
|
||||
localDir="$(pwd -P)"
|
||||
__warn "You have not provided a directory, using current path: ${localDir}"
|
||||
__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
|
||||
|
||||
__warn "Mounting ${localDir} to /mnt/host inside the docker container"
|
||||
|
||||
@ -242,6 +253,9 @@ exec() {
|
||||
local source_dir="$1"
|
||||
|
||||
if [[ ${source_dir} = "" ]]; then
|
||||
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]"
|
||||
@ -250,6 +264,7 @@ exec() {
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
docker run --rm -it \
|
||||
-u $(id -u):$(id -g) \
|
||||
|
||||
Loading…
Reference in New Issue
Block a user