bugfix
Fix symlink detection Also, make idempotent; cp may fail if the destination file exists in some cases.
This commit is contained in:
parent
76bb9ca43a
commit
d0d416b215
1 changed files with 4 additions and 2 deletions
|
@ -51,7 +51,7 @@ installGitLibs topdir = do
|
|||
destf <- (gitcoredestdir </>)
|
||||
<$> relPathDirToFile execpath f
|
||||
createDirectoryIfMissing True (takeDirectory destf)
|
||||
issymlink <- isSymbolicLink <$> getFileStatus f
|
||||
issymlink <- isSymbolicLink <$> getSymbolicLinkStatus f
|
||||
if issymlink
|
||||
then do
|
||||
-- many git-core files may symlink to eg
|
||||
|
@ -61,6 +61,7 @@ installGitLibs topdir = do
|
|||
linktarget <- readSymbolicLink f
|
||||
let linktarget' = gitcoredestdir </> "bin" </> takeFileName linktarget
|
||||
createDirectoryIfMissing True (takeDirectory linktarget')
|
||||
nukeFile destf
|
||||
createSymbolicLink linktarget' destf
|
||||
else cp f destf
|
||||
|
||||
|
@ -87,7 +88,8 @@ installGitLibs topdir = do
|
|||
[] -> error $ "git " ++ opt ++ "did not output a location"
|
||||
(p:_) -> return p
|
||||
|
||||
cp src dest =
|
||||
cp src dest = do
|
||||
nukeFile dest
|
||||
unlessM (boolSystem "cp" [Param "-a", File src, File dest]) $
|
||||
error "cp failed"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue