2015-09-17 09:16:12 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2019-04-22 12:53:04 +02:00
|
|
|
PRODUCT=scylla
|
2016-01-14 13:25:12 +01:00
|
|
|
VERSION=666.development
|
2015-09-17 09:16:12 +02:00
|
|
|
|
|
|
|
if test -f version
|
|
|
|
then
|
|
|
|
SCYLLA_VERSION=$(cat version | awk -F'-' '{print $1}')
|
|
|
|
SCYLLA_RELEASE=$(cat version | awk -F'-' '{print $2}')
|
|
|
|
else
|
|
|
|
DATE=$(date +%Y%m%d)
|
|
|
|
GIT_COMMIT=$(git log --pretty=format:'%h' -n 1)
|
|
|
|
SCYLLA_VERSION=$VERSION
|
|
|
|
SCYLLA_RELEASE=$DATE.$GIT_COMMIT
|
|
|
|
fi
|
|
|
|
|
2020-09-22 16:10:08 +02:00
|
|
|
usage() {
|
|
|
|
echo "usage: $0"
|
|
|
|
echo " [--version product-version-release] # override p-v-r"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
OVERRIDE=
|
|
|
|
while [[ $# > 0 ]]; do
|
|
|
|
case "$1" in
|
|
|
|
--version)
|
|
|
|
OVERRIDE="$2"
|
|
|
|
shift 2
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
usage
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ -n "$OVERRIDE" ]]; then
|
|
|
|
# regular expression for p-v-r: alphabetic+dashes for product, trailing non-dashes
|
|
|
|
# for release, everything else for version
|
|
|
|
RE='^([-a-z]+)-(.+)-([^-]+)$'
|
|
|
|
PRODUCT="$(sed -E "s/$RE/\\1/" <<<"$OVERRIDE")"
|
|
|
|
SCYLLA_VERSION="$(sed -E "s/$RE/\\2/" <<<"$OVERRIDE")"
|
|
|
|
SCYLLA_RELEASE="$(sed -E "s/$RE/\\3/" <<<"$OVERRIDE")"
|
|
|
|
fi
|
|
|
|
|
2015-09-17 09:16:12 +02:00
|
|
|
echo "$SCYLLA_VERSION-$SCYLLA_RELEASE"
|
|
|
|
mkdir -p build
|
|
|
|
echo "$SCYLLA_VERSION" > build/SCYLLA-VERSION-FILE
|
|
|
|
echo "$SCYLLA_RELEASE" > build/SCYLLA-RELEASE-FILE
|
2019-04-22 12:53:04 +02:00
|
|
|
echo "$PRODUCT" > build/SCYLLA-PRODUCT-FILE
|