apfsprogs: build apfs-snap

Build the apfs-snap tool, which was added some time ago.
Also add a NixOS test for it.
This commit is contained in:
Luflosi 2023-05-19 12:16:52 +02:00
parent 58e7a9dc42
commit 2e3134c536
No known key found for this signature in database
GPG key ID: 4E41E29EDCC345D0
2 changed files with 15 additions and 0 deletions

View file

@ -48,5 +48,18 @@ import ./make-test-python.nix ({ pkgs, ... }: {
"umount /tmp/mnt",
"apfsck /dev/vdb",
)
with subtest("Snapshots"):
machine.succeed(
"mkapfs /dev/vdb",
"mount -o cknodes,readwrite /dev/vdb /tmp/mnt",
"echo 'Hello World' > /tmp/mnt/test.txt",
"apfs-snap /tmp/mnt snap-1",
"rm /tmp/mnt/test.txt",
"umount /tmp/mnt",
"mount -o cknodes,readwrite,snap=snap-1 /dev/vdb /tmp/mnt",
"echo 'Hello World' | diff - /tmp/mnt/test.txt",
"umount /tmp/mnt",
"apfsck /dev/vdb",
)
'';
})

View file

@ -17,6 +17,7 @@ stdenv.mkDerivation {
buildPhase = ''
runHook preBuild
make -C apfs-snap $makeFlags
make -C apfsck $makeFlags
make -C mkapfs $makeFlags
runHook postBuild
@ -24,6 +25,7 @@ stdenv.mkDerivation {
installPhase = ''
runHook preInstall
make -C apfs-snap install DESTDIR="$out" $installFlags
make -C apfsck install DESTDIR="$out" $installFlags
make -C mkapfs install DESTDIR="$out" $installFlags
runHook postInstall