From 601ddfd3f982e49131325407fa4f9c01e73b9d45 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Thu, 12 Nov 2020 22:30:23 +0100 Subject: [PATCH] create /.first_boot if swap and share partitions exist Signed-off-by: Michel-FK --- FunKey/board/funkey/update_partition | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/FunKey/board/funkey/update_partition b/FunKey/board/funkey/update_partition index 4c00567..c5c4a2e 100755 --- a/FunKey/board/funkey/update_partition +++ b/FunKey/board/funkey/update_partition @@ -9,7 +9,7 @@ root_mount=/tmp/rootfs do_preinst() { - notif " 1/3 EXTRACT FIRMWARE UPDATE.." + notif " 1/5 EXTRACT FIRMWARE UPDATE.." exit 0 } @@ -17,14 +17,35 @@ do_postinst() { local version - notif " 2/3 RESIZE ROOT FILESYSTEM" + notif "2/5 RESIZE ROOT FILESYSTEM" resize2fs ${root_part} if [ $? -ne 0 ]; then notif "CANNOT RESIZE ROOT FILESYSTEM" exit 1 fi + notif "3/5 MOUNT ROOT FILESYSTEM" + mkdir -p ${root_mount} + mount -t ext4 ${root_part} ${root_mount} + if [ $? -ne 0 ]; then + notif "CANNOT MOUNT ROOT FILESYSTEM" + exit 1 + fi + sgdisk /dev/mmcblk0 | grep swap + if [ $? -eq 0 ]; then + sgdisk /dev/mmcblk0 | grep share + if [ $? -eq 0 ]; then + touch $[root_mount]/.first_boot + fi + fi + notif "4/5 UNMOUNT ROOT FILESYSTEM" + touch "${root_mount}/.first_boot" + umount ${root_mount} + if [ $? -ne 0 ]; then + notif "CANNOT UNMOUNT ROOT FILESYSTEM" + exit 1 + fi for file in $(ls /mnt/FunKey-rootfs-*.fwu); do - notif "3/3 ERASE UPDATE FILE" + notif "5/5 ERASE UPDATE FILE" rm -f "${file}" done exit 0