This release adds enhancements, bug fixes and test improvements.
Enhancements:
- Download manifest deltas when provided by the server to have smaller updates
- Swupd can verify a list of bundles instead of verifying the full system
- Improve error messages on swupd network connection errors
- Return meaningful and consistent exit codes on swupd errors
- Add configurable download retries (--max-retries and --retry-delay)
- Add bytes transferred in telemetry reports and inform this to the user on updates
- Start tracking manually installed bundles so we can use that info in the future
Bug Fixes:
- Don't remove files under /usr/src on verify --fix --picky
- Don't force bootloader execution if the bootloader binary isn't present
- Don't follow relative symlinks when installing new files
- Use timestamp from installed system when adjusting the system time
Tests
- Add unit tests to functions hard to test using functional tests
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When we are checking if the SSL is working and the server is up we don't care
about the server return code. We just care if the server is responding. So
we shouldn't set the curl option CURLOPT_FAILONERROR.
The major problem of this change is that some servers don't respond to GET
in '/'. So checking the connection using the version url will fail in that
cases if CURLOPT_FAILONERROR is set.
As we don't really need the other options, reverting that change back to
how it was before.
Fixes#792
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
The is_tracked_bundle function doesn't not accurately portray its
purpose, rename to is_installed_bundle as it is actually looking at
the installed content directory.
When a user is using the -p/--path option with swupd he can point to a
chroot installation of clear or a custom mount. However when swupd
checks the system time to see if it is sane it compares it with a
versionstamp hardcoded in /usr/share/clear/versionstamp, which causes
swupd to fail in systems using -p.
This commit prepends the path_prefix to the versionstamp path so it
points to the correct file if using the --path option.
Closes#812
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
27 was a number to big for max transfers and it was slowing download down in
multiple scenarios. Reducing that number.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
If we are having problems to download in parallel the best alternative
is to stop downloading in parallel instead of trying to reduce the
number of parallel downloads, because retries are expensive.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Instead of printing errors and warnings, just print debug information
when we are looking for the right ca path to use. If we couldn't
connect to the server, abort and print a clear error message.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Test verify-latest-missing.bats was not checking what it says it should test.
Fixing that removeing the latest file instead of removing the full webdir.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Before downloading full manifests try to use manifest deltas if available.
If deltas are missing, use full manifest.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Use similar output and same exit code used when you are already in the
last version in the case where you are updating to the same version you
already are.
i.e. if you are in version 100, both commands are going to have the same
exit code:
- swupd update
- swupd update -m 100
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This function is specific for update and it couldn't be used in any
other situation (mostly because of the output messages). So moving it
to update.c
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit adds an option to disable compiler optimizations which is
very useful when debugging a problem in swupd.
Note: the user would still need to make sure the optimization option is
not enabled in his/her CFLAGS variable.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
--force/-x is specific for verify command, but documentation was stating
that it was global. Removing all references from a global --force and
adding that information to the help page of verify command.
Also moves the force variable from global to verify.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Display the bytes transferred after each update in the message
that shows "took N seconds" by appending the info.
This includes total transfer bytes for verify, update, check,
bundle-add and bundle-remove.
The curl error handling function is the perfect location to
capture the bytes for each transfer, and add them to a global
counter. The global counter is then included in each telemetry
event.
swupd search returns 0 both when something is found and when nothing
is found.
This commit makes a change so it returns 0 (SWUPD_OK) if search found
somthing and 1 (SWUPD_NO) if it didn't.
Closes#731
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
To reduce code duplication, this commit replaces the switch within the
retry_download_loop function with if statements.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds the tests to validate the configurable retries
for sync downloads.
It also moves the tests for autocompletion from their own "completion"
directory to a more general "usability" directory so we can add more
tests in that directory in the future.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes is useful for some tests to be able to force an http code that
corresponds to a filure when using the test web server, that way we can
simulate network problems very easily.
This commit adds an option for forcing the web server to return a
specified http code.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds two new options:
-r, --max-retries: maximum number of retries for download failures
-d, --retry-delay: initial delay between download retries
With these two is possible to increase the number of retries in case the
user is in a non reliable network, or to turn off retries intirely (by
setting --max-retries to 0). The --retry-delay will also allow more
flexibility for unreliable connections, and will make testing easier
since the --retry-delat can also be set to 0.
Closes#322
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Curl is using a different max retry value for async and sync downloads,
also is using a different variable for the delay between retries.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The retry code in swupd is not an ideal implementation, making it
difficult to use throughout the code base. Some parts retry
differently based on needing to support retries for network errors,
or retry based on IO errors.
This commit refactors this code into a consistent implementation so
the retry code is not spread across the code base.
Closes#211
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Adding a unit test for string functions on string.h module.
Unit tests will help us to test functions that are hard to test
with function tests. String conversions, for example would be extremely
hard to test using functional tests.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When swupd needs to run a boot script it does so without checking if the
file exists in the system or not. This will cause an error to be raised
by the shell if the script does not exist.
This commit adds a check for the existance of the script before
attempting to run it.
Closes#795
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Those files are generate that in build time, so there's no reason to keep
them here.
We went out of sync before and it's easier to make sure the last man page is
used if we generate that on build time.
Also removes man page tests because they don't make sense anymore. And add
option --disable-manpage, so we can build swupd without manpages if rst2man.py
isn't available.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit reorganize the codes in the swupd_code enum so the codes
that were already defined before are still the same. This commit also
renames some of those codes so they are more consistent with the rest of
the codes in the enum.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The guide in how_to_contribute.md specify a set og rules to follow to be
a contributor of the swupd client project.
This commit adds the guidelines for using return/exit codes in functions
within the swupd source code.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
All exit codes that get propagated to the end user should be defined in
the swupd_exit_codes.h file. This commit changes the type of data
returned by those functions which the user interacts with so instead of
returning an int we return a swupd_code. This way it'll be easier to
identify what functions only return a documented code. If a function
returns an integer value not in swupd_exit_code.h then it should use int
instead.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for verify.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for update.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for mirror.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for clean.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for search.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for check-update.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for hashdump.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Regardless of what codes are used internally, swupd should always
exit with a code defined in swupd_exit_codes.h.
This commit makes those changes for bundle-list.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>