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
|
instance Mountable VeraCrypt where
|
||||||
-- TODO this is just like the CIFS version...
|
-- 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 =
|
mount (VeraCrypt Removable{ label = l } m getPwd) False =
|
||||||
bracketOnError_
|
bracketOnError_
|
||||||
(mkDirMaybe m)
|
(mkDirMaybe m)
|
||||||
|
@ -306,10 +308,10 @@ instance Mountable VeraCrypt where
|
||||||
$ io $ do
|
$ io $ do
|
||||||
res <- case getPwd of
|
res <- case getPwd of
|
||||||
Just pwd -> do
|
Just pwd -> do
|
||||||
|
rootpass <- maybe "" (++ "\n") <$> readPassword' "Sudo Password"
|
||||||
p <- maybe [] (\p -> [("PASSWD", p)]) <$> pwd
|
p <- maybe [] (\p -> [("PASSWD", p)]) <$> pwd
|
||||||
readCmdEither' "mount" [m] "" p
|
readCmdEither' "sudo" (["-S", "-E", "/usr/bin/mount"] ++ [m]) rootpass p
|
||||||
Nothing -> readCmdEither "mount" [m] ""
|
Nothing -> readCmdEither "mount" [m] ""
|
||||||
print res
|
|
||||||
notifyMounted (isRight res) False l
|
notifyMounted (isRight res) False l
|
||||||
|
|
||||||
mount (VeraCrypt Removable{ label = l } m _) True =
|
mount (VeraCrypt Removable{ label = l } m _) True =
|
||||||
|
|
|
@ -17,6 +17,7 @@ module Rofi.Command
|
||||||
, titledGroup
|
, titledGroup
|
||||||
, selectAction
|
, selectAction
|
||||||
, readPassword
|
, readPassword
|
||||||
|
, readPassword'
|
||||||
, readCmdSuccess
|
, readCmdSuccess
|
||||||
, readCmdEither
|
, readCmdEither
|
||||||
, readCmdEither'
|
, readCmdEither'
|
||||||
|
@ -183,6 +184,9 @@ joinNewline :: [String] -> String
|
||||||
joinNewline = intercalate "\n"
|
joinNewline = intercalate "\n"
|
||||||
|
|
||||||
readPassword :: IO (Maybe String)
|
readPassword :: IO (Maybe String)
|
||||||
readPassword = readCmdSuccess "rofi" args ""
|
readPassword = readPassword' "Password"
|
||||||
|
|
||||||
|
readPassword' :: String -> IO (Maybe String)
|
||||||
|
readPassword' p = readCmdSuccess "rofi" args ""
|
||||||
where
|
where
|
||||||
args = dmenuArgs ++ ["-p", "Password", "-password"]
|
args = dmenuArgs ++ ["-p", p, "-password"]
|
||||||
|
|
Loading…
Reference in New Issue