mirror of
https://src.koozali.org/infra/smeserver-koji.git
synced 2024-11-21 09:07:29 +01:00
73 lines
1.7 KiB
Bash
Executable File
73 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
if [[ -z $1 ]] ; then
|
|
echo "Must provide a package name"
|
|
echo "sign_build.sh <n-v-r | build_id | package name | rpm> [<arch=x86_64> | <nodebuginfo> | <latestfrom=*> | <gpg_key=kojiadmin@koozali.org> | <debug>]"
|
|
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 <n-v-r | build_id | package name | rpm> [<arch=*> | <nodebuginfo> | <latestfrom=*> | <gpg_key=kojiadmin@koozali.org>]" ;;
|
|
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
|