From: Robert Church Date: Tue, 13 Sep 2022 12:29:20 -0500 Subject: Add support for StarlingX partitioning/formatting For StarlingX, enable full control of the partition creation and formatting scheme in the kickstart hooks so that partitioning can be more easily aligned with previous releases and can be adjusted for specific personalities without needing additional LAT installer changes. This change will add an "inststx" option. This option, when enabled, will skip the default LAT installer partitioning and formatting schemes and only call the "%part" and %mkfs kickstart LAT hooks. By default, inststx will be enabled so that no bootline changes will be required in base-bullseye.yaml or the pxeboot installer code Signed-off-by: Robert Church --- init-ostree-install.sh | 159 +++++++++++++++++++++++++++++-------------------- 1 file changed, 93 insertions(+), 66 deletions(-) diff --git a/init-ostree-install.sh b/init-ostree-install.sh index 46a0c08..98cfb2b 100644 --- a/init-ostree-install.sh +++ b/init-ostree-install.sh @@ -93,6 +93,8 @@ OPTIONAL: RSZ=# - MB size of root partition VSZ=# - MB size of var partition (0 for auto expand) + inststx=1 - Skip LAT partitioning scheme (StarlingX). + Only call %part ks hook to partition EOF } @@ -673,6 +675,8 @@ read_args() { RSZ=$optarg ;; VSZ=*) VSZ=$optarg ;; + inststx=*) + INSTSTX=$optarg ;; esac done # defaults if not set @@ -685,6 +689,7 @@ read_args() { if [ "$INSTGPG" = "" ] ; then INSTGPG=1 ; fi if [ "$INSTFLUX" = "" ] ; then INSTFLUX=1 ; fi if [ "$INSTSBD" = "" ] ; then INSTSBD=2 ; fi + if [ "$INSTSTX" = "" ] ; then INSTSTX=1 ; fi } shell_start() { @@ -1074,7 +1079,7 @@ fi if [ -n "${KS}" ]; then exec_hook "%pre-part" ${lat_pre_part} if [ $? -ne 0 ]; then - fatal "Run Kickstart Per Partitioin Script failed" + fatal "Run Kickstart Pre-Partition Script failed" fi fi @@ -1139,7 +1144,17 @@ if [ $INSTSF = 1 ] ; then fi fi -if [ "$INSTPT" != "0" ] ; then +if [ $INSTSTX = 1 ]; then + echo "Skipping LAT installer partitioning for StarlingX (inststx=1). Rely on kickstart partitioning (using %part hook)." + + # Creating all partitions via the kickstart %part hook + if [ -n "${KS}" ]; then + exec_hook "%part" ${lat_create_part} + if [ $? -ne 0 ]; then + fatal "Run Kickstart Create Part Script failed" + fi + fi +elif [ "$INSTPT" != "0" ] ; then if [ "$BL" = "grub" ] ; then grub_partition elif [ "$BL" = "ufsd" ] ; then @@ -1161,86 +1176,98 @@ sync # Customize here for disk formatting -if [ "$INSTPT" != "0" ] ; then - INSTFMT=1 -fi +if [ $INSTSTX = 1 ]; then + echo "Skipping LAT installer formatting for StarlingX (inststx=1). Rely on kickstart formatting (using %mkfs hook)." -if [ "$BL" = "grub" -a "$INSTFMT" != "0" ] ; then - if [ $INSTSF = 1 ] ; then - dosfslabel ${fs_dev}${p1} otaefi - else - mkfs.vfat -n otaefi ${fs_dev}${p1} + # Manage all filesystem creation via the %mkfs hook + if [ -n "${KS}" ]; then + exec_hook "%mkfs" ${lat_make_fs} + if [ $? -ne 0 ]; then + fatal "Run Kickstart Make FS Script failed" + fi fi - - pi=$((p1+1)) - mkfs.ext4 -F -L otaboot ${fs_dev}${pi} - dashe="-e" - - pi=$((pi+1)) - if [ $LUKS -gt 1 ] ; then - echo Y | luks-setup.sh -f $dashe -d ${fs_dev}${pi} -n luksotaroot || \ - fatal "Cannot create LUKS volume luksotaroot" - dashe="" - mkfs.ext4 -F -L otaroot /dev/mapper/luksotaroot - else - mkfs.ext4 -F -L otaroot ${fs_dev}${pi} +else + if [ "$INSTPT" != "0" ] ; then + INSTFMT=1 fi - if [ "$INSTAB" = "1" ] ; then - pi=$((pi+1)) - mkfs.ext4 -F -L otaboot_b ${fs_dev}${pi} + if [ "$BL" = "grub" -a "$INSTFMT" != "0" ] ; then + if [ $INSTSF = 1 ] ; then + dosfslabel ${fs_dev}${p1} otaefi + else + mkfs.vfat -n otaefi ${fs_dev}${p1} + fi + + pi=$((p1+1)) + mkfs.ext4 -F -L otaboot ${fs_dev}${pi} + dashe="-e" pi=$((pi+1)) if [ $LUKS -gt 1 ] ; then - echo Y | luks-setup.sh -f -d ${fs_dev}${pi} -n luksotaroot_b || \ - fatal "Cannot create LUKS volume luksotaroot_b" - mkfs.ext4 -F -L otaroot_b /dev/mapper/luksotaroot_b + echo Y | luks-setup.sh -f $dashe -d ${fs_dev}${pi} -n luksotaroot || \ + fatal "Cannot create LUKS volume luksotaroot" + dashe="" + mkfs.ext4 -F -L otaroot /dev/mapper/luksotaroot else - mkfs.ext4 -F -L otaroot_b ${fs_dev}${pi} + mkfs.ext4 -F -L otaroot ${fs_dev}${pi} fi - fi - if [ "${INSTFLUX}" = 1 ] ; then - pi=$((pi+1)) - FLUXPART=${pi} - if [ $LUKS -gt 0 ] ; then - echo Y | luks-setup.sh -f $dashe -d ${fs_dev}${FLUXPART} -n luksfluxdata || \ - fatal "Cannot create LUKS volume luksfluxdata" - dashe="" - mkfs.ext4 -F -L fluxdata /dev/mapper/luksfluxdata + if [ "$INSTAB" = "1" ] ; then + pi=$((pi+1)) + mkfs.ext4 -F -L otaboot_b ${fs_dev}${pi} + + pi=$((pi+1)) + if [ $LUKS -gt 1 ] ; then + echo Y | luks-setup.sh -f -d ${fs_dev}${pi} -n luksotaroot_b || \ + fatal "Cannot create LUKS volume luksotaroot_b" + mkfs.ext4 -F -L otaroot_b /dev/mapper/luksotaroot_b + else + mkfs.ext4 -F -L otaroot_b ${fs_dev}${pi} + fi + fi + + if [ "${INSTFLUX}" = 1 ] ; then + pi=$((pi+1)) + FLUXPART=${pi} + if [ $LUKS -gt 0 ] ; then + echo Y | luks-setup.sh -f $dashe -d ${fs_dev}${FLUXPART} -n luksfluxdata || \ + fatal "Cannot create LUKS volume luksfluxdata" + dashe="" + mkfs.ext4 -F -L fluxdata /dev/mapper/luksfluxdata + else + mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART} + fi + fi + elif [ "$INSTFMT" != 0 ] ; then + if [ $INSTSF = 1 ] ; then + dosfslabel ${fs_dev}${p1} boot else - mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART} + mkfs.vfat -n boot ${fs_dev}${p1} fi - fi -elif [ "$INSTFMT" != 0 ] ; then - if [ $INSTSF = 1 ] ; then - dosfslabel ${fs_dev}${p1} boot - else - mkfs.vfat -n boot ${fs_dev}${p1} - fi - pi=5 - mkfs.ext4 -F -L otaboot ${fs_dev}${pi} - pi=$((pi+1)) - mkfs.ext4 -F -L otaroot ${fs_dev}${pi} - if [ "$INSTAB" = "1" ] ; then - pi=$((pi+1)) - mkfs.ext4 -F -L otaboot_b ${fs_dev}${pi} + pi=5 + mkfs.ext4 -F -L otaboot ${fs_dev}${pi} pi=$((pi+1)) - mkfs.ext4 -F -L otaroot_b ${fs_dev}${pi} - fi + mkfs.ext4 -F -L otaroot ${fs_dev}${pi} + if [ "$INSTAB" = "1" ] ; then + pi=$((pi+1)) + mkfs.ext4 -F -L otaboot_b ${fs_dev}${pi} + pi=$((pi+1)) + mkfs.ext4 -F -L otaroot_b ${fs_dev}${pi} + fi - if [ "${INSTFLUX}" = 1 ] ; then - pi=$((pi+1)) - FLUXPART=${pi} - mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART} + if [ "${INSTFLUX}" = 1 ] ; then + pi=$((pi+1)) + FLUXPART=${pi} + mkfs.ext4 -F -L fluxdata ${fs_dev}${FLUXPART} + fi fi -fi -# Create filesystem on new partitions (optional), grub and udisk -if [ "${VSZ}" != 0 -a -n "${KS}" ]; then - exec_hook "%mkfs" ${lat_make_fs} - if [ $? -ne 0 ]; then - fatal "Run Kickstart Make FS Script failed" + # Create filesystem on new partitions (optional), grub and udisk + if [ "${VSZ}" != 0 -a -n "${KS}" ]; then + exec_hook "%mkfs" ${lat_make_fs} + if [ $? -ne 0 ]; then + fatal "Run Kickstart Make FS Script failed" + fi fi fi