initramfs-ostree: fix re-installing ustart image error messages

While re-installing ustart image, there are some error messages:

- `blockdev --rereadpt ${dev}' always failed due to existed lvm
  volume group was not cleanup because of ustart image skip fat
  partition format (instsf=1). Then move the cleanup code ahead
  for both of skip and not skip situation

- Remove `-t $p:FFFF' from platform_backup partition which is
  not recognized by sgdisk

- Add `--yes' to vgcreate and lvcreate to avoid prompt hung

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Change-Id: I865bb95a8a00bbc4144d782d4ccd1a20fcf5eaa7

Test Plan:
- PASS: Download initramfs-ostree source tarball
- PASS: Build package initramfs-ostree
- PASS: Build Ustart image
- PASS: Install Ustart image
- PASS: Boot installed image, multiple partitions mounted to
        rootfs
- PASS: Reinstall Ustart image
- PASS: Boot installed image, multiple partitions mounted to
        rootfs

Story: 2008846
Task: 44545

Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
Change-Id: Ia771c7ee2e5dd7fa9d6946877738357e863411f5
This commit is contained in:
Hongxu Jia 2022-02-23 23:41:39 +08:00
parent 8eac15b4f2
commit 61889ee968

View File

@ -17,7 +17,7 @@ Signed-off-by: Hongxu Jia <hongxu.jia@windriver.com>
1 file changed, 117 insertions(+), 2 deletions(-)
diff --git a/init-ostree-install.sh b/init-ostree-install.sh
index c46650f..e7b1224 100644
index c46650f..0a84179 100644
--- a/init-ostree-install.sh
+++ b/init-ostree-install.sh
@@ -86,7 +86,9 @@ OPTIONAL:
@ -70,15 +70,56 @@ index c46650f..e7b1224 100644
}
shell_start() {
@@ -720,6 +731,40 @@ grub_partition() {
a=""
first=`sgdisk -F ${dev}|grep -v Creating`
else
@@ -779,6 +790,40 @@ grub_partition() {
fi
fi
+ ############################################
+ # StarlingX: Clean up the volume group
+ # StarlingX: Temp partitioning compatability
+ if [ "$INSTSTX" = 1 ] ; then
+ if [ "$VSZ" = 0 ] ; then
+ # /var using up the remainder of the disk
+ echo "WARNING WARNING - Can't allocate StarlingX partitions, /var will use the remainder of the disk"
+ else
+ case $PERSONALITY in
+ aio)
+ echo "Allocating StarlingX AIO host partitioning"
+ CGCS_PV_SIZE=183296
+ PLATFORM_BACKUP_SIZE=30000
+
+ grub_pt_update
+ end=$(($first+($PLATFORM_BACKUP_SIZE*1024*1024/$lsz)-1))
+ a="$a -n $p:$first:$end -c $p:platform_backup"
+ grub_pt_update
+ end=$(($first+($CGCS_PV_SIZE*1024*1024/$lsz)-1))
+ a="$a -n $p:$first:$end -c $p:platform_pv -t $p:8E00"
+ ;;
+ con)
+ echo "WARNING WARNING: StarlingX standard controller host partitioning not supported"
+ ;;
+ wor)
+ echo "WARNING WARNING: StarlingX worker host partitioning not supported"
+ ;;
+ sto)
+ echo "WARNING WARNING: StarlingX storage host partitioning not supported"
+ ;;
+ esac
+ fi
+ fi
+ ############################################
+
sgdisk $a -p ${dev}
}
@@ -943,6 +988,40 @@ if [ -n "${KS}" ]; then
fi
fi
+############################################
+# StarlingX: Clean up the volume group
+if [ "$INSTSTX" = 1 ] ; then
+ if [ "$VSZ" = 0 ] ; then
+ # /var using up the remainder of the disk
+ echo "WARNING WARNING - No volume group info to clean up, /var will use the remainder of the disk"
+ else
+ case $PERSONALITY in
@ -105,53 +146,12 @@ index c46650f..e7b1224 100644
+ ;;
+ esac
+ fi
+ fi
+ ############################################
+fi
+############################################
+
sgdisk -Z ${dev}
first=`sgdisk -F ${dev}|grep -v Creating`
if [ "$BIOSPLUSEFI" = "1" ] ; then
@@ -779,6 +824,40 @@ grub_partition() {
fi
fi
+ ############################################
+ # StarlingX: Temp partitioning compatability
+ if [ "$INSTSTX" = 1 ] ; then
+ if [ "$VSZ" = 0 ] ; then
+ # /var using up the remainder of the disk
+ echo "WARNING WARNING - Can't allocate StarlingX partitions, /var will use the remainder of the disk"
+ else
+ case $PERSONALITY in
+ aio)
+ echo "Allocating StarlingX AIO host partitioning"
+ CGCS_PV_SIZE=183296
+ PLATFORM_BACKUP_SIZE=30000
+
+ grub_pt_update
+ end=$(($first+($PLATFORM_BACKUP_SIZE*1024*1024/$lsz)-1))
+ a="$a -n $p:$first:$end -c $p:platform_backup -t $p:FFFF"
+ grub_pt_update
+ end=$(($first+($CGCS_PV_SIZE*1024*1024/$lsz)-1))
+ a="$a -n $p:$first:$end -c $p:platform_pv -t $p:8E00"
+ ;;
+ con)
+ echo "WARNING WARNING: StarlingX standard controller host partitioning not supported"
+ ;;
+ wor)
+ echo "WARNING WARNING: StarlingX worker host partitioning not supported"
+ ;;
+ sto)
+ echo "WARNING WARNING: StarlingX storage host partitioning not supported"
+ ;;
+ esac
+ fi
+ fi
+ ############################################
+
sgdisk $a -p ${dev}
}
# Early curl exec
if [ "${ECURL}" != "" -a "${ECURL}" != "none" ] ; then
@@ -1145,6 +1224,42 @@ if [ "$BL" = "grub" -a "$INSTFMT" != "0" ] ; then
mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART}
fi
@ -172,8 +172,8 @@ index c46650f..e7b1224 100644
+ mkfs.ext4 -F -L platform_backup ${fs_dev}${pi}
+
+ pi=$((pi+1))
+ vgcreate --force cgts-vg ${fs_dev}${pi}
+ lvcreate -n log-lv --size "${LOG_VOL_SIZE}MB" cgts-vg
+ vgcreate --yes --force cgts-vg ${fs_dev}${pi}
+ lvcreate --yes -n log-lv --size "${LOG_VOL_SIZE}MB" cgts-vg
+ mkfs.ext4 -F /dev/cgts-vg/log-lv
+ lvcreate -n scratch-lv --size "${SCRATCH_VOL_SIZE}MB" cgts-vg
+ mkfs.ext4 -F /dev/cgts-vg/scratch-lv