pkgmeek: fix the off-by-one error in check_signature() loop
This commit is contained in:
parent
44f532aa9b
commit
fc0ec86cec
@ -47,7 +47,7 @@ set -e
|
||||
package="${name}#${version}-${release}.pkg.tar.${PKGMK_COMPRESSION_MODE}"
|
||||
declare -A _local_
|
||||
for (( s=0; s<${#source[@]}; s++ )); do
|
||||
if [[ ${source[$s]} =~ ^(https|ssh|git)://.*/(.+)\.git ]]; then
|
||||
if [[ ${source[$s]} =~ ^(http|https|ssh|git)://.*/(.+)\.git ]]; then
|
||||
_local_[$s]="${BASH_REMATCH[2]}"
|
||||
elif [[ ${source[$s]} =~ ^(http|https|ftp|file)://.*/(.+) ]]; then
|
||||
_local_[$s]="${BASH_REMATCH[2]}"
|
||||
@ -453,32 +453,33 @@ parse_signify_output() { # chomps the output of check_signature()
|
||||
signerr=2; error "Signature mismatch found:"
|
||||
echo "$signout" | awk -F: '/FAIL/ {printf "MISMATCH %s\n", $1}'
|
||||
;;
|
||||
*"OK") signerr=0 ;;
|
||||
esac
|
||||
done
|
||||
return $signerr
|
||||
}
|
||||
|
||||
check_signature() { # called from $PKGMK_ROOT in the case "when"="pre-Pkgfile",
|
||||
# otherwise called from within $work. Pass control to
|
||||
# check_manifest() if the signature is missing and "ignore-md5"
|
||||
# has not been requested.
|
||||
# otherwise called from within $work. Pass control to
|
||||
# check_manifest() if the signature is missing and "ignore-md5"
|
||||
# has not been requested.
|
||||
local reqfiles; local s=0; local when="$1"
|
||||
|
||||
if [ -f "$PKGMK_ROOT/.signature" ]; then
|
||||
[ "$when" = "pre-Pkgfile" ] && reqfiles=(Pkgfile) || reqfiles=(.footprint)
|
||||
while [ "$when" = "pre-build" ] && [ "$s" -le ${#_local_[@]} ]; do
|
||||
[[ "${source[$s]}" =~ ^(http|https|git).*/\.git ]] || \
|
||||
reqfiles=("${reqfiles[@]}" "${_local_[$s]}")
|
||||
while [ "$when" = "pre-build" ] && [ "$s" -lt ${#_local_[@]} ]; do
|
||||
[[ "${source[$s]}" =~ ^(http|https|ssh|git).*/\.git ]] || \
|
||||
reqfiles+=("${_local_[$s]}")
|
||||
s=$(( s+1 ))
|
||||
done
|
||||
for FILE in "${reqfiles[@]}" "${_local_[@]}"; do
|
||||
for FILE in "${reqfiles[@]}"; do
|
||||
[ -e "$FILE" ] || ln -sf "$PKGMK_ROOT/$FILE" .
|
||||
done
|
||||
if [ -f "$PKGMK_PUBLICKEY" ]; then
|
||||
$PKGMK_SIGNIFY -q -C -p "$PKGMK_PUBLICKEY" -x "$PKGMK_ROOT/.signature" \
|
||||
$PKGMK_SIGNIFY -C -p "$PKGMK_PUBLICKEY" -x "$PKGMK_ROOT/.signature" \
|
||||
"${reqfiles[@]}" 2>&1
|
||||
else
|
||||
$PKGMK_SIGNIFY -q -C -x "$PKGMK_ROOT/.signature" \
|
||||
$PKGMK_SIGNIFY -C -x "$PKGMK_ROOT/.signature" \
|
||||
"${reqfiles[@]}" 2>&1
|
||||
fi
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user