mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-10 08:16:15 +02:00
* Provide a minimal /etc/passwd in the chroot to keep some builders
happy.
This commit is contained in:
parent
7c54f1603f
commit
5a569509b4
1 changed files with 12 additions and 1 deletions
|
@ -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()) {
|
||||
|
||||
|
|
Loading…
Reference in a new issue