Use the daemon when we don't have write access to the Nix database
This commit is contained in:
parent
4fa08f3edb
commit
9e7c1a4bbd
7 changed files with 57 additions and 13 deletions
|
|
@ -397,9 +397,15 @@ int LocalStore::getSchema()
|
|||
}
|
||||
|
||||
|
||||
bool LocalStore::haveWriteAccess()
|
||||
{
|
||||
return access(settings.nixDBPath.c_str(), R_OK | W_OK) == 0;
|
||||
}
|
||||
|
||||
|
||||
void LocalStore::openDB(bool create)
|
||||
{
|
||||
if (access(settings.nixDBPath.c_str(), R_OK | W_OK))
|
||||
if (!haveWriteAccess())
|
||||
throw SysError(format("Nix database directory ‘%1%’ is not writable") % settings.nixDBPath);
|
||||
|
||||
/* Open the Nix database. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue