mkrelease.sh: use sbsign as EFI signing tool

This commit is contained in:
Harald Hoyer 2018-09-14 11:37:19 +02:00
parent 090dd46a8e
commit 04f270c58e

View file

@ -6,16 +6,18 @@ Usage: $PROGNAME [OPTION]
-h, --help Display this help -h, --help Display this help
--nosign Don't sign the EFI executable --nosign Don't sign the EFI executable
--certdir DIR Use DIR as certification CA for EFI signing --dbkey KEY Use KEY as certification key for EFI signing
--dbcrt CRT Use CRT as certification for EFI signing
EOF EOF
} }
TEMP=$( TEMP=$(
getopt -o '' \ getopt -o '' \
--long certdir: \ --long dbkey: \
--long dbcrt: \
--long nosign \ --long nosign \
--long notar \ --long notar \
--long help \ --long help \
-- "$@" -- "$@"
) )
@ -29,21 +31,25 @@ unset TEMP
while true; do while true; do
case "$1" in case "$1" in
'--certdir') '--dbkey')
CERTDIR="$(readlink -e $2)" DBKEY="$(readlink -e $2)"
shift 2; continue
;;
'--dbcrt')
DBCRT="$(readlink -e $2)"
shift 2; continue shift 2; continue
;; ;;
'--nosign') '--nosign')
NOSIGN="1" NOSIGN="1"
shift 1; continue shift 1; continue
;; ;;
'--notar') '--notar')
NOTAR="1" NOTAR="1"
shift 1; continue shift 1; continue
;; ;;
'--help') '--help')
usage usage
exit 0 exit 0
;; ;;
'--') '--')
shift shift
@ -63,7 +69,11 @@ IMAGE="${BASEDIR}/$(jq -r '.name' ${JSON})-$(jq -r '.version' ${JSON})"
( (
cd "$IMAGE" cd "$IMAGE"
if ! [[ $NOSIGN ]]; then if ! [[ $NOSIGN ]]; then
pesign -c DB -s ${CERTDIR:+--certdir $CERTDIR} -i bootx64.efi -o bootx64-signed.efi if ! [[ $DBKEY ]] || ! [[ $DBCRT ]]; then
echo "Need --dbkey KEY --dbcrt CRT options"
exit 1
fi
sbsign --key "$DBKEY" --cert "$DBCRT" --output bootx64-signed.efi bootx64.efi
mv bootx64-signed.efi bootx64.efi mv bootx64-signed.efi bootx64.efi
fi fi
[[ -f sha512sum.txt ]] || sha512sum * > sha512sum.txt [[ -f sha512sum.txt ]] || sha512sum * > sha512sum.txt