blob: d13e0388f48e315ab60e3c7ba00f7bb9146e4df7 [file] [log] [blame]
Patrick Georgif61c9e92015-07-13 22:48:46 +02001#!/bin/bash
Philipp Deppenwiese6e4204a2016-09-08 22:35:48 +02002# ${VERSION_NAME}: new version name
3# ${GPG_KEY_ID}: gpg key id (if not don't sign)
4# ${USERNAME}: username (if not default to https)
5# ${COMMIT_ID}: commit id (if not master)
6VERSION_NAME=${1}
7COMMIT_ID=${2}
8USERNAME=${3}
9GPG_KEY_ID=${4}
10
Patrick Georgif61c9e92015-07-13 22:48:46 +020011set -e
Philipp Deppenwiese6e4204a2016-09-08 22:35:48 +020012if [ -z "${VERSION_NAME}" ] || [ "${VERSION_NAME}" = "--help" ]; then
13 echo "usage: $0 <version> [commit id] [gpg key id] [username]"
Patrick Georgif61c9e92015-07-13 22:48:46 +020014 echo "tags a new coreboot version and creates a tar archive"
15 exit 1
16fi
Philipp Deppenwiese6e4204a2016-09-08 22:35:48 +020017if [ -n "${USERNAME}" ]; then
18 git clone --recurse-submodules ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git coreboot-${VERSION_NAME}
19else
20 git clone --recurse-submodules https://review.coreboot.org/coreboot.git coreboot-${VERSION_NAME}
21fi
22cd coreboot-${VERSION_NAME}
23if [ -n "${COMMIT_ID}" ]; then
24 git reset --hard ${COMMIT_ID}
Patrick Georgi68e3f6d2016-01-29 23:02:56 +010025fi
Patrick Georgif61c9e92015-07-13 22:48:46 +020026git submodule update --init --checkout
Philipp Deppenwiese6e4204a2016-09-08 22:35:48 +020027if [ -n "${GPG_KEY_ID}" ]; then
28 git tag -a -s -u ${GPG_KEY_ID} --force ${VERSION_NAME} -m "coreboot version ${VERSION_NAME}"
29else
30 git tag -a --force ${VERSION_NAME} -m "coreboot version ${VERSION_NAME}"
31fi
32printf "${VERSION_NAME}-$(git log --pretty=%H|head -1)\n" > .coreboot-version
Patrick Georgi68e3f6d2016-01-29 23:02:56 +010033tstamp=$(git log --pretty=format:%ci -1)
Patrick Georgif61c9e92015-07-13 22:48:46 +020034cd ..
Philipp Deppenwiese6e4204a2016-09-08 22:35:48 +020035tar --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
36tar --mtime="$tstamp" --owner=coreboot:1000 --group=coreboot:1000 --exclude-vcs -cvf - coreboot-${VERSION_NAME}/3rdparty/blobs |xz -9 > coreboot-blobs-${VERSION_NAME}.tar.xz
37if [ -n "${GPG_KEY_ID}" ]; then
38 gpg2 --armor --local-user ${GPG_KEY_ID} --output coreboot-${VERSION_NAME}.tar.xz.sig --detach-sig coreboot-${VERSION_NAME}.tar.xz
39 gpg2 --armor --local-user ${GPG_KEY_ID} --output coreboot-blobs-${VERSION_NAME}.tar.xz.sig --detach-sig coreboot-blobs-${VERSION_NAME}.tar.xz
40fi