Use resize-dynparts from delta file during OS Upgrade 80/305880/1
authorJacek Kryszyn <j.kryszyn@samsung.com>
Mon, 12 Feb 2024 12:56:24 +0000 (13:56 +0100)
committerJacek Kryszyn <j.kryszyn@samsung.com>
Mon, 12 Feb 2024 14:54:03 +0000 (15:54 +0100)
During OS Upgrade we can not rely on the scripts and programs available
on the system, so from this point on, instead of using resize-dynparts
that is on the system, we use the one provided in the delta file.

Change-Id: I2ff7702dcab670d05e7366d573e461a79c3d06a6

scripts/upgrade-support/upgrade-common.inc
scripts/upgrade-support/upgrade-partial.sh
scripts/upgrade-support/upgrade-trigger.sh

index f429e4c..34e5e0d 100644 (file)
@@ -18,6 +18,10 @@ if [ -z $BLKID_PRINT ]; then
        BLKID_PRINT="/usr/bin/blkid-print"
 fi
 
+if [ -z $RESIZE_DYNPARTS ]; then
+       RESIZE_DYNPARTS="/bin/resize-dynparts"
+fi
+
 #------------------------------------------------
 #       critical_log msg [file]
 #------------------------------------------------
@@ -163,9 +167,9 @@ check_if_super() {
                        # are copying partitions in background. In this case modify size of
                        # NEXT_AB partitions to match size of CURRENT_AB partitions.
                        if [ -f "${FOTA_DIR}/${CONFIG_FILE}" ]; then
-                               /bin/resize-dynparts "${SUPERFS}" "${NEXT_AB}" "${FOTA_DIR}/${CONFIG_FILE}"
+                               "${RESIZE_DYNPARTS}" "${SUPERFS}" "${NEXT_AB}" "${FOTA_DIR}/${CONFIG_FILE}"
                        else
-                               /bin/resize-dynparts "${SUPERFS}" "${NEXT_AB}"
+                               "${RESIZE_DYNPARTS}" "${SUPERFS}" "${NEXT_AB}"
                        fi
 
                        PARSE_DYNPARTS=`/usr/sbin/parse-dynparts "$SUPERFS" --list-tables`
index af090d8..fd99b2a 100755 (executable)
@@ -50,7 +50,6 @@ unpack_file "$DELTA_TAR" "upgrade-apply"
 /bin/chmod +x "$FOTA_DIR/upgrade-apply"
 unpack_file "$DELTA_TAR" "upgrade-apply-deltafs"
 /bin/chmod +x "$FOTA_DIR/upgrade-apply-deltafs"
-BLKID_PRINT="$FOTA_DIR/blkid-print"
 if ! upgrade_images "$DELTA_TAR"; then
        critical_flog "[Error] Unable to upgrade_images"
        cleanup
index 4084f65..fa1e783 100644 (file)
@@ -18,9 +18,11 @@ SCRIPT_UPGRADE_PREPARE_PARTITIONS="upgrade-prepare-partitions.sh"
 SCRIPT_UPGRADE_PARTIAL="upgrade-partial.sh"
 SCRIPT_UPGRADE_FOTA="upgrade-fota.sh"
 BLKID_PRINT_FILE="blkid-print"
+RESIZE_DYNPARTS_FILE="resize-dynparts"
 FLOCK_PATH="/var/lock/clone_partitions.lock"
 DELTA_VERIFIER="/usr/bin/delta-verifier"
 export BLKID_PRINT="$FOTA_DIR/$BLKID_PRINT_FILE"
+export RESIZE_DYNPARTS="$FOTA_DIR/$RESIZE_DYNPARTS_FILE"
 
 prepare_fota_dir() {
        if [ -d "$FOTA_DIR" ]; then
@@ -69,6 +71,9 @@ do_update() {
                unpack_file "${DOWNLOAD_DELTA}" "${BLKID_PRINT_FILE}"
                chmod +x "$FOTA_DIR/$BLKID_PRINT_FILE"
 
+               unpack_file "${DOWNLOAD_DELTA}" "${RESIZE_DYNPARTS_FILE}"
+               chmod +x "$FOTA_DIR/$RESIZE_DYNPARTS_FILE"
+
                unpack_file "$DOWNLOAD_DELTA" "$CONFIG_FILE"
 
                if [ "$(device_board_get_partition_ab_cloned)" -eq 0 ]; then