Enhancements
- 3rd-party: Export XDG_DATA_DIRS and XDG_CONF_DIRS in binary wrapper
- 3rd-party: always recreate the binary if a binary is updated
- 3rd-party: repair regenerate all binary wrappers
- Make it mandatory to have a signature for latest file
- Add flag --nosigcheck-latest to proceed with update without checking the signature of latest file, but still checking the signature of Manifests.
- Better warning messages for --nosigcheck flags
- Don't print double slashes for paths in any message
- Add a --force option to swupd 3rd-party add to proceed even when errors found
- Mixin tool deprecated
- Don't try resume downloads if server respond with incorrect range error
Bug Fixes:
- When checking latest version signature, don't consider it invalid if server can't respond file size
- If delta manifests are valid but generating an invalid manifest, download the full manifest again
- Fix problem that caused Getcwd errors to be warned when swupd was run in an invalid directory
- Some files could be removed when a directory was renamed to a symlink in an update
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
During staging, if a file is marked for deletion, and the path to
the file, or the file istelf is a simlink, then it is not removed. This
is incorrect, if the file itself is a symlink it is fine to remove it,
the only case when it should not be removed is when the path to it
contain a symlink.
Closes#1424
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When during an update a directory was removed and replaced by a symlink
to another directory that contains one or more files with the same name
as files in the directory that was removed, swupd will remove the
directory from the target system and then it will try to remove each one
of the files that were contained in the directory. Since the directory is
now a symlink to another existing directory, it may end up deleting the
files from the other directory. swupd should not follow links when
removing files during the staging process.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When generating the certificate for tests, openssl is printing messages
to the terminal, we are already selecting what to print by using the
debug_msg() function, so these unwanted messages shouldnot be printed.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
There are some functions we decided to avoid using, so add a test to make
sure we won't add them by accident.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
vasprintf is already used by other string functions, so create a base
function to be reused and make a copy for log.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
As there are more string functions that will be needed by log and
verifytime and it would be impractical to copy everything, prefering
to include more dependencies instead.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
We need to install/uninstall on test_setup, not global_setup because env
variables are not preserved between tests
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Instead of requiring an external script (.prereq) to generate the certificates
we can regenerate them before running each test.
Also removes completly the .prereq script
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When during an update a directory was removed and replaced by a symlink
to another directory that contains one or more files with the same name
as files in the directory that was removed, swupd will remove the
directory from the target system and then it will try to remove each one
of the files that were contained in the directory. Since the directory is
now a symlink to another existing directory, it may end up deleting the
files from the other directory. swupd should not follow links when
removing files during the staging process.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When updating a bundle using testlib, if the file is updated, and the
update includes a file type change, testlib was updating the manifest
with the correct type but was overwriting the other status flags, so if
a file was marked as 'x' (exported) before, that flag was being removed.
This commit fixes the issue by only updating the flag that relates to
the file type.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
During a 3rd-party repair, the wrapper scripts of all binaries verified
should be regenerated regardless of if the binary was repaired or not.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When updating a 3rd-party bundle, if any of its binaries is modified,
or the binary is new swupd needs to recreate the wrapper script.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When running tests sometimes is useful to see how the filesystem of the
test target system looks like before and after a test. This commit adds
a function to show that chroot fs in a tree view, and it calls that
function in the setup and teardown of tests if DEBUG_TESTS is set.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit provides a function that can be used to generate update
content based on the content from a directory specified by the user.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds a function that retrieve the matching entry from a
manifest or all entries if no key is provided.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds a function to create a bundle based on the content form
a directory specified by the user.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit has a few small corrections in testlib:
- it removes some code that was used for iterative manifests
- it correct some help menus
- favors the use of debug_msg over an if statement for filtering
messages
- do not follow links in the function that creates tars from
fullfiles
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When a test is adding a symlink to a manifest, the file the link is
pointing to is also added to the manifest. This commit prevents the file
pointed by the link to be added, if the user wants to add this file they
can do it explicitely.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds support for file type changes when using bundle_update,
so the correct type is added to the manifest.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
It is considered safe to accept expired signatures to validate the latest
file because we are always checking again the signature of the MoM file.
Adding tests to validate that:
- Expired signatures for latest file works
- Expired signatures for MoM fails even when latest signature is correct
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
- Check if custom certificate is working when valid
- Check if we are having errors on expired certificate
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2 groups were created:
- slow: Tests that are very slow because of sleeps, so we can run them all
in parallel
- system: Tests that make change to the system, so they can cause problems
when running in parallel, so we run them in series.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
When creating a wrapper for 3rd-party binaries, append relative
/usr/share and /usr/local/share to XDG_DATA_DIRS variable and /etc
to XDG_CONF_DIRS.
Fix#1411
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
If the path where swupd is running is removed getcwd errors will occurs, mostly
because of multiple commands swupd executes. So move to directory "/", no mather
where swupd is going to be installed, to make sure the path is always existent.
Fixes#1078
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit removes the extra slash '/' from the path from:
- the update_boot function
- the verifytime script
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Some packages we need to build swupd are not available on ubunutu-latest
so we need to download and build from source. This process is slow and
caching can save us some significant time on build.
When a manifest delta was incorrect, the full manifest was used. But in the
case of a correct delta that produces an invalid manifest, swupd was never
trying to download the full manifest.
Changing code to try to use deltas only once. On first error, always retry
downloading the full manifest.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
It's a bit hard to configure github to block PRs when we change the name of
tests, so keep one with a constant name to validate PRs
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>