mirror of
https://github.com/j-a-n/raspberrymatic-addon-rmupdate.git
synced 2023-10-10 13:37:40 +02:00
New partition layout
This commit is contained in:
parent
4b88d54c1e
commit
0ce9aaa02b
@ -1,8 +1,7 @@
|
||||
#!/bin/bash -e
|
||||
|
||||
LOOP_DEV=7
|
||||
BOOT_SIZE=$((100*1024*1024))
|
||||
GAP_SIZE=$((200*1024*1024)) # Reserved space for future use
|
||||
BOOT_SIZE=$((250*1024*1024))
|
||||
ROOT_SIZE=$((1000*1024*1024))
|
||||
USR_LOCAL_SIZE=$((2*1024*1024))
|
||||
|
||||
@ -24,14 +23,14 @@ echo "image: ${image_file}"
|
||||
echo "adjusted image: ${new_image_file}"
|
||||
|
||||
echo "*** Creating new image file and partitions ***"
|
||||
dd if=/dev/zero of=$new_image_file bs=1M count=$((((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/1024/1024)+1))
|
||||
dd if=/dev/zero of=$new_image_file bs=1M count=$((((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}+${USR_LOCAL_SIZE})/1024/1024)+1))
|
||||
parted --script $new_image_file \
|
||||
mklabel msdos \
|
||||
mkpart primary fat32 512B ${BOOT_SIZE}B \
|
||||
set 1 boot on \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}))B $((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}))B \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100%
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}))B \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}))B $((${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B \
|
||||
mkpart primary ext4 $((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE}))B 100%
|
||||
|
||||
echo "*** Copying original partitons ***"
|
||||
oIFS="$IFS"
|
||||
@ -45,8 +44,8 @@ for line in $(parted $image_file unit B print | grep primary); do
|
||||
echo $num - $start - $size
|
||||
seek=0
|
||||
[ "$num" = "1" ] && seek=$start
|
||||
[ "$num" = "2" ] && seek=$(((512+${BOOT_SIZE}+${GAP_SIZE})/512))
|
||||
[ "$num" = "3" ] && seek=$(((512+${BOOT_SIZE}+${GAP_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512))
|
||||
[ "$num" = "2" ] && seek=$(((512+${BOOT_SIZE})/512))
|
||||
[ "$num" = "3" ] && seek=$(((512+${BOOT_SIZE}+${ROOT_SIZE}+${ROOT_SIZE})/512))
|
||||
dd if=$image_file of=$new_image_file bs=512 skip=$start count=$size seek=$seek conv=notrunc
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user