@@ -7,22 +7,41 @@ if [ ! -d "/sysroot/ostree/repo/" ]; then
77 exit 100
88fi
99
10+ components_text_x86_64=' Available components: BIOS EFI'
11+ components_json_x86_64=' {"components":["BIOS","EFI"]}'
12+
13+ components_text_aarch64=' Available components: EFI'
14+ components_json_aarch64=' {"components":["EFI"]}'
15+
16+ none_components_json=' {"components":[]}'
17+
1018# check if running in container
1119if [ " $container " ] || [ -f /run/.containerenv ] || [ -f /.dockerenv ]; then
1220 arch=" $( uname --machine) "
13- if [[ " ${arch} " == " x86_64" ]]; then
14- components_text=' Available components: BIOS EFI'
15- components_json=' {"components":["BIOS","EFI"]}'
16- else
17- # Assume aarch64 for now
18- components_text=' Available components: EFI'
19- components_json=' {"components":["EFI"]}'
21+ output_text=$( bootupctl status | tr -d ' \r' )
22+ output_json=$( bootupctl status --json)
23+
24+ if [ " ${arch} " == " x86_64" ]; then
25+ [ " ${components_text_x86_64} " == " ${output_text} " ]
26+ [ " ${components_json_x86_64} " == " ${output_json} " ]
27+ # test if BIOS.json is missing
28+ mv /usr/lib/bootupd/updates/BIOS.json{,-bak}
29+ output_text=$( bootupctl status | tr -d ' \r' )
30+ output_json=$( bootupctl status --json)
2031 fi
2132
22- output=$( bootupctl status | tr -d ' \r' )
23- [ " ${components_text} " == " ${output} " ]
24- output=$( bootupctl status --json)
25- [ " ${components_json} " == " ${output} " ]
33+ if [ " ${arch} " == " x86_64" ] || [ " ${arch} " == " aarch64" ]; then
34+ [ " ${components_text_aarch64} " == " ${output_text} " ]
35+ [ " ${components_json_aarch64} " == " ${output_json} " ]
36+ fi
37+
38+ # test if no components
39+ mv /usr/lib/bootupd/updates/EFI.json{,-bak}
40+ output_text=$( bootupctl status | tr -d ' \r' )
41+ output_json=$( bootupctl status --json)
42+ [ -z " ${output_text} " ]
43+ [ " ${none_components_json} " == " ${output_json} " ]
44+
2645else
2746 echo " Skip running as not in container"
2847fi
0 commit comments