summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorRay Kohler <ataraxia937@gmail.com>2011-03-24 23:05:30 +0100
committerDan McGee <dan@archlinux.org>2011-03-24 23:15:35 +0100
commitcfa2eebdafc4d2341621e24ce61dd5a74a0de9fc (patch)
treecb6bf06cf12d9b9e92aee60c2291df2a010dba05 /scripts
parenta8b22e16efbffee84ff8647846196958d871c64b (diff)
downloadpacman-cfa2eebdafc4d2341621e24ce61dd5a74a0de9fc.tar.gz
pacman-cfa2eebdafc4d2341621e24ce61dd5a74a0de9fc.tar.xz
Fix use of relative paths for packages in repo-add
Move checksum and pgpsig calcluation before changing into the tmpdir, otherwise we can't find the files if a relative path was used. Signed-off-by: Ray Kohler <ataraxia937@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
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"