abuild-keygen: abort on error

run under `set -e` to we abort on first error

fixes https://gitlab.alpinelinux.org/alpine/abuild/-/issues/10028
This commit is contained in:
Natanael Copa 2021-04-28 10:23:54 +02:00
parent 9c3427d16f
commit 754270e460

View File

@ -16,6 +16,7 @@ if ! [ -f "$sharedir/functions.sh" ]; then
fi
. "$sharedir/functions.sh"
set -e
# ask for privkey unless non-interactive mode
# returns value in global $privkey
@ -32,7 +33,9 @@ get_privkey_file() {
default_name="${emailaddr:-$USER}-$(printf "%x" $(date +%s))"
privkey="$ABUILD_USERDIR/$default_name.rsa"
[ -n "$non_interactive" ] && return 0
if [ -n "$non_interactive" ]; then
return 0
fi
msg "Generating public/private rsa key pair for abuild"
echo -n "Enter file in which to save the key [$privkey]: "