From 1384e1e46e6873fdfc1347635b173b3e4e8197dc Mon Sep 17 00:00:00 2001 From: Albrecht Lohofener Date: Thu, 14 Nov 2024 19:46:45 +0100 Subject: [PATCH] Improve message output --- src/mount_openwrt_squashfs_combined.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) mode change 100644 => 100755 src/mount_openwrt_squashfs_combined.sh diff --git a/src/mount_openwrt_squashfs_combined.sh b/src/mount_openwrt_squashfs_combined.sh old mode 100644 new mode 100755 index 94ee97e..c1c6463 --- a/src/mount_openwrt_squashfs_combined.sh +++ b/src/mount_openwrt_squashfs_combined.sh @@ -41,8 +41,7 @@ show_help() { # Function to find the squashfs file system start offset from a OpenWrt given file find_squashfs_offset() { local IMAGE_FILE="$1" - echo >&2 "Start finding start of squashfs file system in file '"$IMAGE_FILE"' ..." - + # Use fdisk to find the squashfs partition local squashfs_start_sectors=`fdisk -l "$IMAGE_FILE" | awk '/^.*squashfs-combined.*.img2/ {print $2}'` # use the 4th ouput as sectors @@ -61,7 +60,6 @@ find_squashfs_offset() { # Function to find the ext4 file system start offset from a OpenWrt given file find_ext4_offset() { local IMAGE_FILE="$1" - echo >&2 "Start finding start of ext4 file system in file '$IMAGE_FILE' ..." # Define the search boundary (in bytes) local SEARCH_BOUNDARY=200 # This is the search boundary for extracting data before and after 'rootfs_data' @@ -156,6 +154,10 @@ fi IMAGE_FILE="$1" CPU_ARCH="$2" +set -Eeuo pipefail + +echo >&2 "Start finding file system offsets in file '"$IMAGE_FILE"' ..." + squashfs_start_offset=$(find_squashfs_offset "$IMAGE_FILE") if [ $CPU_ARCH = "aarch64" ]; then