summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/repo-add.sh.in31
1 files changed, 17 insertions, 14 deletions
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index 59e98cfe..9b57ba76 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -234,8 +234,9 @@ db_write_entry()
{
# blank out all variables
local pkgfile="$1"
- local pkgname pkgver pkgdesc csize size md5sum url arch builddate packager \
- _groups _licenses _replaces _depends _conflicts _provides _optdepends
+ local pkgname pkgver pkgdesc csize size url arch builddate packager \
+ _groups _licenses _replaces _depends _conflicts _provides _optdepends \
+ md5sum sha256sum pgpsig
local OLDIFS="$IFS"
# IFS (field separator) is only the newline character
@@ -265,6 +266,18 @@ db_write_entry()
csize=$(@SIZECMD@ "$pkgfile")
+ # compute checksums
+ msg2 "$(gettext "Computing checksums...")"
+ md5sum="$(openssl dgst -md5 "$pkgfile")"
+ md5sum="${md5sum##* }"
+ sha256sum="$(openssl dgst -sha256 "$pkgfile")"
+ sha256sum="${sha256sum##* }"
+
+ # compute base64'd PGP signature
+ if [[ -f "$pkgfile.sig" ]]; then
+ pgpsig=$(openssl base64 -in "$pkgfile.sig" | tr -d '\n')
+ fi
+
# ensure $pkgname and $pkgver variables were found
if [[ -z $pkgname || -z $pkgver ]]; then
error "$(gettext "Invalid package file '%s'.")" "$pkgfile"
@@ -284,13 +297,6 @@ db_write_entry()
fi
fi
- # compute checksums
- msg2 "$(gettext "Computing checksums...")"
- md5sum="$(openssl dgst -md5 "$pkgfile")"
- md5sum="${md5sum##* }"
- sha256sum="$(openssl dgst -sha256 "$pkgfile")"
- sha256sum="${sha256sum##* }"
-
# remove an existing entry if it exists, ignore failures
db_remove_entry "$pkgname"
@@ -316,11 +322,8 @@ db_write_entry()
echo -e "%MD5SUM%\n$md5sum\n" >>desc
echo -e "%SHA256SUM%\n$sha256sum\n" >>desc
- # add base64'd PGP signature
- if [[ -f $startdir/$pkgfile.sig ]]; then
- pgpsig=$(openssl base64 -in "$startdir/$pkgfile.sig" | tr -d '\n')
- echo -e "%PGPSIG%\n$pgpsig\n" >>desc
- fi
+ # add PGP sig
+ [[ -n $pgpsig ]] && echo -e "%PGPSIG%\n$pgpsig\n" >>desc
[[ -n $url ]] && echo -e "%URL%\n$url\n" >>desc
write_list_entry "LICENSE" "$_licenses" "desc"