Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 29 additions & 20 deletions src/image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1187,46 +1187,55 @@ buildImage() {
return 0
}

extractBootImage() {
getBootLoadSize() {

local iso="$1"
local dir="$2"
local desc="$3"

local tmp="$TMP/boot-images"
local max_size=$((32 * 1024 * 1024))
local rc size len offset image=""
local msg="using legacy extraction..."
local boot_info
local -a images=()

ETFS="boot.img"
local desc="$2"
local value

if ! boot_info=$(isoinfo -d -i "$iso"); then
value=$(
isoinfo -d -i "$iso" |
awk '/Nsect / { print $NF; exit }'
) || {
error "Failed to read boot image information from $desc ISO!"
return 1
fi

len=$(awk '/Nsect / { print $NF; exit }' <<< "$boot_info")
}

if [ -z "$len" ]; then
if [ -z "$value" ]; then
error "Failed to determine boot image load size from $desc ISO!"
return 1
fi

if [[ ! "$len" =~ ^[0-9]+$ ]] || [ "${#len}" -gt 5 ]; then
if [[ ! "$value" =~ ^[0-9]+$ ]] || [ "${#value}" -gt 5 ]; then
error "Invalid boot image load size found in $desc ISO!"
return 1
fi

BOOT_LOAD_SIZE=$((10#$len))
BOOT_LOAD_SIZE=$((10#$value))

if (( BOOT_LOAD_SIZE < 1 || BOOT_LOAD_SIZE > 65535 )); then
error "Invalid boot image load size found in $desc ISO!"
return 1
fi

[ -f "$dir/$ETFS" ] && [ -s "$dir/$ETFS" ] && return 0
return 0
}

extractBootImage() {

local iso="$1"
local dir="$2"
local desc="$3"

local tmp="$TMP/boot-images"
local max_size=$((32 * 1024 * 1024))
local rc size offset image=""
local msg="using legacy extraction..."
local boot_info
local -a images=()

ETFS="boot.img"
[ -s "$dir/$ETFS" ] && return 0

rm -f "$dir/$ETFS" || return 1
rm -rf "$tmp" || return 1
Expand Down
6 changes: 6 additions & 0 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -781,6 +781,12 @@ prepareImage() {
setMachine "$DETECTED" "$iso" "$dir" "$desc" || return 1

disabled "$REBUILD" && return 0

if [[ "${BOOT_MODE,,}" == "windows_legacy" &&
"${DETECTED,,}" != "win9"* ]]; then
getBootLoadSize "$iso" "$desc" || return 1
fi

skipVersion "$DETECTED" && return 0

if [[ "${BOOT_MODE,,}" == "windows_legacy" ]]; then
Expand Down