upower: Allow forcing installation even if no AC power is applied

This commit is contained in:
Mario Limonciello 2018-08-21 13:03:37 -05:00 committed by Mario Limonciello
parent e3b1a3f558
commit e3f581297f

View File

@ -64,12 +64,12 @@ fu_plugin_update_prepare (FuPlugin *plugin,
g_warning ("failed to get OnBattery value, assume on AC power");
return TRUE;
}
if (g_variant_get_boolean (value)) {
if (g_variant_get_boolean (value) && (flags & FWUPD_INSTALL_FLAG_FORCE) == 0) {
g_set_error_literal (error,
FWUPD_ERROR,
FWUPD_ERROR_AC_POWER_REQUIRED,
"Cannot install update "
"when not on AC power");
"when not on AC power unless forced");
return FALSE;
}
return TRUE;