X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=grml2usb;fp=grml2usb;h=2c4608442b72fe8ded684d903fc703cdd1497f1d;hb=04781c31f262e54131b3231dbc3a5e4bf0783d84;hp=75fcd3ee838b3c01e7de9b6a361f4e98f4c48565;hpb=6fd18cafa8da27f32bb4d9f4199792ee112ce62a;p=grml2usb.git diff --git a/grml2usb b/grml2usb index 75fcd3e..2c46084 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