diff --git a/checksum/utils.groovy b/checksum/utils.groovy index a961dc8..e4c37ca 100644 --- a/checksum/utils.groovy +++ b/checksum/utils.groovy @@ -4,8 +4,20 @@ env.CHECKSUMARTIFACTS = "checksums/**" // SHA256SUM environment variable must be set to sha256sum utility // Generate a checksum file of from a list of files/directories relative to workspace def generatelist(checksummable) { - if !fileExists("${SHA256SUM}") { - error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + def sha256sumfound = true + if (!fileExists("${SHA256SUM}")) { + def sha256sumfound = false + if (isUnix()) { + def sha256sumpath = sh(returnStdout: true, script: 'which sha256sum').trim() + if (sha256sumpath) { + echo "Found sha256sum executable here: + env.SHA256SUM = sha256sumpath + sha256sumfound = true + } + } + if (!sha256sumfound) { + error "Please define the path to a sha256sum utility in the SHA256SUM environment variable" + } } def CHECKSUMFOLDER = "${WORKSPACE}/checksums" sh """