blob: 06d8554662e9b08d84c610f03747dff192c075da [file] [log] [blame]
Gerd Hoffmannb7f4a762014-11-17 08:32:00 +01001#!/bin/sh
2#
3# Script to create seabios release and snapshot tarballs.
4# Accepts conmmit (hash, tag, branch, ...) as first argument,
5# uses HEAD if unspecified.
6#
7
8commit="${1-HEAD}"
9
10# figure name for the tarball
11reltag="$(git describe --tags --match 'rel-*' --exact $commit 2>/dev/null)"
12if test "$reltag" != ""; then
13 # release
14 name="${reltag#rel-}"
15else
16 # snapshot
17 reltag="$(git describe --tags --match 'rel-*' $commit 2>/dev/null)"
18 name="snap-${reltag#rel-}"
19fi
20
21# export tarball archive from git
22prefix="seabios-${name}/"
23output="seabios-${name}.tar"
24echo "# commit $commit -> tarball: ${output}.gz"
25rm -f "$output" "${output}.gz"
26git archive --format=tar --prefix="$prefix" "$commit" > "$output"
27
28# add .version file to tarball
29dotver="$(mktemp dotver.XXXXXX)"
30echo "$name" > "$dotver"
31tar --append --file="$output" --owner=root --group=root --mode=0664 \
32 --transform "s:${dotver}:${prefix}.version:" "$dotver"
33rm -f "$dotver"
34
35# finally compress it
36gzip "$output"