]> err.no Git - dak/commitdiff
username foo
authorJoerg Jaspert <joerg@debian.org>
Sat, 15 Aug 2009 14:57:58 +0000 (16:57 +0200)
committerJoerg Jaspert <joerg@debian.org>
Sat, 15 Aug 2009 14:57:58 +0000 (16:57 +0200)
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>
dak/new_security_install.py
dak/transitions.py
daklib/utils.py

index f6a7354b9f4a3cac3ba9d47735210f0f0b2b225d..549fe5b57633779f51740c2cf2123ccfb582cc16 100755 (executable)
@@ -60,9 +60,7 @@ def init():
 
     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"
index 2c7d3d8333071b61f41448806f8fc4e007b60e9e..a214337e5a0288d3e8f1ee46d04e3798d747b47e 100755 (executable)
@@ -85,9 +85,7 @@ def init():
     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"
index 951270b5d2074fc380cfaba696d16b4d56bb010d..073b8133ef3174aae090a536b2df337b54dc4e80 100755 (executable)
@@ -820,6 +820,9 @@ def warn(msg):
 def whoami ():
     return pwd.getpwuid(os.getuid())[4].split(',')[0].replace('.', '')
 
+def getusername ():
+    return pwd.getpwuid(os.getuid())[0]
+
 ################################################################################
 
 def size_type (c):