diff --git a/src/System/Serverman/Actions/Env.hs b/src/System/Serverman/Actions/Env.hs index cb912ff..67ed620 100644 --- a/src/System/Serverman/Actions/Env.hs +++ b/src/System/Serverman/Actions/Env.hs @@ -4,17 +4,18 @@ module System.Serverman.Actions.Env (OS(..), getOS) where import System.IO.Error import Data.Either - data OS = Debian | Arch | Unknown deriving (Show, Eq) + data OS = Debian | Arch | Mac | Unknown deriving (Show, Eq) getOS = do arch_release <- tryIOError $ readProcessWithExitCode "/usr/bin/cat" ["/etc/os-release"] "" deb_release <- tryIOError $ readProcessWithExitCode "/usr/bin/cat" ["/etc/lsb-release"] "" - -- mac_release <- tryIOError $ readProcessWithExitCode "/usr/bin/sw_vers" ["-productVersion"] "" + mac_release <- tryIOError $ readProcessWithExitCode "/usr/bin/sw_vers" ["-productName"] "" let (_, release, _) = head $ rights [arch_release, deb_release, mac_release] distro | or $ map (`isInfixOf` release) ["ubuntu", "debian", "raspbian"] = Debian | "arch" `isInfixOf` release = Arch + | "Mac" `isInfixOf` release = Mac | otherwise = Unknown return distro diff --git a/src/System/Serverman/Actions/Install.hs b/src/System/Serverman/Actions/Install.hs index 23b3eb9..c8133d3 100644 --- a/src/System/Serverman/Actions/Install.hs +++ b/src/System/Serverman/Actions/Install.hs @@ -25,6 +25,7 @@ module System.Serverman.Actions.Install (installService) where let command = case os of Arch -> "pacman -S " Debian -> "apt-get install " + Mac -> "brew install " _ -> "echo 'Unknown operating system'" process <- async $ do