diff options
author | AXsagi <60316868+AXsagi@users.noreply.github.com> | 2021-04-28 14:17:49 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 04:17:49 -0700 |
commit | 07c9ec6291ad6fc1ef3eb8f335152e0b4aa58131 (patch) | |
tree | 6ac2ae89686194a1adc173f6ed7a3b968c81d174 /makeself.sh | |
parent | bb57d415b4f1aa35fb617282ece31431267a03d7 (diff) | |
download | makeself-07c9ec6291ad6fc1ef3eb8f335152e0b4aa58131.tar.gz |
Add signature verification option (#241)
Co-authored-by: Stéphane Peter <megastep@megastep.org>
Diffstat (limited to 'makeself.sh')
-rwxr-xr-x | makeself.sh | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/makeself.sh b/makeself.sh index e8fe342..adc1a77 100755 --- a/makeself.sh +++ b/makeself.sh @@ -158,6 +158,7 @@ MS_Usage() echo " --nox11 : Disable automatic spawn of a xterm" echo " --nowait : Do not wait for user input after executing embedded" echo " program from an xterm" + echo " --sign passphrase : Signature private key to sign the package with" echo " --lsm file : LSM file describing the package" echo " --license file : Append a license file" echo " --help-header file : Add a header to the archive's --help output" @@ -205,12 +206,15 @@ TAR_EXTRA="" GPG_EXTRA="" DU_ARGS=-ks HEADER=`dirname "$0"`/makeself-header.sh +SIGNATURE="" TARGETDIR="" NOOVERWRITE=n DATE=`LC_ALL=C date` EXPORT_CONF=n SHA256=n OWNERSHIP=n +SIGN=n +GPG_PASSPHRASE="" # LSM file stuff LSM_CMD="echo No LSM. >> \"\$archname\"" @@ -332,8 +336,13 @@ do shift 2 || { MS_Usage; exit 1; } ;; --target) - TARGETDIR="$2" - KEEP=y + TARGETDIR="$2" + KEEP=y + shift 2 || { MS_Usage; exit 1; } + ;; + --sign) + SIGN=y + GPG_PASSPHRASE="$2" shift 2 || { MS_Usage; exit 1; } ;; --nooverwrite) @@ -739,6 +748,19 @@ else fi fi fi +if test "$SIGN" = y; then + GPG_PATH=`exec <&- 2>&-; which gpg || command -v gpg || type gpg` + if test -x "$GPG_PATH"; then + SIGNATURE=`$GPG_PATH --pinentry-mode=loopback --batch --yes --passphrase "$GPG_PASSPHRASE" --output - --detach-sig $tmpfile | base64 | tr -d \\\\n` + fi + if test "$QUIET" = "n"; then + if test -x "$GPG_PATH"; then + echo "Signature: $SIGNATURE" + else + echo "Signature: gpg couldn't sign the tmp file" + fi + fi +fi totalsize=0 for size in $fsize; @@ -754,6 +776,7 @@ if test "$APPEND" = y; then CRCsum="$crcsum" MD5sum="$md5sum" SHAsum="$shasum" + Signature="$SIGNATURE" # Generate the header . "$HEADER" # Append the new data @@ -769,6 +792,7 @@ else CRCsum="$crcsum" MD5sum="$md5sum" SHAsum="$shasum" + Signature="$SIGNATURE" # Generate the header . "$HEADER" |