X-Git-Url: https://git.grml.org/?p=grml2usb.git;a=blobdiff_plain;f=grml2usb;h=b4bbf3c5d36be939aea1110dbb633cd6bb8b0a33;hp=2103bb958ceab170969d484d68f9de1fafad680a;hb=4d800e56b2e2de9cdf1d133fd4ce6680c4918a33;hpb=46166cdc45ea47cf3bf8fd51951ca56a0f994c69;ds=sidebyside diff --git a/grml2usb b/grml2usb index 2103bb9..b4bbf3c 100755 --- a/grml2usb +++ b/grml2usb @@ -32,7 +32,22 @@ import uuid import shutil # The line following this line is patched by debian/rules and tarball.sh. -PROG_VERSION = '***UNRELEASED***' +PROG_VERSION = '***UNKNOWN***' + +# when running from inside git, try to report version information via git-describe +try: + git_dir = os.path.abspath(os.path.dirname(sys.argv[0])) + with open(os.devnull, 'w') as devnull: + PROG_VERSION = subprocess.check_output(["git", + "-C", + git_dir, + "describe", + "--always", + "--dirty"], + stderr=devnull).strip().decode('utf-8', errors='replace') + \ + " (git)" +except Exception: + pass # global variables MOUNTED = set() # register mountpoints