1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-12-03 23:51:00 +01:00

Invoke remount-hook program when necessary.

This commit is contained in:
Ben Radford 2023-07-26 14:05:54 +01:00 committed by Ben Radford
parent 33ebae75ca
commit ed14286924
4 changed files with 29 additions and 2 deletions

View file

@ -176,6 +176,14 @@ void LocalOverlayStore::registerValidPaths(const ValidPathInfos & infos)
}
void LocalOverlayStore::collectGarbage(const GCOptions & options, GCResults & results)
{
LocalStore::collectGarbage(options, results);
remountIfNecessary();
}
void LocalOverlayStore::deleteStorePath(const Path & path, uint64_t & bytesFreed)
{
auto mergedDir = realStoreDir.get() + "/";
@ -224,6 +232,8 @@ void LocalOverlayStore::optimiseStore()
done++;
act.progress(done, paths.size());
}
remountIfNecessary();
}
@ -235,6 +245,18 @@ Path LocalOverlayStore::toRealPathForHardLink(const StorePath & path)
}
void LocalOverlayStore::remountIfNecessary()
{
if (remountHook.get().empty()) {
warn("'%s' needs remounting, set remount-hook to do this automatically", realStoreDir.get());
} else {
runProgram(remountHook, false, {realStoreDir});
}
_remountRequired = false;
}
static RegisterStoreImplementation<LocalOverlayStore, LocalOverlayStoreConfig> regLocalOverlayStore;
}