Update install.sh
This commit is contained in:
parent
25e3626167
commit
ad60aace6c
1 changed files with 12 additions and 31 deletions
|
|
@ -11,42 +11,23 @@ detectType() {
|
||||||
|
|
||||||
case "${file,,}" in
|
case "${file,,}" in
|
||||||
*".iso" | *".img" | *".raw" | *".qcow2" )
|
*".iso" | *".img" | *".raw" | *".qcow2" )
|
||||||
BOOT="$file"
|
BOOT="$file" ;;
|
||||||
[ -n "${BOOT_MODE:-}" ] && return 0 ;;
|
|
||||||
* ) return 1 ;;
|
* ) return 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Automaticly detect UEFI-compatible images
|
[ -n "$BOOT_MODE" ] && return 0
|
||||||
|
[[ "${file,,}" != *".iso" ]] && return 0
|
||||||
|
|
||||||
case "${file,,}" in
|
# Automaticly detect UEFI-compatible ISO's
|
||||||
*".iso" )
|
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")
|
dir=$(echo "${dir^^}" | grep "^/EFI")
|
||||||
if [ -z "$dir" ]; then
|
[ -z "$dir" ] && BOOT_MODE="legacy"
|
||||||
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
|
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue