Unverified Commit 1ba04ecb authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Hybrid ISO support (#832)

parent 0a2845a2
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -605,10 +605,10 @@ esac
if [ -f "$BOOT" ] && [ -s "$BOOT" ]; then
  case "${BOOT,,}" in
    *".iso" )
        if [[ "${HYBRID:-}" != [Yy]* ]]; then
          DISK_OPTS+=$(addMedia "$BOOT" "$MEDIA_TYPE" "$BOOT_INDEX" "0x5")
        if [[ "${HYBRID:-}" == [Yy]* ]]; then
          DISK_OPTS+=$(addMedia "$BOOT" "usb" "$BOOT_INDEX" "0x5")
        else
          DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "raw" "$DISK_IO" "$DISK_CACHE" "" "")
          DISK_OPTS+=$(addMedia "$BOOT" "$MEDIA_TYPE" "$BOOT_INDEX" "0x5")
        fi ;;
    *".img" | *".raw" )
        DISK_OPTS+=$(createDevice "$BOOT" "$DISK_TYPE" "$BOOT_INDEX" "0x5" "raw" "$DISK_IO" "$DISK_CACHE" "" "") ;;
+18 −24
Original line number Diff line number Diff line
@@ -89,6 +89,14 @@ detectType() {

  if [[ "${file,,}" == *".iso" ]]; then

    result=$(head -c 512 "$file" | tail -c 2 | xxd -p)

    if [[ "$result" != "0000" ]]; then
      [ -z "${HYBRID:-}" ] && HYBRID="Y"
    fi

    if [[ "${HYBRID:-}" != [Yy]* ]]; then

      result=$(isoinfo -f -i "$file" 2>/dev/null)

      if [ -z "$result" ]; then
@@ -97,30 +105,16 @@ detectType() {
      fi

      result=$(echo "${result^^}" | grep "^/EFI")
      [ -z "$result" ] && BOOT_MODE="legacy"

    if [ -z "$result" ]; then

      BOOT_MODE="legacy"

    else

      result=$(fdisk -l "$file" 2>/dev/null)
      moveFile "$file" && return 0
      return 1

      if [[ "${result^^}" == *"EFI "* ]]; then
        if [ -z "${HYBRID:-}" ] && HYBRID="Y"
    fi

  fi

  else

  result=$(fdisk -l "$file" 2>/dev/null)

    if [[ "${result^^}" != *"EFI "* ]]; then
      BOOT_MODE="legacy"
    fi

  fi
  [[ "${result^^}" != *"EFI "* ]] && BOOT_MODE="legacy"

  moveFile "$file" && return 0
  return 1
@@ -373,8 +367,8 @@ if ! downloadFile "$BOOT" "$base" "$name"; then
  info "Retrying failed download in 5 seconds..."
  sleep 5
  if ! downloadFile "$BOOT" "$base" "$name"; then
    info "Retrying failed download in 5 seconds..."
    sleep 5
    info "Retrying failed download in 10 seconds..."
    sleep 10
    if ! downloadFile "$BOOT" "$base" "$name"; then
      rm -f "$STORAGE/$base" && exit 60
    fi