ENH make veracript prompt for sudo password
This commit is contained in:
parent
c64d163a48
commit
b3798e8577
|
@ -299,6 +299,8 @@ data VeraCrypt = VeraCrypt Removable FilePath (Maybe Password)
|
|||
|
||||
instance Mountable VeraCrypt where
|
||||
-- TODO this is just like the CIFS version...
|
||||
-- TODO replace the veracrypt binaries with actual vercrypt program
|
||||
-- (the setuid plan failed)
|
||||
mount (VeraCrypt Removable{ label = l } m getPwd) False =
|
||||
bracketOnError_
|
||||
(mkDirMaybe m)
|
||||
|
@ -306,10 +308,10 @@ instance Mountable VeraCrypt where
|
|||
$ io $ do
|
||||
res <- case getPwd of
|
||||
Just pwd -> do
|
||||
rootpass <- maybe "" (++ "\n") <$> readPassword' "Sudo Password"
|
||||
p <- maybe [] (\p -> [("PASSWD", p)]) <$> pwd
|
||||
readCmdEither' "mount" [m] "" p
|
||||
readCmdEither' "sudo" (["-S", "-E", "/usr/bin/mount"] ++ [m]) rootpass p
|
||||
Nothing -> readCmdEither "mount" [m] ""
|
||||
print res
|
||||
notifyMounted (isRight res) False l
|
||||
|
||||
mount (VeraCrypt Removable{ label = l } m _) True =
|
||||
|
|
|
@ -17,6 +17,7 @@ module Rofi.Command
|
|||
, titledGroup
|
||||
, selectAction
|
||||
, readPassword
|
||||
, readPassword'
|
||||
, readCmdSuccess
|
||||
, readCmdEither
|
||||
, readCmdEither'
|
||||
|
@ -183,6 +184,9 @@ joinNewline :: [String] -> String
|
|||
joinNewline = intercalate "\n"
|
||||
|
||||
readPassword :: IO (Maybe String)
|
||||
readPassword = readCmdSuccess "rofi" args ""
|
||||
readPassword = readPassword' "Password"
|
||||
|
||||
readPassword' :: String -> IO (Maybe String)
|
||||
readPassword' p = readCmdSuccess "rofi" args ""
|
||||
where
|
||||
args = dmenuArgs ++ ["-p", "Password", "-password"]
|
||||
args = dmenuArgs ++ ["-p", p, "-password"]
|
||||
|
|
Loading…
Reference in New Issue