@@ -73,14 +73,16 @@ def check_battery_status() -> dict:
73
73
}
74
74
75
75
76
- def hardware_inhibitor_checks_failed (hardware_checks_failed : bool , failures : list ):
76
+ def hardware_inhibitor_checks_failed (
77
+ hardware_checks_failed : bool , failures : list , dbus_ask_for_updates : bool
78
+ ):
77
79
# log the failed update
78
- if check_for_updates (hardware_checks_failed ):
80
+ if check_for_updates (hardware_checks_failed ) and dbus_ask_for_updates :
79
81
ask_for_updates ()
80
- # notify systemd that the checks have failed,
81
- # systemd will try to rerun the unit
82
- exception_log = "\n - " .join (failures )
83
- raise Exception (f"update failed to pass checks: \n - { exception_log } " )
82
+ # notify systemd that the checks have failed,
83
+ # systemd will try to rerun the unit
84
+ exception_log = "\n - " .join (failures )
85
+ raise Exception (f"update failed to pass checks: \n - { exception_log } " )
84
86
85
87
86
88
def check_hardware_inhibitors () -> bool :
@@ -200,10 +202,14 @@ def main():
200
202
201
203
if not args .force and not args .updatecheck :
202
204
hardware_checks_failed , failures = check_hardware_inhibitors ()
205
+ if hardware_checks_failed :
206
+ hardware_inhibitor_checks_failed (
207
+ hardware_checks_failed ,
208
+ failures ,
209
+ dbus_notify and not args .check ,
210
+ )
203
211
if args .check :
204
212
sys .exit ()
205
- if hardware_checks_failed :
206
- hardware_inhibitor_checks_failed (failures )
207
213
208
214
if args .updatecheck :
209
215
update_available = check_for_updates (False )
0 commit comments