Skip to content

Commit c743b98

Browse files
committed
fix: make -c option work as intended
1 parent 3068671 commit c743b98

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/ublue_update/cli.py

+14-8
Original file line numberDiff line numberDiff line change
@@ -73,14 +73,16 @@ def check_battery_status() -> dict:
7373
}
7474

7575

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+
):
7779
# 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:
7981
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}")
8486

8587

8688
def check_hardware_inhibitors() -> bool:
@@ -200,10 +202,14 @@ def main():
200202

201203
if not args.force and not args.updatecheck:
202204
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+
)
203211
if args.check:
204212
sys.exit()
205-
if hardware_checks_failed:
206-
hardware_inhibitor_checks_failed(failures)
207213

208214
if args.updatecheck:
209215
update_available = check_for_updates(False)

0 commit comments

Comments
 (0)