File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed
maven-wrapper-distribution/src/resources Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change 225225# If specified, validate the SHA-256 sum of the Maven distribution zip file
226226if [ -n " ${distributionSha256Sum-} " ]; then
227227 distributionSha256Result=false
228+ computedSha256Sum=" "
228229 if [ " $MVN_CMD " = mvnd.sh ]; then
229230 echo " Checksum validation is not supported for maven-mvnd." >&2
230231 echo " Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2
231232 exit 1
232233 elif command -v sha256sum > /dev/null; then
233234 if echo " $distributionSha256Sum $TMP_DOWNLOAD_DIR /$distributionUrlName " | sha256sum -c - > /dev/null 2>&1 ; then
234235 distributionSha256Result=true
236+ else
237+ computedSha256Sum=$( sha256sum " $TMP_DOWNLOAD_DIR /$distributionUrlName " | cut -b -64)
235238 fi
236239 elif command -v shasum > /dev/null; then
237240 if echo " $distributionSha256Sum $TMP_DOWNLOAD_DIR /$distributionUrlName " | shasum -a 256 -c > /dev/null 2>&1 ; then
238241 distributionSha256Result=true
242+ else
243+ computedSha256Sum=$( shasum " $TMP_DOWNLOAD_DIR /$distributionUrlName " | cut -b -64)
239244 fi
240245 else
241246 echo " Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2
@@ -245,6 +250,8 @@ if [ -n "${distributionSha256Sum-}" ]; then
245250 if [ $distributionSha256Result = false ]; then
246251 echo " Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2
247252 echo " If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2
253+ echo " expected: $distributionSha256Sum " >&2
254+ echo " received: $computedSha256Sum " >&2
248255 exit 1
249256 fi
250257fi
You can’t perform that action at this time.
0 commit comments