Skip to content

Commit

Permalink
Merge pull request #65 from denisa/JENKINS-48783
Browse files Browse the repository at this point in the history
JENKINS-48783: the macOs version of stat uses the '-f', not the '-c', argument to specify the format
  • Loading branch information
jglick committed Jan 30, 2018
2 parents 713d473 + 7908812 commit 0b0429d
Showing 1 changed file with 16 additions and 8 deletions.
@@ -1,17 +1,25 @@
#!/bin/sh
set -e -x

if [ `uname` = 'Darwin' ] ; then
permission_fmt='-f %Lp'
size_fmt='-f %z'
else
permission_fmt='-c %a'
size_fmt='-c %s'
fi

# check permissions on the credentials dir and its parent
[ $(stat -c %a "$DOCKER_CERT_PATH") = 700 ]
[ $(stat -c %a "$DOCKER_CERT_PATH"/..) = 700 ]
[ $(stat $permission_fmt "$DOCKER_CERT_PATH") = 700 ]
[ $(stat $permission_fmt "$DOCKER_CERT_PATH"/..) = 700 ]

# check permissions and content of the certificate files
[ $(stat -c %a "$DOCKER_CERT_PATH/key.pem") = 600 ]
[ $(stat -c %a "$DOCKER_CERT_PATH/cert.pem") = 600 ]
[ $(stat -c %a "$DOCKER_CERT_PATH/ca.pem") = 600 ]
[ $(stat -c %s "$DOCKER_CERT_PATH/key.pem") = 9 ]
[ $(stat -c %s "$DOCKER_CERT_PATH/cert.pem") = 17 ]
[ $(stat -c %s "$DOCKER_CERT_PATH/ca.pem") = 19 ]
[ $(stat $permission_fmt "$DOCKER_CERT_PATH/key.pem") = 600 ]
[ $(stat $permission_fmt "$DOCKER_CERT_PATH/cert.pem") = 600 ]
[ $(stat $permission_fmt "$DOCKER_CERT_PATH/ca.pem") = 600 ]
[ $(stat $size_fmt "$DOCKER_CERT_PATH/key.pem") = 9 ]
[ $(stat $size_fmt "$DOCKER_CERT_PATH/cert.pem") = 17 ]
[ $(stat $size_fmt "$DOCKER_CERT_PATH/ca.pem") = 19 ]

# keep location of the certificate dir for the next step
echo "$DOCKER_CERT_PATH" > cert-path

0 comments on commit 0b0429d

Please sign in to comment.