about summary refs log tree commit diff
path: root/nixos/modules
diff options
context:
space:
mode:
authorThomas Strobel <ts468@cam.ac.uk>2015-02-16 19:41:08 +0100
committerThomas Strobel <ts468@cam.ac.uk>2015-02-20 17:42:22 +0100
commitc62e42e9c5f399b99d41abae77eab36cfb4edf58 (patch)
treeed9a695936962b4b399620b85eff4016bbfc56c6 /nixos/modules
parent263a49be2091b8752a45f7e8b269e599fdd709d1 (diff)
downloadnixlib-c62e42e9c5f399b99d41abae77eab36cfb4edf58.tar
nixlib-c62e42e9c5f399b99d41abae77eab36cfb4edf58.tar.gz
nixlib-c62e42e9c5f399b99d41abae77eab36cfb4edf58.tar.bz2
nixlib-c62e42e9c5f399b99d41abae77eab36cfb4edf58.tar.lz
nixlib-c62e42e9c5f399b99d41abae77eab36cfb4edf58.tar.xz
nixlib-c62e42e9c5f399b99d41abae77eab36cfb4edf58.tar.zst
nixlib-c62e42e9c5f399b99d41abae77eab36cfb4edf58.zip
Enhance stage-1/2 scripts for better dealing with squashfs
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh3
-rw-r--r--nixos/modules/system/boot/stage-2-init.sh6
2 files changed, 7 insertions, 2 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index 1e173f5ac7af..a34a13602650 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -218,6 +218,9 @@ checkFS() {
     # Don't check resilient COWs as they validate the fs structures at mount time
     if [ "$fsType" = btrfs -o "$fsType" = zfs ]; then return 0; fi
 
+    # Skip fsck for inherently readonly filesystems.
+    if [ "$fsType" = squashfs ]; then return 0; fi
+
     # If we couldn't figure out the FS type, then skip fsck.
     if [ "$fsType" = auto ]; then
         echo 'cannot check filesystem with type "auto"!'
diff --git a/nixos/modules/system/boot/stage-2-init.sh b/nixos/modules/system/boot/stage-2-init.sh
index 356a440b17ac..173453a17f71 100644
--- a/nixos/modules/system/boot/stage-2-init.sh
+++ b/nixos/modules/system/boot/stage-2-init.sh
@@ -50,8 +50,10 @@ echo "booting system configuration $systemConfig" > /dev/kmsg
 # Make /nix/store a read-only bind mount to enforce immutability of
 # the Nix store.  Note that we can't use "chown root:nixbld" here
 # because users/groups might not exist yet.
-chown 0:30000 /nix/store
-chmod 1775 /nix/store
+# Silence chown/chmod to fail gracefully on a readonly filesystem
+# like squashfs.
+chown -f 0:30000 /nix/store
+chmod -f 1775 /nix/store
 if [ -n "@readOnlyStore@" ]; then
     if ! readonly-mountpoint /nix/store; then
         mount --bind /nix/store /nix/store