mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-11 20:25:32 +03:00
nixos/lib/make-ext4-fs: Add a sanity check
I ended up with a corrupted image with the debugfs contraption once, and given I couldn't reproduce the problem I suppose that happens if the filesystem of the builder runs out of space. At least in this instance fsck could detect it, so let's add it as a sanity check.
This commit is contained in:
parent
76d0e61e7b
commit
bc828721ed
1 changed files with 8 additions and 1 deletions
|
@ -14,7 +14,7 @@ in
|
||||||
pkgs.stdenv.mkDerivation {
|
pkgs.stdenv.mkDerivation {
|
||||||
name = "ext4-fs.img";
|
name = "ext4-fs.img";
|
||||||
|
|
||||||
nativeBuildInputs = with pkgs; [e2fsprogs libfaketime perl];
|
nativeBuildInputs = with pkgs; [e2fsprogs.bin libfaketime perl];
|
||||||
|
|
||||||
buildCommand =
|
buildCommand =
|
||||||
''
|
''
|
||||||
|
@ -83,5 +83,12 @@ pkgs.stdenv.mkDerivation {
|
||||||
echo "--- Failed to create EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks) ---"
|
echo "--- Failed to create EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks) ---"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# I have ended up with corrupted images sometimes, I suspect that happens when the build machine's disk gets full during the build.
|
||||||
|
if ! fsck.ext4 -n -f $out; then
|
||||||
|
echo "--- Fsck failed for EXT4 image of $bytes bytes (numInodes=$numInodes, numDataBlocks=$numDataBlocks) ---"
|
||||||
|
cat errorlog
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue