[pacman-dev] [PATCH] GPG signature option in makepkg
geoffroy.carrier at koon.fr
geoffroy.carrier at koon.fr
Sun Jun 1 21:04:40 EDT 2008
From: Geoffroy Carrier <geoffroy.carrier at koon.fr>
---
scripts/makepkg.sh.in | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 6e2f1ad..1314a51 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -54,6 +54,7 @@ INFAKEROOT=0
GENINTEG=0
INSTALL=0
NOBUILD=0
+SIGN=0
NODEPS=0
NOEXTRACT=0
RMDEPS=0
@@ -855,6 +856,19 @@ create_package() {
fi
}
+create_signature() {
+ [ "$SIGN" = "0" ] && return
+ 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
+ if ! gpg --detach-sign "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"; then
+ error "$(gettext "Failed to sign package file.")"
+ # exit 1 # It's easy to sign manually, so doesn't seem a big failure to gcarrier.
+ fi
+}
+
create_xdelta() {
if [ "$(check_buildenv xdelta)" != "y" ]; then
return
@@ -1127,7 +1141,7 @@ SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
# Parse Command Line Options.
OPT_SHORT="AbcCdefFghiLmop:rRsSV"
OPT_LONG="ignorearch,asroot,builddeps,clean,cleancache,nodeps,noextract,force,forcever:,geninteg,help,holdver"
-OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,source,syncdeps,usesudo,version"
+OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,source,syncdeps,sign,version"
# Pacman Options
OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')"
@@ -1166,11 +1180,7 @@ while true; do
-R|--repackage) REPKG=1 ;;
--source) SOURCEONLY=1 ;;
-s|--syncdeps) DEP_BIN=1 ;;
-
- # BEGIN DEPRECATED
- -S|--usesudo)
- warning "$(gettext "Sudo is used by default now. The --usesudo option is deprecated!")" ;;
- # END DEPRECATED
+ -S|--sign) SIGN=1 ;;
-h|--help) usage; exit 0 ;; # E_OK
-V|--version) version; exit 0 ;; # E_OK
@@ -1494,6 +1504,8 @@ fi
msg "$(gettext "Finished making: %s")" "$pkgname $pkgver-$pkgrel $CARCH ($(date))"
+create_signature
+
install_package
exit 0 #E_OK
--
1.5.5.3
More information about the pacman-dev
mailing list