diff options
author | Dan McGee <dan@archlinux.org> | 2011-03-23 08:18:57 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-23 08:18:57 +0100 |
commit | 09085331277304e417649e8338795ca36a0d1f91 (patch) | |
tree | bce8d82ea1026fa00581f595b3fec1f5194bd11a /scripts/makepkg.sh.in | |
parent | 36747e4a7f2bf26391573c113950f063daed19b9 (diff) | |
parent | a31d091fb3bd250416d419b30e99c900b1608efc (diff) | |
download | pacman-09085331277304e417649e8338795ca36a0d1f91.tar.gz pacman-09085331277304e417649e8338795ca36a0d1f91.tar.xz |
Merge branch 'gpg-build-tools'
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r-- | scripts/makepkg.sh.in | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index bb7616cf..5742c492 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1068,6 +1068,9 @@ create_package() { local pkg_file="$PKGDEST/${nameofpkg}-${fullver}-${PKGARCH}${PKGEXT}" local ret=0 + [[ -f $pkg_file ]] && rm -f "$pkg_file" + [[ -f $pkg_file.sig ]] && rm -f "$pkg_file.sig" + # when fileglobbing, we want * in an empty directory to expand to # the null string rather than itself shopt -s nullglob @@ -1089,9 +1092,12 @@ create_package() { exit 1 # TODO: error code fi + create_signature "$pkg_file" + if (( ! ret )) && [[ ! "$PKGDEST" -ef "${startdir}" ]]; then ln -sf "${pkg_file}" "${pkg_file/$PKGDEST/$startdir}" ret=$? + [[ -f $pkg_file.sig ]] && ln -sf "$pkg_file.sig" "${pkg_file/$PKGDEST/$startdir}.sig" fi if (( ret )); then @@ -1099,6 +1105,25 @@ create_package() { fi } +create_signature() { + if [[ $(check_buildenv sign) != "y" ]]; then + return + fi + local ret=0 + local filename="$1" + msg "$(gettext "Signing package...")" + if [ ! $(type -p "gpg") ]; then + error "$(gettext "Cannot find the gpg binary! Is gnupg installed?")" + exit 1 # $E_MISSING_PROGRAM + fi + gpg --detach-sign --use-agent "$filename" || ret=$? + if (( ! ret )); then + msg2 "$(gettext "Created signature file %s.")" "$filename.sig" + else + warning "$(gettext "Failed to sign package file.")" + fi +} + create_srcpackage() { cd "$startdir" |