Enable overwrite existing installation with prestage iso content
When an existing installation exists on the subcloud, we may not want to overwrite the installation. The current behaviour is to avoid overwrites. However, if the user so desires, the existing installation can be overwritten by the usage of an argument to gen-prestaged-iso.sh. A bug is also fixed in this code checkin, where copy_to_iso gets one less argument than it should, causing the script to fail when generating a prestaged iso. Test Plan: PASS: Verify that the force_install option is present on the kernel command line in the generated prestaged iso when the script is invoked with the --force-install argument. PASS: Verify that the force_install option is not present on the kernel command line in the default case PASS: Verify that the prestaged iso installs the prestaged content when generated with the --force-install argument. Story: 2009948 Task: 44902 Depends-On: https://review.opendev.org/c/starlingx/metal/+/836215 Change-Id: I9da3b8315dc04bfa8a95f4b0a020a9c7641c0e56 Signed-off-by: Shrikumar Sharma <shrikumar.sharma@windriver.com>
This commit is contained in:
parent
58e282f4ba
commit
b877e97696
@ -42,6 +42,7 @@ Usage:
|
|||||||
[ --param <param>=<value> ]
|
[ --param <param>=<value> ]
|
||||||
[ --default-boot <default menu option> ]
|
[ --default-boot <default menu option> ]
|
||||||
[ --timeout <menu timeout> ]
|
[ --timeout <menu timeout> ]
|
||||||
|
[ --force-install ]
|
||||||
|
|
||||||
--input <file>: Specify input ISO file
|
--input <file>: Specify input ISO file
|
||||||
--output <file>: Specify output ISO file
|
--output <file>: Specify output ISO file
|
||||||
@ -74,6 +75,9 @@ Usage:
|
|||||||
--timeout <menu timeout>:
|
--timeout <menu timeout>:
|
||||||
Specify boot menu timeout, in seconds. (default 30)
|
Specify boot menu timeout, in seconds. (default 30)
|
||||||
A value of -1 will wait forever.
|
A value of -1 will wait forever.
|
||||||
|
--force-install:
|
||||||
|
Force install the prestaged content even if there is already an
|
||||||
|
installation on the target.
|
||||||
ENDUSAGE
|
ENDUSAGE
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +420,8 @@ function copy_rpm_file_to_iso {
|
|||||||
log_error "Error: copy_rpm_file_to_iso: file '${src}' not found in rpm '$(basename {rpm})'"
|
log_error "Error: copy_rpm_file_to_iso: file '${src}' not found in rpm '$(basename {rpm})'"
|
||||||
rc=1
|
rc=1
|
||||||
else
|
else
|
||||||
copy_to_iso "${src}" "${dest}" "${overwrite}"
|
# we do not need an md5 here, so leaving third argument empty
|
||||||
|
copy_to_iso "${src}" "${dest}" "" "${overwrite}"
|
||||||
rc=$?
|
rc=$?
|
||||||
fi
|
fi
|
||||||
popd > /dev/null
|
popd > /dev/null
|
||||||
@ -478,6 +483,9 @@ function generate_boot_cfg {
|
|||||||
COMMON_ARGS="${COMMON_ARGS} biosdevname=0 usbcore.autosuspend=-1"
|
COMMON_ARGS="${COMMON_ARGS} biosdevname=0 usbcore.autosuspend=-1"
|
||||||
COMMON_ARGS="${COMMON_ARGS} security_profile=standard user_namespace.enable=1"
|
COMMON_ARGS="${COMMON_ARGS} security_profile=standard user_namespace.enable=1"
|
||||||
COMMON_ARGS="${COMMON_ARGS} inst.stage2=hd:LABEL=${VOLUME_LABEL} inst.ks=hd:LABEL=${VOLUME_LABEL}:/${PRESTAGED_KICKSTART}"
|
COMMON_ARGS="${COMMON_ARGS} inst.stage2=hd:LABEL=${VOLUME_LABEL} inst.ks=hd:LABEL=${VOLUME_LABEL}:/${PRESTAGED_KICKSTART}"
|
||||||
|
if [[ "${FORCE_INSTALL}" == true ]]; then
|
||||||
|
COMMON_ARGS="${COMMON_ARGS} force_install"
|
||||||
|
fi
|
||||||
|
|
||||||
for f in ${isodir}/isolinux.cfg ${isodir}/syslinux.cfg; do
|
for f in ${isodir}/isolinux.cfg ${isodir}/syslinux.cfg; do
|
||||||
cat <<EOF > ${f}
|
cat <<EOF > ${f}
|
||||||
@ -557,6 +565,7 @@ declare MD5_FILE="container-image.tar.gz.md5"
|
|||||||
declare VOLUME_LABEL="oe_prestaged_iso_boot"
|
declare VOLUME_LABEL="oe_prestaged_iso_boot"
|
||||||
declare PRESTAGED_KICKSTART="prestaged_installer_ks.cfg"
|
declare PRESTAGED_KICKSTART="prestaged_installer_ks.cfg"
|
||||||
declare MENU_NAME="Prestaged Local Installer"
|
declare MENU_NAME="Prestaged Local Installer"
|
||||||
|
declare FORCE_INSTALL=false
|
||||||
|
|
||||||
SHORTOPTS=""; LONGOPTS=""
|
SHORTOPTS=""; LONGOPTS=""
|
||||||
SHORTOPTS+="i:"; LONGOPTS+="input:,"
|
SHORTOPTS+="i:"; LONGOPTS+="input:,"
|
||||||
@ -568,6 +577,7 @@ SHORTOPTS+="K:"; LONGOPTS+="kickstart-patch:,"
|
|||||||
SHORTOPTS+="d:"; LONGOPTS+="default-boot:,"
|
SHORTOPTS+="d:"; LONGOPTS+="default-boot:,"
|
||||||
SHORTOPTS+="t:"; LONGOPTS+="timeout:,"
|
SHORTOPTS+="t:"; LONGOPTS+="timeout:,"
|
||||||
SHORTOPTS+="I:"; LONGOPTS+="images:,"
|
SHORTOPTS+="I:"; LONGOPTS+="images:,"
|
||||||
|
SHORTOPTS+="f"; LONGOPTS+="force-install,"
|
||||||
SHORTOPTS+="h"; LONGOPTS+="help"
|
SHORTOPTS+="h"; LONGOPTS+="help"
|
||||||
|
|
||||||
OPTS=$(getopt -o "${SHORTOPTS}" --long "${LONGOPTS}" --name "$0" -- "$@")
|
OPTS=$(getopt -o "${SHORTOPTS}" --long "${LONGOPTS}" --name "$0" -- "$@")
|
||||||
@ -646,6 +656,10 @@ while :; do
|
|||||||
UPDATE_TIMEOUT="yes"
|
UPDATE_TIMEOUT="yes"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-f | --force-install)
|
||||||
|
FORCE_INSTALL=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user