mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
Set up a minimal /dev in chroots
Not bind-mounting the /dev from the host also solves the problem with /dev/shm being a symlink to something not in the chroot.
This commit is contained in:
parent
c9f6232304
commit
3fd01b171a
8 changed files with 40 additions and 17 deletions
|
@ -319,8 +319,7 @@ struct RestoreSink : ParseSink
|
|||
void createSymlink(const Path & path, const string & target)
|
||||
{
|
||||
Path p = dstPath + path;
|
||||
if (symlink(target.c_str(), p.c_str()) == -1)
|
||||
throw SysError(format("creating symlink `%1%'") % p);
|
||||
nix::createSymlink(target, p);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -386,6 +386,13 @@ Paths createDirs(const Path & path)
|
|||
}
|
||||
|
||||
|
||||
void createSymlink(const Path & target, const Path & link)
|
||||
{
|
||||
if (symlink(target.c_str(), link.c_str()))
|
||||
throw SysError(format("creating symlink from `%1%' to `%2%'") % link % target);
|
||||
}
|
||||
|
||||
|
||||
LogType logType = ltPretty;
|
||||
Verbosity verbosity = lvlInfo;
|
||||
|
||||
|
|
|
@ -93,6 +93,9 @@ Path createTempDir(const Path & tmpRoot = "", const Path & prefix = "nix",
|
|||
list of created directories, in order of creation. */
|
||||
Paths createDirs(const Path & path);
|
||||
|
||||
/* Create a symlink. */
|
||||
void createSymlink(const Path & target, const Path & link);
|
||||
|
||||
|
||||
template<class T, class A>
|
||||
T singleton(const A & a)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue