Commit Graph

50 Commits

Author SHA1 Message Date
Richard Hughes
f63080fbe2 Allow assigning issues to devices
This allows us to show in the tools if a device is currently affected
by a specific CVE. For instance, we could inform the user that a device
requires a critical firmware update that is being actively exploited.

Note, this also means we can show the user a firmware update is now
required, even though the firmware may not be available on the LVFS.

Also show the issue in the `fwupdmgr security` output, e.g.

    There are devices with issues:
      Samsung — MZVLB2T0HALB-000L7:
       • CVE-2022-12345
       • CVE-2022-54321
2022-02-16 14:50:29 +00:00
Richard Hughes
dbd0995071 Add support for outputting versions in JSON format
To use this, do: 'fwupdmgr --version --json'
2022-02-03 15:42:57 +00:00
Richard Hughes
c05494430e trivial: Add support for 'fwupdtool get-plugins --json' 2022-01-15 19:01:12 +00:00
Richard Hughes
25ee969a27 trivial: Enable VT sequences on Win32 2022-01-06 19:21:50 +00:00
Richard Hughes
a0cb743700 Show changes in HSI attributes when required
e.g. `fwupdmgr security --force` would display:

    Host Security Events
      2021-10-29 10:51:42:  ✘ Kernel lockdown disabled
      2021-10-29 10:51:42:  ✘ SecureBoot disabled
      2021-10-29 09:32:32:  ✔ IOMMU device protection enabled
      2021-10-29 09:28:52:  ✘ IOMMU device protection disabled
2021-11-01 06:58:44 +00:00
Richard Hughes
d3706e0e0b Show the user a warning if updating may affect full-disk-encryption
Additionally, if the client does not set the feature flag `fde-warning`,
add an extra paragraph into the update description.

Fixes https://github.com/fwupd/fwupd/issues/3829
2021-10-09 08:09:38 +01:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Richard Hughes
046e81e844 trivial: Fix search and replace typo in defining the term colors 2021-06-24 14:22:08 +01:00
Richard Hughes
4462ac4f78 Ask the user to confirm all CLI actions
For some users typing 'fwupdmgr update' just deploys all updates to all hardware,
and that might come as a shock. Ask the user to confirm all actions explicitly
and show the update notes in a warning box rather than plain text on the console.
2021-04-28 15:56:01 +01:00
Richard Hughes
e69f0f5f7c trivial: Add an optional title to fu_util_warning_box() 2021-04-22 15:35:37 +01:00
Mario Limonciello
75835b4a0b Use FWUPD_COMPILATION define to indicate an in tree build
When this is done, include:
* Including the hash
* Including anything that is not ABI stable in plugins yet

Suggested-by: Simon McVittie <smcv@debian.org>
2021-01-22 14:01:25 -06:00
Richard Hughes
89ee9edc0a Allow going back to the 'default' branch
We only want to translate a NULL branch into 'default' for display, and not
actually store it in the GPtrArray.
2021-01-20 20:19:02 +00:00
Richard Hughes
5c9b1fcc81 Only include the start year in the copyright header
The end year is legally and functionally redundant, and more importantly causes
cherry-pick conflicts when trying to maintain old branches. Use git for history.
2021-01-07 14:48:16 +00:00
Richard Hughes
3a73c342ba Switch from libsoup to libcurl
The former drags on glib-networking and then gsettings-desktop-schemas, which
add over 5Mb to the minimal IoT and CoreOS composes. Everything already uses
libcurl (even NetworkManager!) and so this is an easy way to reduce image size.
2020-11-19 19:39:37 +00:00
Mario Limonciello
bd60de12be Add a flag to indicate if packages are supported
Anyone can easily add this, but it makes it clearer that by default hand
build, snap, and flatpak are not checked by anyone.
2020-11-11 14:34:59 -06:00
Mario Limonciello
02f2cc311e Add switch-branch support to fwupdtool 2020-10-21 12:00:55 -05:00
Richard Hughes
1c62adec69 Get the list of unique branch names for 'switch-branch' 2020-10-15 18:05:29 +01:00
Richard Hughes
7bcb8d4385 Export FwupdPlugin so we can convey enumerated system errors to the end user
For instance, we can tell the user that UEFI UpdateCapsule is disabled in the
system firmware, or that efivarfs is not mounted. This is much better than
creating "dummy" devices which are really just hacks around the problem because
no better API existed. THe dummy devices cause as many problems as they solve.

Plugins have to set FWUPD_PLUGIN_FLAG_USER_WARNING if a warning should be shown
to the user, and only one warning will be shown of each failure type.

It is expected that GUI clients like gnome-software and gnome-firmware would use
this API to notify the user the localized message for why firmware updates are
not being shown.

Fixes https://github.com/fwupd/fwupd/issues/2456
2020-10-13 15:56:49 +01:00
Mario Limonciello
02085a0371 trivial: rework fwupdtool activate
Only use the history database to tell if activation should be run.
Instead query the connected devices to find the ones needing activation.

