#!/bin/bash if [[ -z $1 ]] ; then echo "Must provide a package name" echo "sign_build.sh [ | | | | ]" exit 1 else PACKAGE=$1 echo "PACKAGE=$PACKAGE" fi GPG_KEY="kojiadmin@koozali.org" DEBUGINFO="--debuginfo" ARCHES= DEBUG= RPM= for param in $2 $3 $4 $5 $6 $7; do if [ $param ] ; then case $param in -h | --help ) echo "sign_build.sh [ | | | ]" ;; debug ) DEBUG=true ;; nodebuginfo ) DEBUGINFO= ;; arch=* ) arches=${param#*=} for arch in ${arches//,/ } ; do ARCHES=ARCHES"--arch=$arch " done ;; latestfrom=* ) PACKAGE=$PACKAGE" --latestfrom="${param#*=} ;; gpg_name=* ) GPG_NAME=${param#*=} ;; * ) echo "Unkown parameter $param - aborting" exit 1 ;; esac else break fi done # If an rpm name passed assume signing of an individual rpm if (${1##*.} == "rpm") ; then RPM="--rpm" ; fi # sign the specified rpms (using either a git tag or the latestfrom) tmpdir="$(mktemp -d /tmp/sign.XXXXXX)" pushd $tmpdir > /dev/null if [[ $DEBUG ]] ; then echo "PACKAGE=$PACKAGE" echo "ARCH=$ARCHES" echo "DEBUGINFO=$DEBUGINFO" echo "RPM=$RPM" echo "GPG_NAME=$GPG_NAME" fi if [[ $DEBUG ]] ; then echo "koji download-build $DEBUGINFO $RPM $ARCHES $PACKAGE" ; fi koji download-build $DEBUGINFO $RPM $ARCHES $PACKAGE rpmsign --define "_gpg_name $GPG_NAME" --addsign *.rpm koji import-sig *.rpm popd > /dev/null # if debug, leave the tmp directory in place if [[ -z $DEBUG ]] ; then rm -f $tmpdir/* rmdir $tmpdir fi exit 0