Fix missing version detection for darwin and freebsd
This commit is contained in:
parent
1455c2c175
commit
e7cd952970
@ -79,16 +79,24 @@ getPlatform = do
|
|||||||
"linux" -> do
|
"linux" -> do
|
||||||
(distro, ver) <- liftE getLinuxDistro
|
(distro, ver) <- liftE getLinuxDistro
|
||||||
pure $ PlatformResult { _platform = Linux distro, _distroVersion = ver }
|
pure $ PlatformResult { _platform = Linux distro, _distroVersion = ver }
|
||||||
-- TODO: these are not verified
|
"darwin" -> do
|
||||||
"darwin" ->
|
ver <-
|
||||||
pure $ PlatformResult { _platform = Darwin, _distroVersion = Nothing }
|
(either (const Nothing) Just . versioning . E.decodeUtf8)
|
||||||
|
<$> getDarwinVersion
|
||||||
|
pure $ PlatformResult { _platform = Darwin, _distroVersion = ver }
|
||||||
"freebsd" -> do
|
"freebsd" -> do
|
||||||
ver <- getFreeBSDVersion
|
ver <-
|
||||||
|
(either (const Nothing) Just . versioning . E.decodeUtf8)
|
||||||
|
<$> getFreeBSDVersion
|
||||||
pure $ PlatformResult { _platform = FreeBSD, _distroVersion = ver }
|
pure $ PlatformResult { _platform = FreeBSD, _distroVersion = ver }
|
||||||
what -> throwE $ NoCompatiblePlatform what
|
what -> throwE $ NoCompatiblePlatform what
|
||||||
lift $ $(logDebug) [i|Identified Platform as: #{pfr}|]
|
lift $ $(logDebug) [i|Identified Platform as: #{pfr}|]
|
||||||
pure pfr
|
pure pfr
|
||||||
where getFreeBSDVersion = pure Nothing
|
where
|
||||||
|
getFreeBSDVersion =
|
||||||
|
liftIO $ fmap _stdOut $ executeOut [rel|freebsd-version|] [] Nothing
|
||||||
|
getDarwinVersion =
|
||||||
|
liftIO $ fmap _stdOut $ executeOut [rel|sw_vers|] ["-productVersion"] Nothing
|
||||||
|
|
||||||
|
|
||||||
getLinuxDistro :: (MonadCatch m, MonadIO m)
|
getLinuxDistro :: (MonadCatch m, MonadIO m)
|
||||||
|
Loading…
Reference in New Issue
Block a user