mirror of
https://github.com/RetroDECK/RetroDECK.git
synced 2025-04-10 19:15:12 +00:00
BIOS_CHECKER: fixed correct BIOS file existence check and hash validation logic for multiple paths/hashes
This commit is contained in:
parent
7270014320
commit
363f007fbf
|
@ -1066,23 +1066,27 @@ 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"
|
||||||
# Check if the hash matches any of the possible MD5s
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
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
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log d "BIOS file found: $bios_file_found, Hash matched: $bios_md5_matched"
|
log d "BIOS file found: $bios_file_found, Hash matched: $bios_md5_matched"
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue