add a little function in daklib/utils.py to return the unix username, make nsi and transitions use this
Signed-off-by: Joerg Jaspert <joerg@debian.org>
Options = Cnf.SubTree("Security-Install::Options")
- whoami = os.getuid()
- whoamifull = pwd.getpwuid(whoami)
- username = whoamifull[0]
+ username = utils.getusername()
if username != "dak":
print "Non-dak user: %s" % username
Options["Sudo"] = "y"
if Options["help"]:
usage()
- whoami = os.getuid()
- whoamifull = pwd.getpwuid(whoami)
- username = whoamifull[0]
+ username = utils.getusername()
if username != "dak":
print "Non-dak user: %s" % username
Options["sudo"] = "y"
def whoami ():
return pwd.getpwuid(os.getuid())[4].split(',')[0].replace('.', '')
+def getusername ():
+ return pwd.getpwuid(os.getuid())[0]
+
################################################################################
def size_type (c):