X-Git-Url: https://git.saurik.com/cydia.git/blobdiff_plain/1869a99c20d97931010559d20aedaef0e3225b24..019bd407df21b38dc22972771fc8557e45a844d3:/version.sh diff --git a/version.sh b/version.sh index 1cbbfbf8..3c95ec71 100755 --- a/version.sh +++ b/version.sh @@ -1,2 +1,22 @@ #!/bin/bash -git describe --tags --dirty="+" --match="v*" | sed -e 's@-\([^-]*\)-\([^-]*\)$@+\1.\2@;s@^v@@' + +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}"