PXE Boot Server robustness
This commits add the creation of a symlink for EFI/grub.cfg. It also allows the user to overwrite an existing directory, the user will be prompted to confirm this action. Closes-Bug: 1794863 Change-Id: I566a3b39c601921cd73cca3f291f43e5dc0ef626 Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
parent
dc531dc815
commit
0715862fa5
@ -65,7 +65,10 @@ if [ ! -d ${COPY_DIR} ] ; then
|
||||
fi
|
||||
else
|
||||
echo "$COPY_DIR already exists"
|
||||
exit 0
|
||||
read -p "WARNING: Files in this folder will get overwritten, continue? [y/N] " confirm
|
||||
if [[ "${confirm}" != "y" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
#Copy the vmlinuz and initrd files to the destination directory
|
||||
@ -89,6 +92,11 @@ cp -Rf ${COPY_DIR}/pxeboot/* ${COPY_DIR}/
|
||||
#Rename the UEFI grub config
|
||||
mv ${COPY_DIR}/pxeboot_grub.cfg ${COPY_DIR}/grub.cfg
|
||||
|
||||
#Create a symlink of the UEFI grub config, the bootloader could be also looking
|
||||
#for it under the EFI/ folder depending on if the PXE Server is configured with a
|
||||
#TFTP Server or dnsmasq
|
||||
ln -sf ../grub.cfg ${COPY_DIR}/EFI/grub.cfg
|
||||
|
||||
#Variable replacement
|
||||
sed -i "s#xxxHTTP_URLxxx#${BASE_URL}#g;
|
||||
s#xxxHTTP_URL_PATCHESxxx#${BASE_URL}/patches#g;
|
||||
@ -105,7 +113,11 @@ rm -Rf ${COPY_DIR}/pxeboot
|
||||
|
||||
if [ -n "$TFTP_DIR" ]; then
|
||||
#Create pxelinux.cfg directory and default link
|
||||
if [ ! -d ${TFTP_DIR}/pxelinux.cfg ] ; then
|
||||
mkdir ${TFTP_DIR}/pxelinux.cfg
|
||||
fi
|
||||
chmod 755 ${TFTP_DIR}/pxelinux.cfg
|
||||
ln -s ../pxeboot.cfg ${TFTP_DIR}/pxelinux.cfg/default
|
||||
ln -sf ../pxeboot.cfg ${TFTP_DIR}/pxelinux.cfg/default
|
||||
fi
|
||||
|
||||
echo "The setup is complete"
|
||||
|
Loading…
Reference in New Issue
Block a user