From 55e4403e6b6af6849508c372eac33a5b89d0b623 Mon Sep 17 00:00:00 2001 From: Jan Schneider Date: Fri, 27 Apr 2018 00:49:01 +0200 Subject: [PATCH] Add repartition update_script --- addon/update_script_repartition | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 addon/update_script_repartition diff --git a/addon/update_script_repartition b/addon/update_script_repartition new file mode 100644 index 0000000..f65caa7 --- /dev/null +++ b/addon/update_script_repartition @@ -0,0 +1,31 @@ +#/bin/sh + +DISK="/dev/mmcblk0" +BOOT_SIZE=268435456 +ROOT_SIZE=1073741824 + +boot_start=$(parted $disk unit B print | grep '^ 1' | sed -n 's/ [1-4] *\([0-9]*\)B *\([0-9]*\)B.*/\1/p') +user_start=$(parted $disk unit B print | grep '^ 4' | sed -n 's/ [1-4] *\([0-9]*\)B *\([0-9]*\)B.*/\1/p') +user_end=$(parted $disk unit B print | grep '^ 4' | sed -n 's/ [1-4] *\([0-9]*\)B *\([0-9]*\)B.*/\2/p') + + +boot_end=$(($boot_start+$BOOT_SIZE-1)) +root_start=$(($boot_end+1)) +root_end=$(($root_start+$ROOT_SIZE-1)) + +#echo $boot_start - $boot_end +#echo $root_start - $root_end +#echo $user_start - $user_end + +parted --script $disk \ + mklabel msdos \ + mkpart primary fat32 ${boot_start}B ${boot_end}B \ + set 1 boot on \ + mkpart primary ext4 ${root_start}B ${root_end}B \ + mkpart primary ext4 ${user_start}B ${user_end}B + +partprobe + +rm "$0" + +fwinstall.sh