Commit Graph

58 Commits

Author SHA1 Message Date
Richard Hughes
38bab8fc4f Allow overriding daemon parameters using /var/etc/fwupd/daemon.conf
This is super useful for debugging immutable systems like ChromeOS.
2022-01-21 11:52:06 +00:00
Richard Hughes
e17a107ce1 trivial: Cast the g_signal_connect() object to allow static analysis
This is useful when using https://gitlab.freedesktop.org/tartan/tartan
2022-01-03 22:46:23 +00:00
Richard Hughes
2e99055d1e trivial: Add some more annotations for language bindings 2022-01-03 22:46:23 +00:00
Richard Hughes
beb29ff698 Add a sync-bkc subcommand to ensure a known set of firmware versions
Install or downgrade firmware on all devices to make the system match
a well known set. This allows two things:

 * Factory recovery where a device in the field has been upgraded
 * Ensuring a consistent set of tested firmware for a specific workload

A tag is assigned either during upload or added post-upload on the LVFS
which is included in the metadata. A single firmware can be marked with
multiple tags, and tags can be duplicated for different firmwares.
2021-11-29 15:16:14 +00:00
Richard Hughes
644ac0ea05 Only installing firmwares with signatures by default
99.9999% of users are consuming firmware updates from the LVFS or
another trusted remote. It's far too easy to get a user to enter the
password to install an untrusted firmware, where the security
consequences are pretty dire.

Provide an escape-hatch for firmware engineers, but it does mean
editing a file in /etc as root. This seems like an acceptable level of
inconvenience.
2021-10-15 15:54:44 +01:00
Mario Limonciello
6ebccf1e1e Remove support for --ignore-power by frontends
This functionality broke a number of releases ago as part of
implementing device inhibition and was just noticed now.

Instead of fixing it, the preference seems to be to remove the
functionality as it exists today as inhibitions can happen for
a number of reasons.

To still allow people to override these power warnings (such as during
development) add a new daemon configuration item that can be used.

Fixes: #3778
2021-09-21 13:13:52 -05:00
Mario Limonciello
55de39c077 trivial: reformat the whole tree to match new format 2021-08-24 11:18:40 -05:00
Mario Limonciello
19a2a5791f trivial: let daemon work when configuration missing
By default the daemon start if no configuration is present, but
the first time that an fd is accessed the following error shows up:
```
A maximum read size must be specified
```

This is because the maximum archive size wasn't initialized.
2021-07-28 06:29:09 -05:00
Richard Hughes
b856f0bc42 Allow configuring URI scheme preferences
This would allow, for instance, only allowing IPFS downloads or preferring
https over http downloads.
2021-01-28 15:34:36 +00:00
Richard Hughes
68175e9ba8 Use a quarter of the RAM size as the archive maximum
It is impossible to choose a static default that is appropriate for both a tiny
ARM IoT device and a giant Xeon server.

Fixes https://github.com/fwupd/fwupd/issues/2760
2021-01-14 22:36:38 +00:00
Richard Hughes
0b6f58394b Cancel the file monitor before disposal to avoid a potential deadlock
Fixes https://github.com/fwupd/fwupd/issues/2350
2020-09-01 20:59:56 +01:00
Richard Hughes
3120683143 Allow blocking specific firmware releases by checksum
Fixes https://github.com/fwupd/fwupd/issues/2280
2020-08-10 17:14:15 +01:00
Mario Limonciello
27fd95ae88 trivial: fu-config: stop setting local variable archive_size_max 2020-08-10 10:33:31 -05:00
Richard Hughes
85226fd9d1 Remove potentially problematic language
Red Hat wants to drive an initiative in correcting problematic and potentially
divisive language in open source projects. These naming conventions and
descriptive phrases are hurtful and offensive to many of our colleagues across
the open source universe.

See https://www.redhat.com/en/blog/making-open-source-more-inclusive-eradicating-problematic-language
2020-06-30 17:31:17 +01:00
Mario Limonciello
3dbb92e5d5 trivial: fu-config: Fix behavior for UpdateMotd key
If the file was missing or corrupted the default behavior for this
key should be "TRUE".
2020-03-31 13:05:57 -05:00
Mario Limonciello
4fa95a7b51 Add a new daemon configuration option to control EnumerateAllDevices
For plugins that are configured to only enumerate devices supported
by metadata this will allow showing them in all contexts

