From 826f0b2de8edf54a5ab28b8476dfbbdb93a34ad8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20DONATH-ILIC?= <129596282+leodonathilic@users.noreply.github.com> Date: Wed, 24 May 2023 11:03:58 +0200 Subject: [PATCH] Update basic_mount_image.sh --- shell_utils/basic_mount_image.sh | 22 +++------------------- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/shell_utils/basic_mount_image.sh b/shell_utils/basic_mount_image.sh index ab6ceb0..4032dd7 100755 --- a/shell_utils/basic_mount_image.sh +++ b/shell_utils/basic_mount_image.sh @@ -1,7 +1,7 @@ #!/bin/bash -# Last update 16/05/2023 (dd/mm/yyyy) by Léo DONATH-ILIC +# Last update 16/05/2023 (dd/mm/yyyy) # This script will mount a given image in loop mode. # Make sure to change the path and offsets for the image you use. You can get @@ -22,10 +22,9 @@ set -e # Double check the path and offsets as noted above! # Path to the image -IMAGE='/home/leo/Downloads/2023-05-03-raspios-bullseye-arm64-lite.img' +IMAGE='' -######################### NEW ######################### # Start sector of boot (first) partition BOOT_START=`sfdisk -J ${IMAGE} | grep -m 1 start | sed 's/"start":\|"\|,//g'` # Amount of sectors of boot (first) partition @@ -34,28 +33,13 @@ BOOT_SIZE=`sfdisk -J ${IMAGE} | grep -m 2 size | tail -n +2 | sed 's/"size":\|"\ ROOT_START=`sfdisk -J ${IMAGE} | grep -m 2 start | tail -n +2 | sed 's/"start":\|"\|,//g'` # Amount of sectors of root (second) partition ROOT_SIZE=`sfdisk -J ${IMAGE} | grep -m 3 size | tail -n +3 | sed 's/"size":\|"\|,//g'` -######################### OLD ######################### -# Start sector of boot (first) partition -#BOOT_START=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` -# Amount of sectors of boot (first) partition -#BOOT_SIZE=`sfdisk -J ${IMAGE} | grep img1 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` -# Start sector of root (second) partition -#ROOT_START=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"start":*\([[:digit:]]*\).*/\1/p'` -# Amount of sectors of root (second) partition -#ROOT_SIZE=`sfdisk -J ${IMAGE} | grep img2 | sed -n 's/.*"size":*\([[:digit:]]*\).*/\1/p'` + # Locations you'd like the partitions mounted BOOT_PATH='/mnt/rpi-boot' ROOTFS_PATH='/mnt/rpi-root' # Calculate offsets for each partition - -############# OLD ############# -#offset_boot=$((${BOOT_START} * 512)) -#sizelimit_boot=$((${BOOT_SIZE} * 512)) -#offset_rootfs=$((${ROOT_START} * 512)) -#sizelimit_rootfs=$((${ROOT_SIZE} * 512)) -############# NEW ############# offset_boot=$[BOOT_START * 512] sizelimit_boot=$[BOOT_SIZE * 512] offset_rootfs=$[ROOT_START * 512]