6565
6666
6767# to check though:
68- diff -q <( tail -n 228 " $0 " | head -n 226 | shasum -a 384 -t -) <( tail -n 1 " $0 " ) || exit 70 ;
68+ diff -q <( tail -n 229 " $0 " | head -n 227 | shasum -a 384 -t -) <( tail -n 1 " $0 " ) || exit 70 ;
6969
7070ulimit -t 90
7171PATH=" /bin:/sbin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:${PATH} "
7272LANG=${LANG:- " en_US" }
7373LC_ALL=" ${LANG: 0: 5} .utf-8"
74+ export BINDIR=" ${BINDIR:- ./ bin} "
7475umask 127
7576
7677LOCK_FILE=" ${TMPDIR:-/ tmp} /org.pak.tests.scripts.code-climate.lock"
@@ -118,7 +119,14 @@ case "$ARCH" in
118119esac
119120
120121# Set the CI prefix
121- CI_ENV_PREFIX=" ${CI_OS} -${ARCH} "
122+ case " ${CI_OS:- Linux} " in
123+ * arwin)
124+ CI_ENV_PREFIX=" ${CI_OS} -amd64"
125+ ;;
126+ * )
127+ CI_ENV_PREFIX=" ${CI_OS} -${ARCH} "
128+ ;;
129+ esac
122130
123131function cleanup() {
124132 rm -f " ${LOCK_FILE} " 2> /dev/null || : ; wait ;
175183# ########################
176184# actual Work starts here
177185# ########################
178- curl -fLso ./test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64} https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } ;
186+ curl -fLso ./test-reporter-latest-${CI_ENV_PREFIX} https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${CI_ENV_PREFIX } ;
179187for i in 1 256 512 ; do
180- curl -fLso test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64} .sha${i} " https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } .sha${i} " ; wait ;
181- curl -fLso test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64} .sha${i} .sig " https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } .sha${i} .sig" ; wait ;
188+ curl -fLso test-reporter-latest-${CI_ENV_PREFIX} .sha${i} " https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${CI_ENV_PREFIX } .sha${i} " ; wait ;
189+ curl -fLso test-reporter-latest-${CI_ENV_PREFIX} .sha${i} .sig " https://codeclimate.com/downloads/test-reporter/test-reporter-latest-${CI_ENV_PREFIX } .sha${i} .sig" ; wait ;
182190 # test sha1/sha512 signatures if found and sha256 even if not found
183- if [[ ( -r test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } .sha${i} ) ]] || [[ ( ${i} -eq 256 ) ]] ; then
191+ if [[ ( -r test-reporter-latest-${CI_ENV_PREFIX } .sha${i} ) ]] || [[ ( ${i} -eq 256 ) ]] ; then
184192 if [[ ${i} -eq 1 ]]; then
185193 printf " %s\n" " WARNING: SHA-1 is deprecated and should be avoided when possible. Consider using SHA-256 or SHA-512 for stronger integrity checks. (CWE-327: Use of a Broken or Risky Cryptographic Algorithm)"
186194 fi
@@ -189,16 +197,16 @@ for i in 1 256 512 ; do
189197 # FP: KEY FP 9BD9 E2DD 46DA 965A 537E 5B0A 5CBF 3202 43B6 FD85
190198 # OR...
191199 # Set CI=true to continue on missing keys
192- gpg --verify test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64} .sha${i} .sig test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } .sha${i} || ${CI} 2> /dev/null || ${CIRCLECI} 2> /dev/null || EXIT_CODE=126
193- rm -vf test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } .sha${i} .sig 2> /dev/null ;
200+ gpg --verify test-reporter-latest-${CI_ENV_PREFIX} .sha${i} .sig test-reporter-latest-${CI_ENV_PREFIX } .sha${i} || ${CI} 2> /dev/null || ${CIRCLECI} 2> /dev/null || EXIT_CODE=126
201+ rm -vf test-reporter-latest-${CI_ENV_PREFIX } .sha${i} .sig 2> /dev/null ;
194202 fi
195- shasum -a $i -c --ignore-missing test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } .sha${i} || EXIT_CODE=126
196- rm -vf test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } .sha${i} 2> /dev/null ;
203+ shasum -a $i -c --ignore-missing test-reporter-latest-${CI_ENV_PREFIX } .sha${i} || EXIT_CODE=126
204+ rm -vf test-reporter-latest-${CI_ENV_PREFIX } .sha${i} 2> /dev/null ;
197205 fi
198206done
199207
200208if [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
201- mv -fv ./test-reporter-latest-${CI_OS :- linux} - ${ARCH :- amd64 } ./cc-test-reporter 2> /dev/null || EXIT_CODE=126
209+ mv -fv ./test-reporter-latest-${CI_ENV_PREFIX } ./cc-test-reporter 2> /dev/null || EXIT_CODE=126
202210 chmod -v 751 ./cc-test-reporter || EXIT_CODE=77
203211fi
204212
@@ -241,30 +249,30 @@ elif [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
241249 printf " ::endgroup::\n" ;
242250 if [[ ( ${EXIT_CODE} -eq 0 ) ]] ; then
243251 printf " ::debug::%s\n" " Checking for DeepSource CLI" ;
244- if [[ ( -d ./bin ) ]] ; then
245- printf " ::debug::== > %s\n" " Found ./bin directory." ;
246- if [[ ( -x ./bin /deepsource ) ]] ; then
247- printf " ::debug:: == > %s\n" " Found ./bin /deepsource CLI tool" ;
248- elif [[ ( -r ./bin/ deepsource ) || ( -e ./bin /deepsource ) ]] ; then
249- printf " ::debug:: == > %s\n" " Found ./bin/ deepsource file. Permission Error " ;
250- printf " ::debug:: = => %s\n" " Trying to apply permission corrections" ;
251- chmod -v 751 ./bin /deepsource || EXIT_CODE=77 ;
252- if [[ ( ${EXIT_CODE} -eq 0 ) ]] && [[ ( -x ./bin /deepsource ) ]] ; then
253- printf " ::debug:: == > %s\n" " Fixed ./bin /deepsource CLI tool" ;
252+ if [[ ( -d " ${BINDIR} " ) ]] ; then
253+ printf " ::debug::=> %s\n" " Found ${BINDIR} directory." ;
254+ if [[ ( -x " ${BINDIR} " /deepsource ) ]] ; then
255+ printf " ::debug::..= > %s\n" " Found ${BINDIR} /deepsource CLI tool" ;
256+ elif [[ ( -r " ${BINDIR} " / deepsource ) || ( -e " ${BINDIR} " /deepsource ) ]] ; then
257+ printf " ::debug::..= > %s\n" " Found ${BINDIR} / deepsource file." ;
258+ printf " ::debug::.... => %s\n" " Trying to apply permission corrections" ;
259+ chmod -v 751 " ${BINDIR} " /deepsource || EXIT_CODE=77 ;
260+ if [[ ( ${EXIT_CODE} -eq 0 ) ]] && [[ ( -x " ${BINDIR} " /deepsource ) ]] ; then
261+ printf " ::debug::......= > %s\n" " Fixed ${BINDIR} /deepsource CLI tool" ;
254262 else
255- printf " ::debug:: = => %s\n" " Applying corrections Unsuccessful" ;
263+ printf " ::debug::.... => %s\n" " Applying corrections Unsuccessful" ;
256264 EXIT_CODE=77 ;
257265 fi ;
258266 else
259- printf " ::debug:: == > %s\n" " Missing ./bin /deepsource CLI tool" ;
267+ printf " ::debug::..= > %s\n" " Missing ${BINDIR} /deepsource CLI tool" ;
260268 EXIT_CODE=125 ;
261- printf " ::debug:: == > %s\n" " Checking if bin is empty:" ;
262- readonly BIN_FILES=$( ls -1 ./bin 2> /dev/null ; )
263- printf " ::debug:: = => %s\n" " ${BIN_FILES} " ;
269+ printf " ::debug::..= > %s\n" " Checking if ${BINDIR} is empty:" ;
270+ readonly BIN_FILES=$( ls -1 " ${BINDIR} " 2> /dev/null ; )
271+ printf " ::debug::.. => %s\n" " ${BIN_FILES} " ;
264272 unset $BIN_FILES 2> /dev/null || : ;
265273 fi ;
266274 else
267- printf " ::debug::== > %s\n" " Missing ./bin directory." ;
275+ printf " ::debug::=> %s\n" " Missing ${BINDIR} directory." ;
268276 EXIT_CODE=125 ;
269277 fi ;
270278 fi ;
@@ -290,4 +298,4 @@ cleanup 2>/dev/null || rm -f "${LOCK_FILE}" 2>/dev/null > /dev/null || : ; wait
290298exit ${EXIT_CODE:- 255} ;
291299
292300# This file's code hash:
293- 99229c350d321d5557c1833263cdbe4b09271ad374d4f81eb08d19d8ae00c922e3764eaf7ccfb506f6e58171c2ecf5f6 -
301+ c107fcd6c083b3fcfe410ce7fa6017a27c519172511d959f52ded59cd8af8e8648dcd58ff27d624df32284d1a9a4289a -
0 commit comments