summaryrefslogtreecommitdiff
path: root/version.sh
blob: 3c95ec71093ac6e38117c07f8487fee9f9f52e26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/bin/bash

if [[ $# -eq 0 ]]; then
    flags=(--dirty="+")
else
    flags=("$@")
fi

version=$(git describe --tags --match="v*" "${flags[@]}" | sed -e 's@-\([^-]*\)-\([^-]*\)$@+\1.\2@;s@^v@@;s@%@~@g')

if grep '#define ForRelease 0' MobileCydia.mm &>/dev/null; then
    version=${version}~srk
fi

define="#define CYDIA_VERSION \"${version}\""
before=$(cat Version.h 2>/dev/null)

if [[ ${before} != ${define} ]]; then
    echo "${define}" >Version.h
fi

echo "${version}"