Terminate Linux script if jarsigner verifies a jar that is unsigned

57 views Asked by At

I would like to use jarsigner as part of a script and the script to terminate if the jar/zip is unsigned (or not signed by AWS in my particular case)

I was hoping I can configure jarsigner to return a non zero exit code when the jar is unsigned so that I can rely on it terminating my script:

#!/usr/bin/env/bash

set -e

jarsigner -verify -certs -strict my_jar_file.jar

# continue

Jarsigner will simply echo that the jar is unsigned but exit code is 0:

no manifest.

jar is unsigned.

What is the proper way of doing this?

Note: I'm using bash...

0

There are 0 answers