summaryrefslogtreecommitdiff
path: root/util/release/build-release
blob: d13e0388f48e315ab60e3c7ba00f7bb9146e4df7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
# ${VERSION_NAME}: new version name
# ${GPG_KEY_ID}: gpg key id (if not don't sign)
# ${USERNAME}: username (if not default to https)
# ${COMMIT_ID}: commit id (if not master)
VERSION_NAME=${1}
COMMIT_ID=${2}
USERNAME=${3}
GPG_KEY_ID=${4}

set -e
if [ -z "${VERSION_NAME}" ] || [ "${VERSION_NAME}" = "--help" ]; then
	echo "usage: $0 <version> [commit id] [gpg key id] [username]"
	echo "tags a new coreboot version and creates a tar archive"
	exit 1
fi
if [ -n "${USERNAME}" ]; then
	git clone --recurse-submodules ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git coreboot-${VERSION_NAME}
else
	git clone --recurse-submodules https://review.coreboot.org/coreboot.git coreboot-${VERSION_NAME}
fi
cd coreboot-${VERSION_NAME}
if [ -n "${COMMIT_ID}" ]; then
	git reset --hard ${COMMIT_ID}
fi
git submodule update --init --checkout
if [ -n "${GPG_KEY_ID}" ]; then
	git tag -a -s -u ${GPG_KEY_ID} --force ${VERSION_NAME} -m "coreboot version ${VERSION_NAME}"
else
	git tag -a --force ${VERSION_NAME} -m "coreboot version ${VERSION_NAME}"
fi
printf "${VERSION_NAME}-$(git log --pretty=%H|head -1)\n" > .coreboot-version
tstamp=$(git log --pretty=format:%ci -1)
cd ..
tar --mtime="$tstamp" --owner=coreboot:1000 --group=coreboot:1000 --exclude-vcs --exclude=coreboot-${VERSION_NAME}/3rdparty/blobs -cvf - coreboot-${VERSION_NAME} |xz -9 > coreboot-${VERSION_NAME}.tar.xz
tar --mtime="$tstamp" --owner=coreboot:1000 --group=coreboot:1000 --exclude-vcs -cvf - coreboot-${VERSION_NAME}/3rdparty/blobs |xz -9 > coreboot-blobs-${VERSION_NAME}.tar.xz
if [ -n "${GPG_KEY_ID}" ]; then
	gpg2 --armor --local-user ${GPG_KEY_ID} --output coreboot-${VERSION_NAME}.tar.xz.sig --detach-sig coreboot-${VERSION_NAME}.tar.xz
	gpg2 --armor --local-user ${GPG_KEY_ID} --output coreboot-blobs-${VERSION_NAME}.tar.xz.sig --detach-sig coreboot-blobs-${VERSION_NAME}.tar.xz
fi