diff options
author | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-11T17·44+0000 |
---|---|---|
committer | Eelco Dolstra <e.dolstra@tudelft.nl> | 2008-12-11T17·44+0000 |
commit | 5a569509b491d43bfcb5c72e85a6d7374a583228 (patch) | |
tree | 28d2106e4b3202e39c471f4716c453f111ef2574 /src/libstore/build.cc | |
parent | 7c54f1603f0c793bfc1f191aaa0ec71441038515 (diff) |
* Provide a minimal /etc/passwd in the chroot to keep some builders
happy.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r-- | src/libstore/build.cc | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index ab3a46aa8319..466e3326d5f8 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -1673,6 +1673,17 @@ void DerivationGoal::startBuilder() if (chmod(chrootTmpDir.c_str(), 01777) == -1) throw SysError("creating /tmp in the chroot"); + /* Create a /etc/passwd with entries for the build user and + the nobody account. The latter is kind of a hack to + support Samba-in-QEMU. */ + createDirs(chrootRootDir + "/etc"); + + writeStringToFile(chrootRootDir + "/etc/passwd", + (format( + "nixbld:x:%1%:65534:Nix build user:/:/noshell\n" + "nobody:x:65534:65534:Nobody:/:/noshell\n") + % (buildUser.enabled() ? buildUser.getUID() : getuid())).str()); + /* Bind-mount a user-configurable set of directories from the host file system. The `/dev/pts' directory must be mounted separately so that newly-created pseudo-terminals show @@ -1770,7 +1781,7 @@ void DerivationGoal::startBuilder() safe. Also note that setuid() when run as root sets the real, effective and saved UIDs. */ if (buildUser.enabled()) { - printMsg(lvlChatty, format("switching to user `%1%'") % buildUser.getUser()); + debug(format("switching to user `%1%'") % buildUser.getUser()); if (amPrivileged()) { |