forked from curl/curl-for-win
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_sign-pkg.sh
executable file
·24 lines (20 loc) · 713 Bytes
/
_sign-pkg.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
# Copyright (C) Viktor Szakats. See LICENSE.md
# SPDX-License-Identifier: MIT
# shellcheck disable=SC3040,SC2039
set -o xtrace -o errexit -o nounset; [ -n "${BASH:-}${ZSH_NAME:-}" ] && set -o pipefail
cd "$(dirname "$0")"
# Create signature for package
if [ -n "${SIGN_PKG_KEY_ID:-}" ] && \
[ -n "${SIGN_PKG_KEY_PASS:+1}" ] && \
gpg --list-public-keys "${SIGN_PKG_KEY_ID}" >/dev/null 2>&1; then
file="$1"
echo "Package signing: '${file}'"
gpg --batch --yes --no-tty \
--pinentry-mode loopback --passphrase-fd 0 \
--keyid-format 0xlong \
--detach-sign --armor --local-user "${SIGN_PKG_KEY_ID}" "${file}" <<EOF
${SIGN_PKG_KEY_PASS}
EOF
touch -c -r "${file}" "${file}.asc"
fi