mkrelease.sh: add release.json and efi tarball
This commit is contained in:
parent
e40e94bf05
commit
8c33d36232
28
mkrelease.sh
28
mkrelease.sh
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
cat << EOF
|
cat << EOF
|
||||||
Usage: $PROGNAME [OPTION]
|
Usage: $PROGNAME [OPTION] LATEST.JSON
|
||||||
|
|
||||||
-h, --help Display this help
|
-h, --help Display this help
|
||||||
--nosign Don't sign the EFI executable
|
--nosign Don't sign the EFI executable
|
||||||
|
@ -17,7 +17,7 @@ TEMP=$(
|
||||||
--long crt: \
|
--long crt: \
|
||||||
--long nosign \
|
--long nosign \
|
||||||
--long notar \
|
--long notar \
|
||||||
--long help \
|
--long help \
|
||||||
-- "$@"
|
-- "$@"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -61,12 +61,16 @@ while true; do
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
PROGNAME=${0##*/}
|
||||||
|
BASEDIR=$(realpath ${0%/*})
|
||||||
|
|
||||||
JSON="$(realpath -e $1)"
|
JSON="$(realpath -e $1)"
|
||||||
BASEDIR="${JSON%/*}"
|
JSONDIR="${JSON%/*}"
|
||||||
NAME="$(jq -r '.name' ${JSON})"
|
NAME="$(jq -r '.name' ${JSON})"
|
||||||
VERSION="$(jq -r '.version' ${JSON})"
|
VERSION="$(jq -r '.version' ${JSON})"
|
||||||
IMAGE="${BASEDIR}/${NAME}-${VERSION}"
|
ROOTHASH="$(jq -r '.roothash' ${JSON})"
|
||||||
|
IMAGE="${JSONDIR}/${NAME}-${VERSION}"
|
||||||
|
HASH_IMAGE="${JSONDIR}/${NAME}-${ROOTHASH}"
|
||||||
CRT=${CRT:-${BASEDIR}/${NAME}.crt}
|
CRT=${CRT:-${BASEDIR}/${NAME}.crt}
|
||||||
KEY=${KEY:-${BASEDIR}/${NAME}.key}
|
KEY=${KEY:-${BASEDIR}/${NAME}.key}
|
||||||
|
|
||||||
|
@ -85,11 +89,19 @@ if ! [[ $NOSIGN ]]; then
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[[ -f sha512sum.txt ]] || sha512sum $(find . -type f) > sha512sum.txt
|
[[ -f sha512sum.txt ]] || sha512sum $(find . -type f) > sha512sum.txt
|
||||||
[[ -f sha512sum.txt.sig ]] || openssl dgst -sha256 -sign "$KEY" -out sha512sum.txt.sig sha512sum.txt
|
[[ -f sha512sum.txt.sig ]] || openssl dgst -sha256 -sign "$KEY" -out sha512sum.txt.sig sha512sum.txt
|
||||||
|
|
||||||
popd
|
if ! [[ $NOTAR ]]; then
|
||||||
|
[[ -e "$IMAGE".tgz ]] || tar cf - -C "${IMAGE%/*}" "${IMAGE##*/}" | pigz -c > "${IMAGE}.tgz"
|
||||||
if ! [[ $NOTAR ]] && ! [[ -e "$IMAGE".tgz ]]; then
|
if ! [[ -e "$HASH_IMAGE-efi".tgz ]]; then
|
||||||
tar cf - -C "${IMAGE%/*}" "${IMAGE##*/}" | pigz -c > "$IMAGE".tgz
|
tar cf - efi | pigz -c > "$HASH_IMAGE-efi.tgz"
|
||||||
|
fi
|
||||||
|
[[ $NOSIGN ]] || openssl dgst -sha256 -sign "$KEY" \
|
||||||
|
-out "${HASH_IMAGE}-efi.tgz.sig" "${HASH_IMAGE}-efi.tgz"
|
||||||
|
[[ $NOSIGN ]] || openssl dgst -sha256 -sign "$KEY" \
|
||||||
|
-out "${JSONDIR}/${NAME}-${ROOTHASH}.img.sig" "$IMAGE/root.img"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
Loading…
Reference in a new issue