Skip to content

Commit

Permalink
Update install.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kroese authored Jun 14, 2024
1 parent 25e3626 commit ad60aac
Showing 1 changed file with 12 additions and 31 deletions.
43 changes: 12 additions & 31 deletions src/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,42 +11,23 @@ detectType() {

case "${file,,}" in
*".iso" | *".img" | *".raw" | *".qcow2" )
BOOT="$file"
[ -n "${BOOT_MODE:-}" ] && return 0 ;;
BOOT="$file" ;;
* ) return 1 ;;
esac

# Automaticly detect UEFI-compatible images
[ -n "$BOOT_MODE" ] && return 0
[[ "${file,,}" != *".iso" ]] && return 0

case "${file,,}" in
*".iso" )

dir=$(isoinfo -f -i "$file")
if [ -z "$dir" ]; then
BOOT=""
error "Failed to read ISO file, invalid format!" && return 1
fi

dir=$(echo "${dir^^}" | grep "^/EFI")
[ -n "$dir" ] && BOOT_MODE="uefi" ;;

*".img" | *".raw" )

dir=$(sfdisk -l "$file")
if [ -z "$dir" ]; then
BOOT=""
error "Failed to read disk image file, invalid format!" && return 1
fi

dir=$(echo "${dir^^}" | grep "EFI SYSTEM")
[ -n "$dir" ] && BOOT_MODE="uefi" ;;

*".qcow2" )

# TODO: Detect boot mode from partition table in image
BOOT_MODE="uefi" ;;
# Automaticly detect UEFI-compatible ISO's
dir=$(isoinfo -f -i "$file")

if [ -z "$dir" ]; then
BOOT=""
error "Failed to read ISO file, invalid format!" && return 1
fi

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

return 0
}
Expand Down

0 comments on commit ad60aac

Please sign in to comment.