Skip to content

Commit

Permalink
Pass environment variables down to makepkg - fixes #606
Browse files Browse the repository at this point in the history
  • Loading branch information
fosskers committed Jun 2, 2020
1 parent bfb2924 commit 38471fb
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions aura/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Aura Changelog

## Unreleased

#### Changed

- Running Aura with `sudo -E aura ...` will ensure that the transfer of the true
user's environment will persist all the way to the internal `makepkg` calls.
This should help people who have set custom paths for GPG, `npm`, etc., via
environment variables. See [#606](https://github.com/fosskers/aura/issues/606).
Users with standard setups don't need to worry about `-E`.

## 3.1.0 (2020-05-27)

#### Added
Expand Down
4 changes: 3 additions & 1 deletion aura/lib/Aura/MakePkg.hs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ make :: MonadIO m
-> ProcessConfig stdin stdout stderr
-> m (ExitCode, BL.ByteString, [FilePath])
make ss (User usr) pc = do
-- Perform the actual building.
(ec, se) <- runIt ss pc
-- Fetch the filenames of the built tarballs.
res <- readProcess $ proc "sudo" ["-u", T.unpack usr, makepkgCmd, "--packagelist"]
let fs = map T.unpack . T.lines . decodeUtf8Lenient . BL.toStrict $ res ^. _2
pure (ec, se, fs)
Expand All @@ -88,4 +90,4 @@ makepkgSource usr = do

-- | As of makepkg v4.2, building with `--asroot` is no longer allowed.
runStyle :: User -> [String] -> (FilePath, [String])
runStyle (User usr) opts = ("sudo", ["-u", T.unpack usr, makepkgCmd] <> opts)
runStyle (User usr) opts = ("sudo", ["-E", "-u", T.unpack usr, makepkgCmd] <> opts)

0 comments on commit 38471fb

Please sign in to comment.