diff --git a/all/app/awscli b/all/app/awscli new file mode 100644 index 0000000..637d74e --- /dev/null +++ b/all/app/awscli @@ -0,0 +1,39 @@ +#!/bin/bash +command -v docker >/dev/null 2>&1 || exit + +aws_docker () { +local cred +local profile +local profile_env +if [[ $1 == "--cred" ]]; then +cred=$2 +shift 2 +else +cred=${HOME}/.aws +fi +if [[ $1 == "--profile" ]]; then +profile=$2 +shift 2 +else +profile=${AWS_PROFILE} +fi +[[ ! $(cat $cred/config 2> /dev/null | grep ${profile}]) ]] && echo no profile ${profile} in $cred/config && return +[[ $profile ]] && profile_env="--env AWS_PROFILE=${profile}" +# echo credentials directory $cred +# echo using profile $profile +[[ ! -f $cred/credentials ]] && echo no credentails file at $cred/credentails && return + +# echo remaining args: $@ +docker run --rm -it -v ${cred}:/root/.aws --env AWS_PAGER="" ${profile_env} -v $(pwd):/aws amazon/aws-cli "$@" +} + +aws_docker-update () { +docker pull amazon/aws-cli:latest +} + +_alt_=$([[ $(command -v aws >/dev/null 2>&1) ]] || echo d) + +alias aws${_alt_}='aws_docker' +alias aws${_alt_}-update='aws_docker_update' + +unset _alt_ diff --git a/all/app/bashly b/all/app/bashly new file mode 100644 index 0000000..7ba02ce --- /dev/null +++ b/all/app/bashly @@ -0,0 +1,4 @@ +command -v docker >/dev/null 2>&1 || exit + +alias bashly='docker run --rm -it --volume "$PWD:/app" dannyben/bashly' +alias bashly-update='docker pull dannyben/bashly:latest' diff --git a/all/misc/docker/docker.alias b/all/misc/docker/docker.alias index bacd278..69f69c9 100644 --- a/all/misc/docker/docker.alias +++ b/all/misc/docker/docker.alias @@ -1,9 +1,10 @@ #!/bin/bash + +# if docker loaded only command -v docker >/dev/null 2>&1 || return #docker - add users to docker group to avoid needing sudo # run a command on a container -# if [ $(which docker)]; then alias dkcr="docker run" # start a container