Fix gen-bootloader-iso.sh error on unpatched controller

On a system that has never been patched, the updates repository may
not yet have a Packages directory. This update fixes the patch setup
in gen-bootloader-iso.sh to check for this case and handle it without
failing.

This update also improves the platform-kickstarts-pxeboot check to
look for a pxeboot kickstart, to ensure there isn't a false-positive
match against an extracted pxe-network-installer patch, which would
also have a /pxeboot directory.

Change-Id: I8e24a3ff123f4c2649be52b1a0ce77d830e342f3
Closes-Bug: 1893990
Signed-off-by: Don Penney <don.penney@windriver.com>
This commit is contained in:
Don Penney 2020-09-02 22:42:41 -04:00
parent 533d4fff06
commit f43e37b4ea
1 changed files with 19 additions and 4 deletions

View File

@ -361,7 +361,7 @@ function handle_delete {
fi
# If there are no more nodes, cleanup everything else
if [ $(ls -A ${NODE_DIR_BASE} | wc -l) = 0 ]; then
if [ $(ls -A ${NODE_DIR_BASE} 2>/dev/null | wc -l) = 0 ]; then
if [ -d ${NODE_DIR_BASE} ]; then
rmdir ${NODE_DIR_BASE}
fi
@ -391,12 +391,27 @@ function get_patches_from_host {
exit 1
fi
rsync -a ${host_patch_repo}/repodata ${host_patch_repo}/Packages ${SHARED_DIR}/patches/
rsync -a ${host_patch_repo}/repodata ${SHARED_DIR}/patches/
if [ $? -ne 0 ]; then
log_error "Failed to copy patches repo from ${host_patch_repo}"
log_error "Failed to copy ${host_patch_repo}/repodata"
exit 1
fi
if [ -d ${host_patch_repo}/Packages ]; then
rsync -a ${host_patch_repo}/Packages ${SHARED_DIR}/patches/
if [ $? -ne 0 ]; then
log_error "Failed to copy ${host_patch_repo}/Packages"
exit 1
fi
elif [ ! -d ${SHARED_DIR}/patches/Packages ]; then
# Create an empty Packages dir
mkdir ${SHARED_DIR}/patches/Packages
if [ $? -ne 0 ]; then
log_error "Failed to create ${SHARED_DIR}/patches/Packages"
exit 1
fi
fi
mkdir -p \
${SHARED_DIR}/patches/metadata/available \
${SHARED_DIR}/patches/metadata/applied \
@ -516,7 +531,7 @@ function extract_shared_files {
extract_pkg_to_workdir 'platform-kickstarts-pxeboot'
local patched_pxeboot_files_dir=${WORKDIR}/pxeboot
if [ -d ${patched_pxeboot_files_dir} ]; then
if [ -f ${patched_pxeboot_files_dir}/pxeboot_controller.cfg ]; then
# Use the patched pxeboot files
pxeboot_files_dir=${patched_pxeboot_files_dir}
fi