index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-08-15 08:05:59 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-15 15:15:11 -0500 |
commit | 11b9bc443d19640af89a9d4584698128d55e99de (patch) | |
tree | ff5438cc1bcf786bc6a42800e7d3b0e85c19b9a4 | |
parent | 11f4a7a48ebd52c69345c3baced5b14974931643 (diff) |
-rw-r--r-- | scripts/repo-add.sh.in | 34 |
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in index 85b938ad..fd0c8142 100644 --- a/scripts/repo-add.sh.in +++ b/scripts/repo-add.sh.in @@ -266,29 +266,13 @@ db_write_entry() { esac done< <(bsdtar -xOqf "$pkgfile" .PKGINFO) - 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 - msg2 "$(gettext "Adding package signature...")" - 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" return 1 fi - pushd "$tmpdir/tree" >/dev/null - if [[ -d $pkgname-$pkgver ]]; then + if [[ -d $tmpdir/tree/$pkgname-$pkgver ]]; then warning "$(gettext "An entry for '%s' already existed")" "$pkgname-$pkgver" else if (( DELTA )); then @@ -300,10 +284,26 @@ db_write_entry() { fi fi + 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 + msg2 "$(gettext "Adding package signature...")" + pgpsig=$(openssl base64 -in "$pkgfile.sig" | tr -d '\n') + fi + # remove an existing entry if it exists, ignore failures db_remove_entry "$pkgname" # create package directory + pushd "$tmpdir/tree" >/dev/null mkdir "$pkgname-$pkgver" pushd "$pkgname-$pkgver" >/dev/null |