Don't mount /nix/store ro if it's a mountpoint

In principle this could work, but the current remount logic in nix fails
to remount mountpoints that are root in their own filesystem (as would
be the case with bind-mounting a mountpoint over itself). nixos/nix#98
is aimed at fixing this.

Signed-off-by: Shea Levy <shea@shealevy.com>
This commit is contained in:
Shea Levy 2013-03-08 10:42:34 -05:00
parent bc21ccc981
commit f1d48aec43
2 changed files with 2 additions and 2 deletions

View file

@ -8,7 +8,7 @@ int main(int argc, char ** argv) {
fprintf(stderr, "Usage: %s PATH", argv[0]);
exit(2);
}
if(statvfs(argv[1], &stat) != 0) {
if (statvfs(argv[1], &stat) != 0) {
perror("statvfs");
exit(3);
}

View file

@ -51,7 +51,7 @@ echo "booting system configuration $systemConfig" > /dev/kmsg
chown 0:30000 /nix/store
chmod 1775 /nix/store
if [ -n "@readOnlyStore@" ]; then
if ! readonly-mountpoint /nix/store; then
if ! mountpoint /nix/store; then
mount --bind /nix/store /nix/store
mount -o remount,ro,bind /nix/store
fi