aboutsummaryrefslogtreecommitdiff
path: root/Command
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-12-28 15:55:54 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-12-28 16:07:49 -0400
commit357cbaff0221bc2371ebe357dbe2c57a373c11e1 (patch)
treea8c5a5860f48dd990404ca9ff937addf283247c1 /Command
parent248a08d0b05d99b47f8a8f51ff4bde59d70c9c20 (diff)
improve description of password prompting
Since the user does not know whether it will run su or sudo, indicate whether the password prompt will be for root or the user's password, when possible. I assume that programs like gksu that can prompt for either depending on system setup will make clear in their prompt what they're asking for.
Diffstat (limited to 'Command')
-rw-r--r--Command/EnableTor.hs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Command/EnableTor.hs b/Command/EnableTor.hs
index 6f145413d..27e57d649 100644
--- a/Command/EnableTor.hs
+++ b/Command/EnableTor.hs
@@ -49,10 +49,12 @@ start os = do
Just userid -> go uuid userid
else do
showStart "enable-tor" ""
- showLongNote "Need root access to enable tor..."
gitannex <- liftIO readProgramFile
let ps = [Param (cmdname cmd), Param (show curruserid)]
- ifM (liftIO $ runAsRoot gitannex ps)
+ sucommand <- liftIO $ mkSuCommand gitannex ps
+ maybe noop showLongNote
+ (describePasswordPrompt' sucommand)
+ ifM (liftIO $ runSuCommand sucommand)
( next $ next checkHiddenService
, giveup $ unwords $
[ "Failed to run as root:" , gitannex ] ++ toCommand ps