From: Anthony Towns Date: Fri, 21 Mar 2008 20:17:47 +0000 (+0000) Subject: Change sudo otpion to match dak new-security-instal (-s, --sudo, automatically X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f77be3fe3afcc24b865ab043f1383483c46c3efc;p=dak Change sudo otpion to match dak new-security-instal (-s, --sudo, automatically implied for non-dak users) --- diff --git a/dak/transitions.py b/dak/transitions.py index 121edc2f..d1d62cdf 100755 --- a/dak/transitions.py +++ b/dak/transitions.py @@ -23,7 +23,7 @@ ################################################################################ -import os, pg, sys, time, errno, fcntl, tempfile +import os, pg, sys, time, errno, fcntl, tempfile, pwd import apt_pkg import daklib.database import daklib.utils @@ -47,7 +47,7 @@ def init(): ('e',"edit","Edit-Transitions::Options::Edit"), ('i',"import","Edit-Transitions::Options::Import", "HasArg"), ('c',"check","Edit-Transitions::Options::Check"), - ('S',"use-sudo","Edit-Transitions::Options::Sudo"), + ('s',"sudo","Edit-Transitions::Options::Sudo"), ('n',"no-action","Edit-Transitions::Options::No-Action")] for i in ["help", "no-action", "edit", "import", "check", "sudo"]: @@ -58,6 +58,13 @@ def init(): Options = Cnf.SubTree("Edit-Transitions::Options") + whoami = os.getuid() + whoamifull = pwd.getpwuid(whoami) + username = whoamifull[0] + if username != "dak": + print "Non-dak user: %s" % username + Options["sudo"] = "y" + projectB = pg.connect(Cnf["DB::Name"], Cnf["DB::Host"], int(Cnf["DB::Port"])) daklib.database.init(Cnf, projectB)