diff --git a/patches/customversion/addpatch.py b/patches/customversion/addpatch.py index 1614bb895..1d391ff2c 100644 --- a/patches/customversion/addpatch.py +++ b/patches/customversion/addpatch.py @@ -1,6 +1,6 @@ #!/bin/env python3 import sys -import os +import getpass import datetime import socket @@ -18,8 +18,15 @@ customtext = customtext.strip(",") timestamp = str(datetime.datetime.utcnow()).split('.')[0] + " UTC" -customtext += ", built on {}@{} at {}".format(os.getlogin(), - socket.gethostname(), +try: + uname = getpass.getuser() +except: + uname = "unknown" + +hostname = socket.gethostname().split(".")[0] + +customtext += ", built on {}@{} at {}".format(uname, + hostname, timestamp) # Replace the target string