From 83d09394b9a7b7cef7e9259c766315ee99cf19ea Mon Sep 17 00:00:00 2001 From: Julien Del-Piccolo Date: Wed, 1 Mar 2017 12:16:46 +0100 Subject: [PATCH] add support for downloading latest master Signed-off-by: Julien Del-Piccolo --- get-specific-version.sh | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/get-specific-version.sh b/get-specific-version.sh index dbc15d8..3f6fd69 100755 --- a/get-specific-version.sh +++ b/get-specific-version.sh @@ -1,18 +1,20 @@ #!/bin/sh if [ -n "${DBS_VERSION}" ]; then - if [ ! -f /usr/share/docker-bench-security/v${DBS_VERSION}.tar.gz ]; then - echo "Getting docker-bench-security v${DBS_VERSION}..." - wget -q -P /usr/share/docker-bench-security/ https://github.com/docker/docker-bench-security/archive/v${DBS_VERSION}.tar.gz - rm -rf /usr/share/docker-bench-security/docker-bench-security-${DBS_VERSION}/ - tar xfz /usr/share/docker-bench-security/v${DBS_VERSION}.tar.gz -C /usr/share/docker-bench-security/ + if [ ! -f /usr/share/docker-bench-security/${DBS_VERSION}.tar.gz ]; then + echo "Getting docker-bench-security ${DBS_VERSION}..." + wget -q -P /usr/share/docker-bench-security/ https://github.com/docker/docker-bench-security/archive/${DBS_VERSION}.tar.gz + rm -rf /usr/share/docker-bench-security/${DBS_VERSION}/ + mkdir -p /usr/share/docker-bench-security/${DBS_VERSION}/ + tar xfz /usr/share/docker-bench-security/${DBS_VERSION}.tar.gz -C /usr/share/docker-bench-security/${DBS_VERSION} --strip 1 --overwrite + rm -rfv /usr/share/docker-bench-security/${DBS_VERSION}.tar.gz fi - - if [ -d /usr/share/docker-bench-security/docker-bench-security-${DBS_VERSION}/ ]; then + + if [ $(find /usr/share/docker-bench-security/ | wc -l) -gt 1 ]; then rm -rf /usr/local/bin/docker-bench-security.sh /usr/local/bin/helper_lib.sh /usr/local/bin/output_lib.sh rm -rf /usr/local/bin/tests/* - - cp -r /usr/share/docker-bench-security/docker-bench-security-${DBS_VERSION}/*.sh /usr/local/bin/ - cp -r /usr/share/docker-bench-security/docker-bench-security-${DBS_VERSION}/tests/*.sh /usr/local/bin/tests/ + + cp -r /usr/share/docker-bench-security/${DBS_VERSION}/*.sh /usr/local/bin/ + cp -r /usr/share/docker-bench-security/${DBS_VERSION}/tests/*.sh /usr/local/bin/tests/ fi fi