Allow building UFD with only the Linux ISO

* Addresses issue #94
This commit is contained in:
2Shirt 2019-03-11 22:27:07 -06:00
parent 22b1452168
commit 459f95394a
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -143,11 +143,11 @@ function help () {
[[ "${__usage+x}" ]] || read -r -d '' __usage <<-'EOF' || true # exits non-zero when EOF encountered [[ "${__usage+x}" ]] || read -r -d '' __usage <<-'EOF' || true # exits non-zero when EOF encountered
OPTIONS: OPTIONS:
-u --ufd-device [arg] Device to which the kit will be applied -u --ufd-device [arg] Device to which the kit will be applied
-m --main-kit [arg] Path to the Main Kit
-l --linux-iso [arg] Path to the Linux ISO -l --linux-iso [arg] Path to the Linux ISO
-w --winpe-iso [arg] Path to the WinPE ISO
-e --extra-dir [arg] Path to the Extra folder (optional) -e --extra-dir [arg] Path to the Extra folder (optional)
-m --main-kit [arg] Path to the Main Kit (optional)
-w --winpe-iso [arg] Path to the WinPE ISO (optional)
-h --help This page -h --help This page
ADVANCED: ADVANCED:
@ -390,15 +390,11 @@ if [[ "${arg_h:?}" == 1 ]]; then
else else
# Print warning line # Print warning line
[[ "${arg_u:-}" ]] || echo " -u or --ufd-device is required" [[ "${arg_u:-}" ]] || echo " -u or --ufd-device is required"
[[ "${arg_m:-}" ]] || echo " -m or --main-kit is required"
[[ "${arg_l:-}" ]] || echo " -l or --linux-iso is required" [[ "${arg_l:-}" ]] || echo " -l or --linux-iso is required"
[[ "${arg_w:-}" ]] || echo " -w or --winpe-iso is required"
# Bail if necessary # Bail if necessary
[[ "${arg_u:-}" ]] || help "${__usage_example}" [[ "${arg_u:-}" ]] || help "${__usage_example}"
[[ "${arg_l:-}" ]] || help "${__usage_example}" [[ "${arg_l:-}" ]] || help "${__usage_example}"
[[ "${arg_m:-}" ]] || help "${__usage_example}"
[[ "${arg_w:-}" ]] || help "${__usage_example}"
fi fi
[[ "${LOG_LEVEL:-}" ]] || emergency "Cannot continue without LOG_LEVEL. " [[ "${LOG_LEVEL:-}" ]] || emergency "Cannot continue without LOG_LEVEL. "
@ -492,9 +488,13 @@ echo ""
# Verify sources # Verify sources
[[ -b "${DEST_DEV}" ]] || abort "${DEST_DEV} is not a valid device." [[ -b "${DEST_DEV}" ]] || abort "${DEST_DEV} is not a valid device."
[[ -d "${MAIN_KIT}/.bin" ]] || abort "Invalid Main Kit, ${MAIN_KIT}/.bin not found."
[[ -e "${LINUX_ISO}" ]] || abort "Linux ISO not found." [[ -e "${LINUX_ISO}" ]] || abort "Linux ISO not found."
[[ -e "${WINPE_ISO}" ]] || abort "WinPE ISO not found." if [[ ! -z "${arg_m:-}" ]]; then
[[ -d "${MAIN_KIT}/.bin" ]] || abort "Invalid Main Kit, ${MAIN_KIT}/.bin not found."
fi
if [[ ! -z "${arg_w:-}" ]]; then
[[ -e "${WINPE_ISO}" ]] || abort "WinPE ISO not found."
fi
if [[ ! -z "${arg_e:-}" ]]; then if [[ ! -z "${arg_e:-}" ]]; then
[[ -d "${EXTRA_DIR}" ]] || abort "Extra Dir not found." [[ -d "${EXTRA_DIR}" ]] || abort "Extra Dir not found."
fi fi
@ -554,7 +554,9 @@ echo "Mounting sources and destination..."
mkdir /mnt/{Dest,Linux,WinPE} -p >> "${LOG_FILE}" 2>&1 mkdir /mnt/{Dest,Linux,WinPE} -p >> "${LOG_FILE}" 2>&1
mount ${DEST_PAR} /mnt/Dest >> "${LOG_FILE}" 2>&1 mount ${DEST_PAR} /mnt/Dest >> "${LOG_FILE}" 2>&1
mount "${LINUX_ISO}" /mnt/Linux -r >> "${LOG_FILE}" 2>&1 mount "${LINUX_ISO}" /mnt/Linux -r >> "${LOG_FILE}" 2>&1
mount "${WINPE_ISO}" /mnt/WinPE -r >> "${LOG_FILE}" 2>&1 if [[ ! -z "${arg_w:-}" ]]; then
mount "${WINPE_ISO}" /mnt/WinPE -r >> "${LOG_FILE}" 2>&1
fi
# Find WinPE source # Find WinPE source
w_boot="$(find /mnt/WinPE -iwholename "/mnt/WinPE/Boot")" w_boot="$(find /mnt/WinPE -iwholename "/mnt/WinPE/Boot")"
@ -576,23 +578,27 @@ sed -i "s/${ISO_LABEL}/${UFD_LABEL}/" /mnt/Dest/arch/boot/syslinux/*cfg
sed -i "s/#UFD#//" /mnt/Dest/arch/boot/syslinux/*cfg sed -i "s/#UFD#//" /mnt/Dest/arch/boot/syslinux/*cfg
echo "Copying WinPE files..." echo "Copying WinPE files..."
rsync ${RSYNC_ARGS} \ if [[ ! -z "${arg_w:-}" ]]; then
"${w_bootmgr}" "${w_bootmgr_efi}" "${w_en_us}" \ rsync ${RSYNC_ARGS} \
/mnt/Dest/ >> "${LOG_FILE}" 2>&1 "${w_bootmgr}" "${w_bootmgr_efi}" "${w_en_us}" \
rsync ${RSYNC_ARGS} \ /mnt/Dest/ >> "${LOG_FILE}" 2>&1
"${w_boot}"/* \ rsync ${RSYNC_ARGS} \
/mnt/Dest/Boot/ >> "${LOG_FILE}" 2>&1 "${w_boot}"/* \
rsync ${RSYNC_ARGS} \ /mnt/Dest/Boot/ >> "${LOG_FILE}" 2>&1
"${w_efi_boot}"/* "${w_efi_microsoft}"/* \ rsync ${RSYNC_ARGS} \
/mnt/Dest/EFI/Microsoft/ >> "${LOG_FILE}" 2>&1 "${w_efi_boot}"/* "${w_efi_microsoft}"/* \
rsync ${RSYNC_ARGS} \ /mnt/Dest/EFI/Microsoft/ >> "${LOG_FILE}" 2>&1
"${w_boot_bcd}" "${w_boot_sdi}" "${w_bootmgr}" "${w_sources}"/* \ rsync ${RSYNC_ARGS} \
/mnt/Dest/sources/ >> "${LOG_FILE}" 2>&1 "${w_boot_bcd}" "${w_boot_sdi}" "${w_bootmgr}" "${w_sources}"/* \
/mnt/Dest/sources/ >> "${LOG_FILE}" 2>&1
fi
echo "Copying Main Kit..." echo "Copying Main Kit..."
rsync ${RSYNC_ARGS} \ if [[ ! -z "${arg_m:-}" ]]; then
"${MAIN_KIT}/" \ rsync ${RSYNC_ARGS} \
"/mnt/Dest/${KIT_NAME_FULL}/" >> "${LOG_FILE}" 2>&1 "${MAIN_KIT}/" \
"/mnt/Dest/${KIT_NAME_FULL}/" >> "${LOG_FILE}" 2>&1
fi
if [[ ! -z "${EXTRA_DIR:-}" ]]; then if [[ ! -z "${EXTRA_DIR:-}" ]]; then
echo "Copying Extra files..." echo "Copying Extra files..."