From c5364a65a2b79a659e64fc0d54c309dc555c83cf Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Sat, 30 Mar 2019 09:45:36 -0700 Subject: [PATCH] Avoid copying the wrong files from WinPE * if w_en_us was empty it would copy the contents from $(pwd) --- .bin/Scripts/build-ufd | 42 ++++++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 12 deletions(-) diff --git a/.bin/Scripts/build-ufd b/.bin/Scripts/build-ufd index 60f45c88..8931558c 100755 --- a/.bin/Scripts/build-ufd +++ b/.bin/Scripts/build-ufd @@ -577,18 +577,36 @@ sed -i "s/${ISO_LABEL}/${UFD_LABEL}/" /mnt/Dest/arch/boot/syslinux/*cfg echo "Copying WinPE files..." | tee -a "${LOG_FILE}" if [[ ! -z "${arg_w:-}" ]]; then - rsync ${RSYNC_ARGS} \ - "${w_bootmgr}" "${w_bootmgr_efi}" "${w_en_us}" \ - /mnt/Dest/ >> "${LOG_FILE}" 2>&1 - rsync ${RSYNC_ARGS} \ - "${w_boot}"/* \ - /mnt/Dest/Boot/ >> "${LOG_FILE}" 2>&1 - rsync ${RSYNC_ARGS} \ - "${w_efi_boot}"/* "${w_efi_microsoft}"/* \ - /mnt/Dest/EFI/Microsoft/ >> "${LOG_FILE}" 2>&1 - rsync ${RSYNC_ARGS} \ - "${w_boot_bcd}" "${w_boot_sdi}" "${w_bootmgr}" "${w_sources}"/* \ - /mnt/Dest/sources/ >> "${LOG_FILE}" 2>&1 + if [[ ! -z "${w_bootmgr:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_bootmgr}" /mnt/Dest/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_bootmgr_efi:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_bootmgr_efi}" /mnt/Dest/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_en_us:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_en_us}" /mnt/Dest/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_boot:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_boot}"/* /mnt/Dest/Boot/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_efi_boot:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_efi_boot}"/* /mnt/Dest/EFI/Microsoft/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_efi_microsoft:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_efi_microsoft}"/* /mnt/Dest/EFI/Microsoft/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_boot_bcd:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_boot_bcd}" /mnt/Dest/sources/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_boot_sdi:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_boot_sdi}" /mnt/Dest/sources/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_bootmgr:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_bootmgr}" /mnt/Dest/sources/ >> "${LOG_FILE}" 2>&1 + fi + if [[ ! -z "${w_sources:-}" ]]; then + rsync ${RSYNC_ARGS} "${w_sources}"/* /mnt/Dest/sources/ >> "${LOG_FILE}" 2>&1 + fi # Uncomment boot entries sed -i "s/#UFD-WINPE#//" /mnt/Dest/EFI/boot/refind.conf