From ee34869e8934fe55562a84c4eac055256b7c42f0 Mon Sep 17 00:00:00 2001 From: Geoffroy Carrier Date: Mon, 2 Jun 2008 10:27:00 +0200 Subject: Add GPG signature support to makepkg This is a rather simple patch to add signing support to makepkg. Add a create_signature() to makepkg, add a 'sign' BUILDENV option in makepkg.conf, and document the changes in the makepkg.conf manpage. Signed-off-by: Geoffroy Carrier Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index bb7616cf..f28097f6 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1099,6 +1099,25 @@ create_package() { fi } +create_signature() { + if [[ $(check_buildenv sign) != "y" ]]; then + return + fi + local ret=0 + local filename="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" + 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" @@ -2115,6 +2134,8 @@ fi fullver=$(get_full_version $epoch $pkgver $pkgrel) msg "$(gettext "Finished making: %s")" "$pkgbase $fullver ($(date))" +create_signature + install_package exit 0 #E_OK -- cgit v1.2.3-70-g09d2 From 82e22596d8bfeac89e96d8b2d9eda8e13e14880c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 24 Aug 2009 13:22:12 -0500 Subject: makepkg: allow signatures to work with split packages Signed-off-by: Dan McGee --- scripts/makepkg.sh.in | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index f28097f6..5d6363f0 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 @@ -1097,6 +1100,8 @@ create_package() { if (( ret )); then warning "$(gettext "Failed to create symlink to package file.")" fi + + create_signature "$pkg_file" } create_signature() { @@ -1104,15 +1109,15 @@ create_signature() { return fi local ret=0 - local filename="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" + 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=$? + gpg --detach-sign --use-agent "$filename" || ret=$? if (( ! ret )); then - msg2 "$(gettext "Created signature file %s.")" $filename.sig + msg2 "$(gettext "Created signature file %s.")" "$filename.sig" else warning "$(gettext "Failed to sign package file.")" fi @@ -2134,8 +2139,6 @@ fi fullver=$(get_full_version $epoch $pkgver $pkgrel) msg "$(gettext "Finished making: %s")" "$pkgbase $fullver ($(date))" -create_signature - install_package exit 0 #E_OK -- cgit v1.2.3-70-g09d2 From 2f2f53ddc9f05d00244a41a66eef9ed34bc87463 Mon Sep 17 00:00:00 2001 From: Allan McRae Date: Wed, 31 Mar 2010 15:00:33 +1000 Subject: makepkg: place signature symlink in build dir Be consistent in package and signature placements when using PKGDEST. Signed-off-by: Allan McRae --- scripts/makepkg.sh.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'scripts/makepkg.sh.in') diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index 5d6363f0..5742c492 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -1092,16 +1092,17 @@ 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 warning "$(gettext "Failed to create symlink to package file.")" fi - - create_signature "$pkg_file" } create_signature() { -- cgit v1.2.3-70-g09d2