Update install.sh

This commit is contained in:
Kroese 2024-06-14 02:42:29 +02:00 committed by GitHub
parent 25e3626167
commit ad60aace6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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" )
# 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
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" ;;
esac
dir=$(echo "${dir^^}" | grep "^/EFI")
[ -z "$dir" ] && BOOT_MODE="legacy"
return 0
}