update installHLSBindist
to take a "Maybe FilePath" argument for isolated installs
This commit is contained in:
parent
781cf8eed5
commit
7471f4f4dc
16
lib/GHCup.hs
16
lib/GHCup.hs
@ -530,6 +530,7 @@ installHLSBindist :: ( MonadMask m
|
|||||||
)
|
)
|
||||||
=> DownloadInfo
|
=> DownloadInfo
|
||||||
-> Version
|
-> Version
|
||||||
|
-> Maybe FilePath -- ^ isolated install path, if user passed any
|
||||||
-> Excepts
|
-> Excepts
|
||||||
'[ AlreadyInstalled
|
'[ AlreadyInstalled
|
||||||
, CopyError
|
, CopyError
|
||||||
@ -545,12 +546,16 @@ installHLSBindist :: ( MonadMask m
|
|||||||
]
|
]
|
||||||
m
|
m
|
||||||
()
|
()
|
||||||
installHLSBindist dlinfo ver = do
|
installHLSBindist dlinfo ver isoFilepath = do
|
||||||
lift $ $(logDebug) [i|Requested to install hls version #{ver}|]
|
lift $ $(logDebug) [i|Requested to install hls version #{ver}|]
|
||||||
|
|
||||||
PlatformRequest {..} <- lift getPlatformReq
|
PlatformRequest {..} <- lift getPlatformReq
|
||||||
Dirs {..} <- lift getDirs
|
Dirs {..} <- lift getDirs
|
||||||
|
|
||||||
|
let isIsolatedInstall = isJust isoFilepath
|
||||||
|
|
||||||
|
-- we only check for already installed in regular (non-isolated) installs
|
||||||
|
when (not isIsolatedInstall) $
|
||||||
whenM (lift (hlsInstalled ver))
|
whenM (lift (hlsInstalled ver))
|
||||||
(throwE $ AlreadyInstalled HLS ver)
|
(throwE $ AlreadyInstalled HLS ver)
|
||||||
|
|
||||||
@ -564,10 +569,17 @@ installHLSBindist dlinfo ver = do
|
|||||||
|
|
||||||
-- the subdir of the archive where we do the work
|
-- the subdir of the archive where we do the work
|
||||||
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
workdir <- maybe (pure tmpUnpack) (liftE . intoSubdir tmpUnpack) (view dlSubdir dlinfo)
|
||||||
|
let isoDir = fromJust isoFilepath
|
||||||
|
|
||||||
|
if isIsolatedInstall
|
||||||
|
then do
|
||||||
|
lift $ $(logInfo) [i|isolated installing HLS to #{isoDir}|]
|
||||||
|
liftE $ installHLS' workdir isoDir ver
|
||||||
|
else do
|
||||||
liftE $ installHLS' workdir binDir ver
|
liftE $ installHLS' workdir binDir ver
|
||||||
|
|
||||||
-- create symlink if this is the latest version
|
-- create symlink if this is the latest version in a regular install
|
||||||
|
whenM (pure $ not isIsolatedInstall) $ do
|
||||||
hlsVers <- lift $ fmap rights getInstalledHLSs
|
hlsVers <- lift $ fmap rights getInstalledHLSs
|
||||||
let lInstHLS = headMay . reverse . sort $ hlsVers
|
let lInstHLS = headMay . reverse . sort $ hlsVers
|
||||||
when (maybe True (ver >=) lInstHLS) $ liftE $ setHLS ver
|
when (maybe True (ver >=) lInstHLS) $ liftE $ setHLS ver
|
||||||
|
Loading…
Reference in New Issue
Block a user