Update ZfsDevices.hs

This commit is contained in:
千住柱間 2025-02-19 02:15:23 +00:00
commit c4ceaadd15

View file

@ -4,26 +4,26 @@ import System.Zfs.Zpool
import System.Zfs.Types
import System.Zfs
import Control.Monad.IO.Class
import System.Process (callCommand)
{-
zfs functions can only be accessed throught the zfs monad.
-}
main' :: Zfs ()
main' = do
forZpools_ $ \zpool -> do
our_pools <- getZpools
nm <- getZpoolName zpool
-- effects also must be done within the zfs monad
liftIO $ putStrLn ("Pool: "++nm)
vdevs <- getVdevs zpool
liftIO $ print vdevs
liftIO $ print vdevs
enableDatasets zpool ""
liftIO $ putStrLn "Mounting..."
return ()
main :: IO ()
main = do
-- and you can only run the zfs monad using the "runZfs" function
callCommand "zpool import -a" -- should make a ffi function for it
res <- runZfs main'
case res of
Left e -> print e