customversion: make script less likely to error in systemd services
This commit is contained in:
parent
9fd72d479e
commit
3f97a21677
1 changed files with 10 additions and 3 deletions
|
@ -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
|
||||
|
|
Reference in a new issue