This should allow non-connected devices to not cause a failure (although
it might be a longer shutdown).

Also sort the devices, so that the order follows the defined order from
the daemon and they activate in the same order they install.
2020-09-14 11:28:55 -05:00
Richard Hughes
5c82b94322 Do not show HSI obsoleted attributes by default
When one result is obsoleted by another, then do not show the old result by
default.

Additionally hide the HSI URLs as this was designed more for GUI clients like
gnome-firmware than CLI tools such as fwupdmgr.
2020-09-14 09:58:46 -05:00
Richard Hughes
9b6d616383 fwupd: Export fwupd_client_download_bytes() into the client library
The logic here is that we can use one central session for all client actions.

Also, set the user agent for the *runtime* version of fwupd -- it's the runtime
version we use when checking capabilities, rather than the built-against
version. This would also explain why there are so many very obsolete versions
of fwupd being recorded on the LVFS...
2020-07-08 19:00:42 +01:00
Mario Limonciello
eb7be16bf0 fu-util/fu-tool: Group devices in get-updates/update calls
Fixes: #1840
2020-07-03 11:58:34 -05:00
Richard Hughes
6d9ae625ed trivial: Move the report success report to common code
This would allow us to use it from fwupdagent in the future.
2020-06-16 15:49:28 +01:00
Richard Hughes
196c6c69db Add support for the Host Security ID
The HSI specification assigns a simple text ID to the current state of firmware
security. As new vulnerabilities are found, and as protection measures are
updated, new requirements will be added to the required firmware behaviours for
each HSI value.

The HSI specification is currently incomplete and in active development, and
so the --force flag is required in all command line tools. The current ID value
will probably change on a given platform so please do not start using the result
for any kind of compliance requirements.
2020-05-11 22:11:49 +01:00
Richard Hughes
fe4b3eadaa trivial: Use the same source version string between daemon and client
This fixes the common problem encountered when developing plugins:

    ./src/fwupdmgr get-devices
    Unsupported daemon version 1.4.0, client version is 1.4.0-179-gcf8095d5
2020-03-30 13:58:25 +01:00
Mario Limonciello
eb442ea9a5 fu-util: Discourage metadata refreshes more than once per day
As the motd timer may be activated to run on a system, ensure that
it hasn't actually stepped on the user running an update manually
or another client such as gnome-software refreshing metadtata.

Users can override this behavior with `--force`.
2020-01-16 10:33:43 -06:00
Mario Limonciello
429a5128d3 Dynamically determine release version
This is inspired by a change in flashrom to read the version string for meson
dynamically.

No need for "post release version bump", this happens automatically from git
now by there being a dirty commit.
2019-11-08 09:52:02 -06:00
Mario Limonciello
98b951688a Use device safety flags to show prompts before installing updates 2019-10-30 11:30:36 -05:00
Richard Hughes
8653e70480 trivial: Remove G_BEGIN_DECLS from all private headers 2019-10-09 20:02:16 +01:00
Mario Limonciello
4250d9da62 fu-util/fu-tool: Print devices, remotes, releases using a tree
This brings consistency to all fwupd output and allows stuff like
this:

```
    No upgrades for Thunderbolt controller in Dell dock, current is 43.00: 40.00=older
    No upgrades for Package level of Dell dock, current is 01.00.08.01: 01.00.04.01=older
    No upgrades for RTS5413 in Dell dock, current is 01.21: 01.21=same
    No upgrades for RTS5487 in Dell dock, current is 01.47: 01.47=same
    No upgrades for VMM5331 in Dell dock, current is 05.04.00: 05.03.10=older
    No upgrades for WD19TB, current is 01.00.00.02: 01.00.00.00=older
    ○
    └─XPS 13 9380 System Firmware:
      │   Device ID:           6c24a747f97668873b761558e322398a91dbf394
      │   Current version:     0.1.6.0
      │   Minimum Version:     0.1.6.0
      │   Vendor:              Dell Inc.
      │   Flags:               internal|updatable|require-ac|supported|registered|needs-reboot
      │
      └─XPS 13 9380 System Update:
            Version:           0.1.7.0
            Remote ID:         lvfs
            Summary:           Firmware for the Dell XPS 13 9380
            License:           proprietary
            Size:              0x1563d67
            Vendor:            Dell Inc.
            Flags:             is-upgrade
            Description:       This stable release fixes the following issues:

           Fixed the issue where the Dell Power Manager displays an error when a 130W Type-C adapter is connected to the system.

           new functionality has also been added:

           Added a new feature to automatically suspend BitLocker before upgrading the firmware. After the firmware upgrade is complete, BitLocker is automatically enabled.
```
2019-08-29 13:58:00 -05:00
Mario Limonciello
fee8f499fc Simplify get-devices output to not show un-useful fields
This prevents showing things not generally useful to most people:
Created
Modified
Icon
Plugin
FlashesLeft
2019-08-21 16:12:17 -05:00
Richard Hughes
747f570310 Allow filtering devices when using the command line tools 2019-08-06 20:59:28 +01:00
Richard Hughes
3d00522dd3 Check if the system is offline during install, rather than at startup
This splits out the systemd functionality to a new file, but makes no other
logic changes.
2019-05-18 08:02:29 -07:00
Mario Limonciello
88f8b7f8e1 fu-util: Check that daemon is started by expected unit
Unexpected behaviors can happen if:
* a snapped daemon is running with a packaged frontend
* a packaged daemon is running with a snapped frontend

