From 677fdca805bc4648c776279e7c2ad8ffcea1193b Mon Sep 17 00:00:00 2001 From: Casey Bisson Date: Fri, 2 Jun 2017 08:47:24 -0700 Subject: [PATCH 1/2] add option to show profile don't show profile by default --- triton-docker | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) mode change 100644 => 100755 triton-docker diff --git a/triton-docker b/triton-docker old mode 100644 new mode 100755 index f79c962..d09a800 --- a/triton-docker +++ b/triton-docker @@ -23,7 +23,7 @@ function currentProfile () { local profile_source='default; use `triton profile set ` to change' fi - echo "Executing in '$(triton profile get | awk 'NR == 1 {print $2}')' (${profile_source}) at $(date +'%r')" + echo "Executing in '$(triton profile get | awk 'NR == 1 {print $2}')' (${profile_source})" } # Check if the Docker binary (named triton-docker-helper) @@ -74,10 +74,17 @@ function install () { # Run all checks function checkAll () { checkTritonInstalled && - checkDockerInstalled && - currentProfile + checkDockerInstalled } +# Special case handling if the sub-command is `profile` +if [ "profile" == "$1" ] +then + currentProfile + exit 1 +fi + +# Change behavior based on the calling name of this executable case "`basename $0`" in triton-docker) checkAll && From f5f02cb1e92abc8284b6ffae29f31c389a4e2baf Mon Sep 17 00:00:00 2001 From: Casey Bisson Date: Fri, 2 Jun 2017 09:12:45 -0700 Subject: [PATCH 2/2] shellcheck improvements --- triton-docker | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/triton-docker b/triton-docker index d09a800..4cdea60 100755 --- a/triton-docker +++ b/triton-docker @@ -32,10 +32,10 @@ function checkDockerInstalled () { if [ ! -f /usr/local/bin/triton-docker-helper ] || [ ! -x /usr/local/bin/triton-docker-helper ] || - [ "${triton_docker_version}," != $(/usr/local/bin/triton-docker-helper -v | awk '{print $3}') ] || + [ "${triton_docker_version}," != "$(/usr/local/bin/triton-docker-helper -v | awk '{print $3}')" ] || [ ! -f /usr/local/bin/triton-compose-helper ] || [ ! -x /usr/local/bin/triton-compose-helper ] || - [ "${triton_compose_version}," != $(/usr/local/bin/triton-compose-helper -v | awk '{print $3}') ] + [ "${triton_compose_version}," != "$(/usr/local/bin/triton-compose-helper -v | awk '{print $3}')" ] then echo 'Additional or updated components are required.' echo 'Please run `sudo triton-docker-install` to continue.' @@ -55,7 +55,7 @@ function install () { # Install the specific version of Docker for Triton rm -Rf /tmp/triton-docker /usr/local/bin/triton-docker-helper mkdir -p /tmp/triton-docker - curl https://get.docker.com/builds/$(uname -a | awk '{ print $1 }')/x86_64/docker-${triton_docker_version}.tgz | tar zxvf - -C /tmp/triton-docker + curl https://get.docker.com/builds/"$(uname -a | awk '{ print $1 }')"/x86_64/docker-${triton_docker_version}.tgz | tar zxvf - -C /tmp/triton-docker mv /tmp/triton-docker/docker/docker /usr/local/bin/triton-docker-helper rm -Rf /tmp/triton-docker chmod +x /usr/local/bin/triton-docker-helper @@ -64,7 +64,7 @@ function install () { echo # Install the specific version of Docker Compose for Triton - curl -Lo /usr/local/bin/triton-compose-helper https://github.com/docker/compose/releases/download/${triton_compose_version}/docker-compose-$(uname -a | awk '{ print $1 }')-x86_64 + curl -Lo /usr/local/bin/triton-compose-helper https://github.com/docker/compose/releases/download/${triton_compose_version}/docker-compose-"$(uname -a | awk '{ print $1 }')"-x86_64 chmod +x /usr/local/bin/triton-compose-helper echo "The triton-compose-helper is now installed." @@ -85,7 +85,7 @@ then fi # Change behavior based on the calling name of this executable -case "`basename $0`" in +case "$(basename $0)" in triton-docker) checkAll && eval "$(triton env)" &&