|
33 | 33 | #### Variables |
34 | 34 | ######################################################################## |
35 | 35 | # Versioning |
36 | | -version="Version: 01.00-09, Script Date: 2022.06.01" |
| 36 | +version="Version: 01.00-10, Script Date: 2022.06.03" |
37 | 37 | #md5_sum=$(md5sum $sname | sed 's/system.*//g' ) |
38 | 38 | arg1=$1 |
39 | 39 | arg2=$2 |
@@ -446,44 +446,55 @@ function GetSb() |
446 | 446 | { |
447 | 447 | # Gets SafeBoot Info from UEFI BIOS or if not UEFI capable. Called once by GetDMI(). |
448 | 448 | # Warns user if mokutil was not present. |
449 | | - #echo -e " --- SecureBoot Status from 'mokutil --sb-state':" |
| 449 | + echo -e " --- SecureBoot Status from 'mokutil':" |
450 | 450 |
|
451 | 451 | ## Bug found on some machines concerning the '--sb-state' option switch on 2022.06.01. |
452 | 452 | # Shortened to '--sb' (undocumented option switch) |
| 453 | + # 'mokuitl' Bug was resolved within days... |
| 454 | + # 2022.06.02, Added fallack error handling for fallback to alternate option flag... |
| 455 | + # using the documented option flag as the primary method. |
453 | 456 | if [ $check_mokutil -eq 0 ] |
454 | 457 | then |
455 | 458 | echo -e "\tThis would check / have checked if SecureBoot was enabled or not, " |
456 | 459 | echo -e "\tand checks if the system BIOS was UEFI or Lagacy only BIOS, " |
457 | 460 | echo -e "\tbut package mokutil was not installed. If you would like to check" |
458 | 461 | echo -e "\tthis information, please install 'mokutil' and rerun script." |
459 | 462 | else |
| 463 | + # Added this error handling because of a bug on a 'mokutil', that was resolved |
| 464 | + # but showed that an error was possible from a faulty update of this utility. |
| 465 | + error_mokutil=$(mokutil --sb-state 2>&1 ) |
| 466 | + if [[ "$error_mokutil" == *"mokutil: unrecognized option '--sb-state'"* ]] |
| 467 | + then |
| 468 | + mokutil_cmd=$(mokutil --sb 2>&1 ) |
| 469 | + error_mokutil=$mokutil_cmd |
| 470 | + else |
| 471 | + mokutil_cmd=$(mokutil --sb-state 2>&1 ) |
| 472 | + fi |
460 | 473 | # For Legacy only BIOS, returns error: "EFI variables are not supported on this system" |
461 | | - #error_mokutil=$(mokutil --sb-state 2>&1 ) |
462 | | - error_mokutil=$(mokutil --sb 2>&1 ) |
463 | 474 | if [[ "$error_mokutil" == *"EFI variables"* ]] |
464 | 475 | then |
465 | 476 | echo -e "$error_mokutil" |
466 | 477 | elif [[ "$error_mokutil" == *"Command 'mokutil' not found"* ]] # |
467 | | - then |
468 | | - echo -e "\tThis would check / have checked if SecureBoot was enabled or not, " |
469 | | - echo -e "\t and checks if the system BIOS was UEFI or Lagacy only BIOS, " |
470 | | - echo -e "\tbut package mokutil was not installed. If you would like to check" |
471 | | - echo -e "\tthis information, please install 'mokutil' and rerun script." |
| 478 | + then |
| 479 | + echo -e "\tThis would check / have checked if SecureBoot was enabled or not, " |
| 480 | + echo -e "\t and checks if the system BIOS was UEFI or Lagacy only BIOS, " |
| 481 | + echo -e "\tbut package mokutil was not installed. If you would like to check" |
| 482 | + echo -e "\tthis information, please install 'mokutil' and rerun script." |
472 | 483 | else |
473 | | - #sb_state=$(mokutil --sb-state 2>&1 ) |
474 | | - sb_state=$(mokutil --sb 2>&1 ) |
| 484 | + sb_state=$mokutil_cmd |
475 | 485 | debug "sb_state: $sb_state" 1 |
476 | 486 | if [[ $sb_state == "Failed to read SecureBoot" ]] |
477 | 487 | then |
478 | 488 | sb_disabled="SecureBoot: Disabled" |
479 | 489 | #printf "%-20s %s\n" ${sb_disabled/ /: } |
480 | 490 | echo -e "$sb_disabled" |
481 | 491 | else |
482 | | - # These are the four known messages returned from UEFI |
| 492 | + # These are the known messages returned from mokutil |
483 | 493 | # This system doesn't support Secure Boot |
484 | 494 | # Secure Boot is enabled |
485 | 495 | # Failed to read SecureBoot |
486 | 496 | # Platform is in Setup Mode |
| 497 | + # mokutil: unrecognized option '--sb-state' |
487 | 498 | # |
488 | 499 | #printf "%-20s %s\n" ${sb_state/ /: } |
489 | 500 | echo -e "$sb_state" |
|
0 commit comments