Fixes: #1877
2020-03-31 13:05:57 -05:00
Mario Limonciello
d81ea2e3fc Move MOTD population into the daemon
This allows it to be refreshed anytime the daemon updates rather
than once a day by a systemd job.

As part of this change, remove the logging from `fwupdmgr` which
was only used for motd purposes.
2020-01-16 10:33:43 -06:00
Richard Hughes
d1808aae67 Split out the remote loading from FuConfig
It's confusing to have FuConfig load both the daemon.conf file and also keep
track of the enabled remotes. It's also wasteful of memory to keep the GKeyFile
alive the entire time.

Logically these are different pools of information and should be managed by
different objects. This allows us to implement reload() in a sane way and be
less reliant on the inotify event.
2019-12-10 21:40:31 +00:00
Richard Hughes
51a869a01d Use XMLb to query quirks
During startup we do 1898 persistent allocations to load the quirk files, which
equates to ~90kb of RSS. Use libxmlb to create a mmap'able store we can query
with XPath queries at runtime.
2019-10-30 08:29:58 -05:00
Richard Hughes
e4ad9d27fd trivial: Fix a tiny memory leak when starting the daemon 2019-10-05 13:03:19 +01:00
Mario Limonciello
d1681e6de5 libfwupd: Add a new private function fwupd_remote_set_remotes_dir
This allows the daemon to set the base directory to store remotes.

This fixes issues with systemd where the installation prefix was set
to soemthing not writable such as `/usr/local` but systemd
`STATE_DIRECTORY` doesn't match up.

```
$ fwupdmgr refresh
Fetching metadata https://cdn.fwupd.org/downloads/firmware.xml.gz
Downloading…             [***************************************] Less than one minute remaining…
Fetching signature https://cdn.fwupd.org/downloads/firmware.xml.gz.asc

Failed to update metadata for lvfs: Error creating directory /usr/local/var/lib/fwupd/remotes.d: Read-only file system
```

It should also hopefully help with immutable systems.
2019-08-29 11:44:32 -05:00
Mario Limonciello
71d2f62dc2 trivial: update references of hughsie/fwupd to fwupd/fwupd 2019-08-22 09:47:52 -05:00
Mario Limonciello
263cab99e9 fu-engine/fu-config: Reload metadata store when configuration changes
Emit a signal from FuConfig object that is caught by FuEngine to
reload the store.

This should fix problems with Fedora CI failing.
2019-08-21 22:05:24 +01:00
Mario Limonciello
38027e696b Allow setting the daemon verbose domains at runtime 2019-04-17 12:12:13 -04:00
Mario Limonciello
bfcf75b7a6 Allow fwupdmgr to modify the daemon config
This allows several things, for instance:

 * Adding or removing blacklisted plugins or devices
 * Changing the idle timeout where allowed

...without a user needing to manually modify a configuration file.
2019-04-17 12:12:13 -04:00
Richard Hughes
88dc0f4bf0 Do not recreate XbSilo caches when running on a readonly filesystem
For my future self, to debug the fwupd.shutdown activation failure, you can do:

    mount /dev/sdc1 /mnt
    /usr/libexec/fwupd/fwupdtool activate --verbose &> /mnt/log.txt
    umount /dev/sdc1

...where /dev/sdc1 is an attached FAT32-formatted USB drive.
2019-03-07 08:28:36 -06:00
Richard Hughes
5e7017b409 trivial: Add FuConfigLoadFlags argument to fu_config_load()
No functionality changes, but allows us to do something new in the future.
2019-03-07 08:28:36 -06:00
Richard Hughes
8dd4c1c4dd Allow restricting firmware updates for enterprise use 2019-03-05 19:05:07 +00:00
Richard Hughes
fd826c10a0 trivial: Print some debugging when ignoring a remote path 2019-01-29 09:21:54 -06:00
Richard Hughes
75b965d01d Shut down the daemon after 2h of inactivity
Plugins are allowed to 'opt-out' of this behaviour using _RULE_INHIBITS_IDLE.
This should be used where waking up the hardware to coldplug is expensive,
either from a power consumption point of view, or if other artifacts are going
to be seem -- for instance if the screen flickers when probing display devices.

This functionality is also inhibited when the actual upgrade is happening,
for obvious reasons.

Admins can turn off this auto-sleep behaviour by editing the daemon.conf file.

