abuild-sign: fix --installed to detect missing keys

This commit is contained in:
Natanael Copa 2022-06-15 12:18:32 +02:00
parent 32d080e427
commit ea4c0e0eba
2 changed files with 28 additions and 1 deletions

View File

@ -112,6 +112,15 @@ if [ -z "$pubkey" ]; then
pubkey=${PACKAGER_PUBKEY:-"${privkey}.pub"}
fi
if ! $check_installed; then
if $check_installed; then
if ! [ -e "$privkey" ]; then
echo "$program: $privkey: File not found" >&2
exit 1
fi
if ! [ -e "$pubkey" ]; then
echo "$program: $pubkey: File not found" >&2
exit 1
fi
else
do_sign "$@"
fi

View File

@ -6,6 +6,8 @@ init_tests \
abuild_sign_invalid_opt \
abuild_sign_missing_arg \
abuild_sign_installed_missing \
abuild_sign_installed_missing_pub \
abuild_sign_installed_missing_priv \
abuild_sign_installed
export ABUILD_SHAREDIR="$(atf_get_srcdir)/.."
@ -38,6 +40,22 @@ abuild_sign_installed_missing_body() {
abuild-sign --installed
}
abuild_sign_installed_missing_pub_body() {
init_keys
rm .abuild/*.rsa.pub
atf_check -s exit:1 \
-e match:"rsa.pub: File not found" \
abuild-sign --installed
}
abuild_sign_installed_missing_priv_body() {
init_keys
rm .abuild/*.rsa
atf_check -s exit:1 \
-e match:"rsa: File not found" \
abuild-sign --installed
}
abuild_sign_installed_body() {
init_keys
atf_check -s exit:0 \