diff --git a/app/rofi-dev.hs b/app/rofi-dev.hs index cacfaed..4917655 100644 --- a/app/rofi-dev.hs +++ b/app/rofi-dev.hs @@ -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 = diff --git a/lib/Rofi/Command.hs b/lib/Rofi/Command.hs index c09da9f..46b3baa 100644 --- a/lib/Rofi/Command.hs +++ b/lib/Rofi/Command.hs @@ -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"]