Fixes https://github.com/hughsie/fwupd/issues/417
2018-11-21 18:54:44 +00:00
Richard Hughes
1985b706b9 Fix showing the custom remote agreements
This fixes a regression in 1.2.0 -- the XML files are metainfo.xml files and
thus don't have the surrounding <components> parent tag.

We also want to return XML without the <description> wrapper node, so switch to
including siblings instead.
2018-11-09 15:13:56 +00:00
Richard Hughes
fdcec2c6e8 trivial: Only include a single language in the metainfo silo
Return the warnings in the C locale like we did with appstream-glib.
2018-11-09 15:13:56 +00:00
Richard Hughes
481aa2a923 Port from libappstream-glib to libxmlb
The libxmlb library is much faster to query, and does not require the daemon
to parse the XML metadata at startup. It's a zero-copy mmap design that is more
modern and less clunky.

RSS has reduced from 3Mb (peak 3.61Mb) to 1Mb (peak 1.07Mb) and the startup
time has gone from 280ms to 250ms.
2018-10-17 14:41:13 +01:00
Richard Hughes
83e56c1a6c Don't use AppStream-glib for string helpers 2018-10-11 07:54:01 +01:00
Richard Hughes
b08e7bc7aa trivial: Set a log domain for each file
This allows us to do something like:

G_MESSAGES_DEBUG=FuEngine ./src/fwupd
2018-09-11 18:59:05 +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
Richard Hughes
4be17d1364 Add support for relocating various runtime paths
This allows a snap package to be easily built.

With much help from Mario Limonciello <mario.limonciello@dell.com>, many thanks.
2018-05-31 16:25:22 +01:00
Richard Hughes
f674bc92ec trivial: Fix critical warning when os-release is unavailable 2018-05-30 13:44:05 +01:00
Mario Limonciello
51308e648a Adjust all licensing to LGPL 2.1+ (Closes: #526) 2018-05-29 09:03:13 +01:00
Mario Limonciello
d82e3b565a trivial: Don't fail to start the daemon or fwupdtool if daemon.conf is missing 2018-05-22 18:44:01 +01:00
Richard Hughes
9b7ad9ad62 Do not use the system metainfo location
This means we can avoid loading a ton of non-fwupd files, and reduces our
running RSS from 5.4Mb to 2.8Mb. Old versions of appstream-glib caches a lot of
the localization string data which we just don't care about for firmware files.
2018-05-16 22:38:00 +01:00
Richard Hughes
1fd3ecf7a3 Export fwupd_remote_get_agreement()
We need to show this agreement text in every fwupd frontend and exporting a
helper function allows us to do two things:

 * Share the semi-complicated code (and fallback) to avoid copy and pasting

 * Easily change the code in the future, for instance allowing merging Metainfo
   and AppStream metadata without updating all the front ends with new logic.
2018-04-16 16:44:27 +01:00
Richard Hughes
e7b902eb7b Correctly detect new remotes that are manually copied
Create an inotify watch on the parent remotes.d directory to be notified of new
files being created. This allows us to load the new remote without restarting
the daemon.

Fixes https://github.com/hughsie/fwupd/issues/428
2018-03-05 16:53:01 +00:00
Richard Hughes
321f77a07f Use the default value if ArchiveSizeMax is unspecified in daemon.conf
Fixes: https://github.com/hughsie/fwupd/issues/405
2018-02-14 12:55:45 +00:00
Richard Hughes
c7bbbc246b Allow specifying the maximum archive size in the daemon config 2018-01-03 07:38:27 +00:00
Richard Hughes
34e25a0cc5 trivial: Remove EnableTestSuite from daemon.conf
The same thing can be done using BlacklistPlugins=test
2017-09-19 20:06:44 +01:00
Richard Hughes
10bd8ecfb8 trivial: Remove EnableOptionROM from daemon.conf
The exact same thing can be done using BlacklistPlugins=udev
2017-09-19 20:06:44 +01:00
Richard Hughes
c2af1964b9 trivial: Move /etc/fwupd.conf to /etc/fwupd/daemon.conf 2017-09-19 20:06:44 +01:00
Richard Hughes
b0aa379300 Use a fallback SYSCONFDIR if the default is not set 2017-09-19 20:06:44 +01:00
Richard Hughes
49938e6a07 trivial: Skip non-conf files when searching for remotes 2017-09-16 13:24:50 +01:00