build: add package signing glue

This commit is contained in:
Franco Fichtner 2015-04-02 05:13:10 +02:00
parent ad6a0d13b8
commit b49aececeb
3 changed files with 23 additions and 1 deletions

View File

@ -44,8 +44,14 @@ cp ${PACKAGESDIR}/${ARCH}/* ${STAGEDIR}/All
# needed bootstrap glue when no packages are on the system
cd ${STAGEDIR}/Latest && ln -s ../All/pkg-*.txz pkg.txz
SIGNARGS=
if [ -n "$(${TOOLSDIR}/scripts/pkg_fingerprint.sh)" ]; then
# XXX check if fingerprint is in core.git
SIGNARGS="signing_command: ${TOOLSDIR}/scripts/pkg_sign.sh"
fi
# generate index files
cd ${STAGEDIR} && pkg repo .
cd ${STAGEDIR} && pkg repo . ${SIGNARGS}
echo -n ">>> Creating packages set... "

6
scripts/pkg_fingerprint.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/sh
if [ -f /root/repo.pub ]; then
echo "function: \"sha256\""
echo "fingerprint: \"$(sha256 -q /root/repo.pub)\""
fi

10
scripts/pkg_sign.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/sh
read -t 2 SUM
[ -z "${SUM}" ] && exit 1
echo SIGNATURE
echo -n ${SUM} | openssl dgst -sign /root/repo.key -sha256 -binary
echo
echo CERT
cat /root/repo.pub
echo END