BIOS_CHECKER: fixed correct BIOS file existence check and hash validation logic for multiple paths/hashes

This commit is contained in:
XargonWan 2025-01-17 09:55:09 +09:00
parent 7270014320
commit 363f007fbf

View file

@ -1066,17 +1066,21 @@ configurator_check_bios_files() {
# Skip if bios_file is empty # Skip if bios_file is empty
if [[ ! -z "$bios_file" ]]; then if [[ ! -z "$bios_file" ]]; then
bios_file_found="No" bios_file_found="Yes"
bios_md5_matched="No" bios_md5_matched="No"
# Check if the BIOS file exists IFS=', ' read -r -a paths_array <<< "$bios_paths"
if [[ -f "$bios_folder/$bios_paths$bios_file" ]]; then for path in "${paths_array[@]}"; do
bios_file_found="Yes" if [[ ! -f "$bios_folder/$path/$bios_file" ]]; then
bios_file_found="No"
break
fi
done
# Check if the hash matches any of the possible MD5s if [[ $bios_file_found == "Yes" ]]; then
IFS=', ' read -r -a md5_array <<< "$bios_md5" IFS=', ' read -r -a md5_array <<< "$bios_md5"
for md5 in "${md5_array[@]}"; do for md5 in "${md5_array[@]}"; do
if [[ $(md5sum "$bios_folder/$bios_paths$bios_file" | awk '{ print $1 }') == "$md5" ]]; then if [[ $(md5sum "$bios_folder/$path/$bios_file" | awk '{ print $1 }') == "$md5" ]]; then
bios_md5_matched="Yes" bios_md5_matched="Yes"
break break
fi fi