This should make sure that if the snap is installed on top of a
packaged frontend that people don't try to mix and match as much.
2019-05-08 10:05:31 -05:00
Richard Hughes
acfa4ef012 Display the remote warning on the console in an easy-to-read way
The lines are almost impossible to read as they are not wrapped and not
delimited from the normal script output. Add a box around to make them stand out:

    ╔══════════════════════════════════════════════════════════════════════════════╗
    ║ The LVFS is a free service that operates as an independent legal entity and  ║
    ║ has no connection with Fedora. Your distributor may not have verified any    ║
    ║ of the firmware updates for compatibility with your system or connected      ║
    ║ devices. All firmware is provided only by the original equipment             ║
    ║ manufacturer.                                                                ║
    ║                                                                              ║
    ║ Enabling this functionality is done at your own risk, which means you have   ║
    ║ to contact your original equipment manufacturer regarding any problems       ║
    ║ caused by these updates. Only problems with the update process itself        ║
    ║ should be filed at https://bugzilla.redhat.com/.                             ║
    ║                                                                              ║
    ╚══════════════════════════════════════════════════════════════════════════════╝

    Agree and enable the remote? [Y|n]:
2019-05-01 14:03:11 +01:00
Richard Hughes
fb9cfffe7d trivial: Share some systemd code for future usage 2019-04-17 12:12:13 -04:00
Richard Hughes
02ac92c17c Add a component categories to express the firmware type
Some firmwares only update one part of the system, e.g. the EC or ME firmware.
Other updates include all the updates needed for the whole system, and vendors
have been doing different things with the component name due to this.

To fix, add an enumerated set of firmware 'categories' that can be set by the
uploader in the metainfo.xml file (or changed the LVFS) which automatically
set the name suffix.

Only append the translated version in the client when <categories> has
not been set, as the LVFS is still operating in compatibility mode and setting
the <name> with the prefix. Add the support to fwupd now so we can switch in
about 9 months time.
2019-04-04 17:35:02 -04:00
Richard Hughes
4499d19ba3 Move out the offline update functionality to a new binary
The offline updates environment is special, and we have to be careful to delete
the trigger before doing anything that can fail to avoid boot loops.

For this reason, split it out to a simple self-contained binary that is easy to
understand.
2019-03-08 09:45:30 -06:00
Richard Hughes
7120667ccd trivial: Move getting the SoupSession to common code 2019-03-01 10:07:50 -06:00
Richard Hughes
c77e111449 trivial: Move command line handling into common code
I'm about to use this a third time, so now is the time to refactor.
2019-03-01 10:07:50 -06:00
Richard Hughes
2d3287a231 Use G_BEGIN_DECLS correctly for internal headers 2019-02-10 17:33:20 +00:00
Richard Hughes
bfd946e463 Use '#pragma once' to avoid a lot of boilerplate 2019-02-09 08:42:30 -06:00
Mario Limonciello
3f243a9e9e fu-util/fu-tool: sync up reboot and shutdown behavior
It's currently a hodge podge of commands that can install files not
always invoking a reboot or shutdown.

Move the actual code into `fu-util-common.c` and make sure that all
`install` and `update` functions call it now.
2019-01-22 21:06:08 +00:00
Mario Limonciello
2d4b7a5826 trivial: fu-util/fu-tool: Move --version into a common shared function
This is mostly for usage with the flatpak so it's easy to tell what
version of the flatpak is installed.
2018-09-14 18:22:38 +01:00
Richard Hughes
798cb062bf trivial: Refactor out functionality to get a user cachedir filename 2018-08-30 17:29:52 +01:00
Richard Hughes
02c90d8a03 Remove the unused Emacs indenting headers from all source files
Fixes https://github.com/hughsie/fwupd/issues/636
2018-08-09 12:48:04 +01:00
Mario Limonciello
d1775bc026 uefi: Populate UpdateError with reasons that the plugin won't run
Previously if missing secure boot binaries, or invalid ESP was created the
plugin would just not load.

Now instead populate UpdateError and remove the updateble flag, but still show
the device in fwupdmgr and fwupdtool.
2018-07-17 14:30:27 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Mario Limonciello
ba9e5b94ff Bring get-topology to fwupdtool
Also ammend the behavior of get-devices to match fwupdmgr
2018-05-22 05:44:52 +01:00
Richard Hughes
f761640aa1 trivial: Split out some CLI functionality for future use 2018-05-18 10:08:10 +01:00