Skip to content

Commit

Permalink
[aura] Be a little cleaner with the chmod
Browse files Browse the repository at this point in the history
  • Loading branch information
fosskers committed Oct 29, 2020
1 parent d31ee3e commit 440addd
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions aura/lib/Aura/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ createWritableIfMissing pth = do
-- This is a migration strategy - it ensures that directories created with
-- old versions of Aura automatically have their permissions fixed.
then case pth of
"/var/cache/aura/vcs" -> void . runProcess . setStderr closed . setStdout closed $ proc "chmod" ["755", pth]
"/tmp" -> void . runProcess . setStderr closed . setStdout closed $ proc "chmod" ["1777", pth]
_ -> pure ()
"/var/cache/aura/vcs" -> setMode "755"
"/tmp" -> setMode "1777"
_ -> pure ()
-- The library function `createDirectoryIfMissing` seems to obey umasks when
-- creating directories, which can cause problem later during the build
-- processes of git packages. By manually creating the directory with the
-- expected permissions, we avoid this problem.
else void . runProcess . setStderr closed . setStdout closed $ proc "mkdir" ["-p", "-m755", pth]
where
setMode :: String -> RIO Env ()
setMode mode = void . runProcess . setStderr closed . setStdout closed $ proc "chmod" [mode, pth]

-- | A unique directory name (within the greater "parent" build dir) in which to
-- copy sources and actually build a package.
Expand Down

0 comments on commit 440addd

Please sign in to comment.