]> git.saurik.com Git - cydia.git/blobdiff - version.sh
Ignore .dSYM folders I am suddenly ending up with.
[cydia.git] / version.sh
index 1cbbfbf8d6f82f8259e5e758f89d3874d31ef38b..3c95ec71093ac6e38117c07f8487fee9f9f52e26 100755 (executable)
@@ -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}"