1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-01 04:18:00 +02:00

* Add indirect root registration to the protocol so that unprivileged

processes can register indirect roots.  Of course, there is still
  the problem that the garbage collector can only read the targets of
  the indirect roots when it's running as root...
This commit is contained in:
Eelco Dolstra 2006-12-04 23:29:16 +00:00
parent 0d40f6d7bb
commit 74033a844f
7 changed files with 42 additions and 6 deletions

View file

@ -82,6 +82,15 @@ void LocalStore::syncWithGC()
}
void LocalStore::addIndirectRoot(const Path & path)
{
string hash = printHash32(hashString(htSHA1, path));
Path realRoot = canonPath((format("%1%/%2%/auto/%3%")
% nixStateDir % gcRootsDir % hash).str());
createSymlink(realRoot, path, false);
}
Path addPermRoot(const Path & _storePath, const Path & _gcRoot,
bool indirect, bool allowOutsideRootsDir)
{
@ -90,12 +99,8 @@ Path addPermRoot(const Path & _storePath, const Path & _gcRoot,
assertStorePath(storePath);
if (indirect) {
string hash = printHash32(hashString(htSHA1, gcRoot));
Path realRoot = canonPath((format("%1%/%2%/auto/%3%")
% nixStateDir % gcRootsDir % hash).str());
createSymlink(gcRoot, storePath, true);
createSymlink(realRoot, gcRoot, false);
store->addIndirectRoot(gcRoot);
}
else {