2018-04-03 08:45:39 +02:00
|
|
|
#!/usr/bin/env bash
|
2014-10-04 11:17:06 +02:00
|
|
|
if [ "$#" = "0" ]; then
|
2017-01-24 19:48:55 +01:00
|
|
|
echo "Usage: $0 major|minor|patch|full"
|
2014-10-02 23:03:49 +02:00
|
|
|
exit 1
|
2014-10-02 20:59:22 +02:00
|
|
|
fi
|
2017-01-24 19:48:55 +01:00
|
|
|
|
2014-10-04 11:17:06 +02:00
|
|
|
if [ "$1" = "major" ]; then
|
2014-10-02 20:59:22 +02:00
|
|
|
cat include/rocksdb/version.h | grep MAJOR | head -n1 | awk '{print $3}'
|
|
|
|
fi
|
2014-10-04 11:17:06 +02:00
|
|
|
if [ "$1" = "minor" ]; then
|
2014-10-02 20:59:22 +02:00
|
|
|
cat include/rocksdb/version.h | grep MINOR | head -n1 | awk '{print $3}'
|
|
|
|
fi
|
2014-10-04 11:17:06 +02:00
|
|
|
if [ "$1" = "patch" ]; then
|
2014-10-02 20:59:22 +02:00
|
|
|
cat include/rocksdb/version.h | grep PATCH | head -n1 | awk '{print $3}'
|
|
|
|
fi
|
2017-01-24 19:48:55 +01:00
|
|
|
if [ "$1" = "full" ]; then
|
|
|
|
awk '/#define ROCKSDB/ { env[$2] = $3 }
|
|
|
|
END { printf "%s.%s.%s\n", env["ROCKSDB_MAJOR"],
|
|
|
|
env["ROCKSDB_MINOR"],
|
|
|
|
env["ROCKSDB_PATCH"] }' \
|
|
|
|
include/rocksdb/version.h
|
|
|
|
fi
|