forked from lix-project/lix
* Create some state directories automatically as a convenience.
This commit is contained in:
parent
48b58617e9
commit
64e89980e8
|
@ -468,6 +468,8 @@ void UserLock::acquire()
|
||||||
throw Error(format("the user `%1%' in the group `%2%' does not exist")
|
throw Error(format("the user `%1%' in the group `%2%' does not exist")
|
||||||
% *i % buildUsersGroup);
|
% *i % buildUsersGroup);
|
||||||
|
|
||||||
|
createDirs(nixStateDir + "/userpool");
|
||||||
|
|
||||||
fnUserLock = (format("%1%/userpool/%2%") % nixStateDir % pw->pw_uid).str();
|
fnUserLock = (format("%1%/userpool/%2%") % nixStateDir % pw->pw_uid).str();
|
||||||
|
|
||||||
if (lockedPaths.find(fnUserLock) != lockedPaths.end())
|
if (lockedPaths.find(fnUserLock) != lockedPaths.end())
|
||||||
|
|
|
@ -47,7 +47,20 @@ LocalStore::LocalStore()
|
||||||
|
|
||||||
if (readOnlyMode) return;
|
if (readOnlyMode) return;
|
||||||
|
|
||||||
|
/* Create missing state directories if they don't already exist. */
|
||||||
createDirs(nixStore);
|
createDirs(nixStore);
|
||||||
|
createDirs(nixDBPath + "/info");
|
||||||
|
createDirs(nixDBPath + "/referrer");
|
||||||
|
createDirs(nixDBPath + "/failed");
|
||||||
|
Path profilesDir = nixStateDir + "/profiles";
|
||||||
|
createDirs(nixStateDir + "/profiles");
|
||||||
|
createDirs(nixStateDir + "/temproots");
|
||||||
|
Path gcRootsDir = nixStateDir + "/gcroots";
|
||||||
|
if (!pathExists(gcRootsDir)) {
|
||||||
|
createDirs(gcRootsDir);
|
||||||
|
if (symlink(profilesDir.c_str(), (gcRootsDir + "/profiles").c_str()) == -1)
|
||||||
|
throw SysError(format("creating symlink to `%1%'") % profilesDir);
|
||||||
|
}
|
||||||
|
|
||||||
checkStoreNotSymlink();
|
checkStoreNotSymlink();
|
||||||
|
|
||||||
|
@ -65,10 +78,6 @@ LocalStore::LocalStore()
|
||||||
lockFile(globalLock, ltRead, true);
|
lockFile(globalLock, ltRead, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
createDirs(nixDBPath + "/info");
|
|
||||||
createDirs(nixDBPath + "/referrer");
|
|
||||||
createDirs(nixDBPath + "/failed");
|
|
||||||
|
|
||||||
int curSchema = getSchema();
|
int curSchema = getSchema();
|
||||||
if (curSchema > nixSchemaVersion)
|
if (curSchema > nixSchemaVersion)
|
||||||
throw Error(format("current Nix store schema is version %1%, but I only support %2%")
|
throw Error(format("current Nix store schema is version %1%, but I only support %2%")
|
||||||
|
|
Loading…
Reference in a new issue