summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2013-10-25 07:57:35 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2013-10-25 07:57:35 +0000
commitb53d4ad7de70dbc85b6c24bacb023b6dce0e7c78 (patch)
tree731b8dc21a7f7f355cb886bd09182d1c7424c001
parentc28aa7133523f22a4fa5acff300e1411afbde156 (diff)
downloadabuild-b53d4ad7de70dbc85b6c24bacb023b6dce0e7c78.tar.bz2
abuild-b53d4ad7de70dbc85b6c24bacb023b6dce0e7c78.tar.xz
abuild-sign: add -e/--installed option
This is supposed to be used in abuild only to make it possible to exit with error early, before package is built, in case the signing key is missing.
-rw-r--r--abuild-sign.in13
1 files changed, 9 insertions, 4 deletions
diff --git a/abuild-sign.in b/abuild-sign.in
index 4f38a0c..ce7baa5 100644
--- a/abuild-sign.in
+++ b/abuild-sign.in
@@ -46,7 +46,9 @@ usage() {
cat >&2 <<__EOF__
$program $program_version - sign indexes
Usage: $program [-k PRIVKEY] [-p PUBKEY] INDEXFILE...
+ $program -e
Options:
+ -e, --installed Check only of there exist a private key for signing
-k, --private KEY The private key to use for signing
-p, --public KEY The name of public key. apk add will look for
/etc/apk/keys/KEY
@@ -56,11 +58,12 @@ Options:
__EOF__
}
+check_installed=false
privkey="$PACKAGER_PRIVKEY"
pubkey=
quiet=
-args=`getopt -o k:p:qh --long private:,public:,quiet,help -n "$program" -- "$@"`
+args=`getopt -o ek:p:qh --long installed,private:,public:,quiet,help -n "$program" -- "$@"`
if [ $? -ne 0 ]; then
usage
exit 2
@@ -68,6 +71,7 @@ fi
eval set -- "$args"
while true; do
case $1 in
+ -e|--installed) check_installed=true;;
-k|--private) privkey=$2; shift;;
-p|--public) pubkey=$2; shift;;
-q|--quiet) quiet=1;; # suppresses msg
@@ -77,7 +81,7 @@ while true; do
esac
shift
done
-if [ $# -eq 0 ]; then
+if [ $# -eq 0 ] && ! $check_installed; then
usage
exit 2
fi
@@ -99,5 +103,6 @@ if [ -z "$pubkey" ]; then
pubkey=${PACKAGER_PUBKEY:-"${privkey}.pub"}
fi
-do_sign "$@"
-exit 0
+if ! $check_installed; then
+ do_sign "$@"
+fi