BuildSystem: Add cmake target to validate main partition

This commit is contained in:
Bananymous 2023-08-31 21:37:30 +03:00
parent 65501837b7
commit 104b2740bc
2 changed files with 15 additions and 0 deletions

View File

@ -78,6 +78,11 @@ add_custom_target(image-full
USES_TERMINAL
)
add_custom_target(check-fs
COMMAND ${CMAKE_COMMAND} -E env DISK_IMAGE_PATH="${DISK_IMAGE_PATH}" ${CMAKE_SOURCE_DIR}/check-fs.sh
USES_TERMINAL
)
add_custom_target(qemu
COMMAND ${CMAKE_COMMAND} -E env BANAN_ARCH="${BANAN_ARCH}" DISK_IMAGE_PATH="${DISK_IMAGE_PATH}" ${CMAKE_SOURCE_DIR}/qemu.sh
DEPENDS image

10
check-fs.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -e
LOOP_DEV=$(sudo losetup -f --show $DISK_IMAGE_PATH)
sudo partprobe $LOOP_DEV
sudo fsck.ext2 -fn ${LOOP_DEV}p2 || true
sudo losetup -d $LOOP_DEV