Patrick Georgi | f61c9e9 | 2015-07-13 22:48:46 +0200 | [diff] [blame] | 1 | #!/bin/bash |
Philipp Deppenwiese | 6e4204a | 2016-09-08 22:35:48 +0200 | [diff] [blame^] | 2 | # ${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) |
| 6 | VERSION_NAME=${1} |
| 7 | COMMIT_ID=${2} |
| 8 | USERNAME=${3} |
| 9 | GPG_KEY_ID=${4} |
| 10 | |
Patrick Georgi | f61c9e9 | 2015-07-13 22:48:46 +0200 | [diff] [blame] | 11 | set -e |
Philipp Deppenwiese | 6e4204a | 2016-09-08 22:35:48 +0200 | [diff] [blame^] | 12 | if [ -z "${VERSION_NAME}" ] || [ "${VERSION_NAME}" = "--help" ]; then |
| 13 | echo "usage: $0 <version> [commit id] [gpg key id] [username]" |
Patrick Georgi | f61c9e9 | 2015-07-13 22:48:46 +0200 | [diff] [blame] | 14 | echo "tags a new coreboot version and creates a tar archive" |
| 15 | exit 1 |
| 16 | fi |
Philipp Deppenwiese | 6e4204a | 2016-09-08 22:35:48 +0200 | [diff] [blame^] | 17 | if [ -n "${USERNAME}" ]; then |
| 18 | git clone --recurse-submodules ssh://${USERNAME}@review.coreboot.org:29418/coreboot.git coreboot-${VERSION_NAME} |
| 19 | else |
| 20 | git clone --recurse-submodules https://review.coreboot.org/coreboot.git coreboot-${VERSION_NAME} |
| 21 | fi |
| 22 | cd coreboot-${VERSION_NAME} |
| 23 | if [ -n "${COMMIT_ID}" ]; then |
| 24 | git reset --hard ${COMMIT_ID} |
Patrick Georgi | 68e3f6d | 2016-01-29 23:02:56 +0100 | [diff] [blame] | 25 | fi |
Patrick Georgi | f61c9e9 | 2015-07-13 22:48:46 +0200 | [diff] [blame] | 26 | git submodule update --init --checkout |
Philipp Deppenwiese | 6e4204a | 2016-09-08 22:35:48 +0200 | [diff] [blame^] | 27 | if [ -n "${GPG_KEY_ID}" ]; then |
| 28 | git tag -a -s -u ${GPG_KEY_ID} --force ${VERSION_NAME} -m "coreboot version ${VERSION_NAME}" |
| 29 | else |
| 30 | git tag -a --force ${VERSION_NAME} -m "coreboot version ${VERSION_NAME}" |
| 31 | fi |
| 32 | printf "${VERSION_NAME}-$(git log --pretty=%H|head -1)\n" > .coreboot-version |
Patrick Georgi | 68e3f6d | 2016-01-29 23:02:56 +0100 | [diff] [blame] | 33 | tstamp=$(git log --pretty=format:%ci -1) |
Patrick Georgi | f61c9e9 | 2015-07-13 22:48:46 +0200 | [diff] [blame] | 34 | cd .. |
Philipp Deppenwiese | 6e4204a | 2016-09-08 22:35:48 +0200 | [diff] [blame^] | 35 | 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 |
| 36 | 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 |
| 37 | if [ -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 |
| 40 | fi |