When a statedir manifest is corrupt, the statedir-cache must also be
cleaned so that the manifest can be downloaded over the network on the
second attempt.
Signed-off-by: John Akre <john.w.akre@intel.com>
The contents of the statedir-cache can be copied to the statedir, so it
must follow the same permission requirements.
Signed-off-by: John Akre <john.w.akre@intel.com>
The --statedir-cache flag specifies a secondary statedir that will be
checked before downloading files over the network.
The primary reason to use the statedir-cache is to enable the os-install
command to take advantage of hardlinks when installing content across
partitions. In this case, update content stored in the statedir-cache
(source partition) will be copied to the statedir (target partition) before
installing content into the target partition. Since the update content
will exist on the target partition before installation, hardlinks can be
used instead of copies.
Signed-off-by: John Akre <john.w.akre@intel.com>
Instead of initializing curl library on start, initialize it only when needed.
The advantage of this approach is that we can run some commands offline, if
there's no file to download.
Fixes#801Fixes#895Fixes#277
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Instead of checking if the url is valid and approved in curl we can check
that in globals. This is important because we should fail even if we aren't
going to download any file and curl may not be initialized
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Don't let users to set the capath to use to test the connection.
This property should be only used by curl module.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
We're seeing a problem in current curl when using the flag
CURLOPT_PIPEWAIT and trying to download a file from an unexistent or
unreachable server.
Easiest way to reproduce that on swupd is to disable your while you are
in the download phase of any swupd command. Without this patch swupd will
hangs and wont timeout.
The downside of removing this flag is that curl will prefer to open more connections
instead of waiting to check if it can multiplex. So it's a good thing to have
this enabled back in the future
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
On updates swupd binary can be replaced so readlink will fail to get the
swudp binary path. In this case we should run that before running any update
process.
And besides that hardcode /usr/bin/swupd as the default swupd path in the case
there's something wrong with readlink
Fixes#1067Fixes#1068
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When running the check-update command we get the latest version for the
format we are currently in, but we really want to get the latest version
regardless of the format.
This commit fixes the issue.
Closes#482
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Estimating the total download size is almost as slow as downloading the
manifests. So just don't do it.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
If --update-search-file-index flag is used on update, all search-file indexes, i.e.
all Manifests will be downloaded on update. This shouldn't be used if you have
disk or network restrictions, but it shouldn't be very download intensive after the
first usage because delta manifests are going to be used.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Previously, when adding included manifests errors were thrown away which
resulted in swupd operations that could succeed, even when failing to
load an included manifest. Now when an included manifest fails to load,
swupd will return a failure.
Signed-off-by: John Akre <john.w.akre@intel.com>
This commit enables the ability to provide many paths for the
configuration file and read configuration from all of them if more than
one config file is found. If the same option is defined in more than one
configuration file it will just be overwritten by the one last read.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This is very handy for testing because we can just run:
$ swupd os-install --path testing/
And the testing/ directory will be automatically created. It's the same
behavior we have for the state dir.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When the --download flag is set for the os-install command, update
content will be downloaded to the statedir and no content will be
installed.
Signed-off-by: John Akre <john.w.akre@intel.com>
check_connection() returns an int. We shouldn't use ! before comparing it to zero.
If check_connection() return is zero it's a success.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Using the -B option with verify can have some undesired side effects
since the option is usually missused by users.
This commit adds a warning explaining what are the possible side effects
of using the "-B" option.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When using the "verify" command, we show a warning saying the command
has been superseded by "diagnose". But if the user also uses the
"--install" or "--fix" options with "verify" we show another warning
saying those options have been superseded.
We only want to show one warning depending on the options chosen by the
user so we suggest them to either use "diagnose", "repair" or
"os-install" instead.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The -B/--bundle option is confusing and causing users to wipe out their
systems. This option was really just meant for os-install, so this
commit removes it from "swupd diagnose"
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The -B/--bundle option is confusing and causing users to wipe out their
systems. This option was really just meant for os-install, so this
commit removes it from "swupd repair".
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When determining if autoupdate is enabled, swupd should not only check
the status of swupd-update.service but has to check swupd-update.timer
as well.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When swupd repair is run with --picky or --extra-files-only it attempts
to remove all those files that are in the picky tree and that are not
mentioned in any manifest (from installed bundles). If swupd
encounters an error removing any of these files or directories, it
prints a message showing the failure. This message was wrong since it
was not showing the whole path to the file being deleted when the path
included a prefix.
This commit fixes the issue by appending the prefix to the path so it
shows correctly.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>