From 5786ffe7d2707bac5246d75f1c2dfb5afd841222 Mon Sep 17 00:00:00 2001 From: Bananymous Date: Thu, 31 Aug 2023 21:37:30 +0300 Subject: [PATCH] BuildSystem: Add cmake target to validate main partition --- CMakeLists.txt | 5 +++++ check-fs.sh | 10 ++++++++++ 2 files changed, 15 insertions(+) create mode 100755 check-fs.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index 951fd91743..5526a85108 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 diff --git a/check-fs.sh b/check-fs.sh new file mode 100755 index 0000000000..253c341c9d --- /dev/null +++ b/check-fs.sh @@ -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