make-squashfs: Hack to avoid building images where nixos-install won't run

https://github.com/NixOS/nixpkgs/issues/32242

+27
+27
nixos/lib/make-squashfs.nix
··· 19 # Add the closures of the top-level store objects. 20 storePaths=$(perl ${pathsFromGraph} closure-*) 21 22 # Also include a manifest of the closures in a format suitable 23 # for nix-store --load-db. 24 printRegistration=1 perl ${pathsFromGraph} closure-* > nix-path-registration
··· 19 # Add the closures of the top-level store objects. 20 storePaths=$(perl ${pathsFromGraph} closure-*) 21 22 + # If a Hydra slave happens to have store paths with bad permissions/mtime, 23 + # abort now so that they don't end up in ISO images in the channel. 24 + # https://github.com/NixOS/nixpkgs/issues/32242 25 + hasBadPaths="" 26 + for path in $storePaths; do 27 + if [ -h "$path" ]; then 28 + continue 29 + fi 30 + 31 + mtime=$(stat -c %Y "$path") 32 + mode=$(stat -c %a "$path") 33 + 34 + if [ "$mtime" != 1 ]; then 35 + echo "Store path '$path' has an invalid mtime." 36 + hasBadPaths=1 37 + fi 38 + if [ "$mode" != 444 ] && [ "$mode" != 555 ]; then 39 + echo "Store path '$path' has invalid permissions." 40 + hasBadPaths=1 41 + fi 42 + done 43 + 44 + if [ -n "$hasBadPaths" ]; then 45 + echo "You have bad paths in your store, please fix them." 46 + exit 1 47 + fi 48 + 49 # Also include a manifest of the closures in a format suitable 50 # for nix-store --load-db. 51 printRegistration=1 perl ${pathsFromGraph} closure-* > nix-path-registration