Instead of storing a local copy of a global variable to restore it as
needed in 3rd-party operations, use the backup of the global variables
stored during swupd initialization.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When running 3rd-party operations, most of the times these need to
overwrite some of the global variables in order to reuse the code
use for normal swupd operations.
This commit add means to backup those global variables, so they can be
recovered as necessary.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Add the 'x' to the manifest parser in the 4th column of file attributes,
this will indicate a file should be "exported".
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes possible the creation of bundles with exported files
in test environments. These bundles will have the 'x' in the appropriate
place in the manifest plus those bundles that are to be installed in the
environment will have the "exporting script" created in the 3rd-party
bin directory.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The "verify" command was superceded many months ago. The command
still works and will continue to work for backward compatibility, but
users are discouraged to use it. To motivate users to use the newer
commands, all references to the legacy command has now been removed
from the swupd man page and the help menus.
This commit removes the command from the bash autocompletion script too.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When diagnosing/repairing a system, sometimes is useful to only
diagnose/repair a specific file or path.
This commit implements the --file option for diagnose/repair so a file
or path can be diagnosed only instead of doing it to the whole OS or a
whole bundle.
Closes#1150
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
All messages that are printed by swupd are printed using one of the
existing log functions: print, error, warn, info, info_verbose or debug.
The error() and warn() functions always print a label "Error:" and
"Warning:" respectively and the output is directed to stderr.
Sometimes it is necessary to print a message that should behave like a
normal error() or warning() with the exception of not adding a label,
this provides flexibility when creating messages because a message can
be constructed by mulitple calls to the function.
This commit adds that warn_unmarked, and error_unmarked functions to add
that capability.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Some of the regular swupd commands can be run with a regular user, for
example check-update, however this is not the case for 3rd-party
commands, all of them require root privileges since they all need to at
least read data from root owned directories.
This commit enables swupd to require root privileges for all 3rd-party
commands at initialization time.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
We have a list of header files that weren't documented yet. Add them explicitly
to the check to prevent us to lower the quality of the documentation of headers
that are well documented.
Also fixing some documentation that weren't included because of incorrect style.
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
This commit updates the swupd man pages to have a better looking
formatting, it fixes some omissions in the documentation and also
rewords a few sentences to make the information more digestable.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
bundle-info currently shows the installation status of a bundle, but
this one is restricted to "installed" or "not installed", it doesn't
show if a bundle was explicitly or implicitly installed.
This commit adds this information to the installation status during a
bundle-info.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The "bundle-list" command can be used to show all installed bundles in
the system, however, currently there is no way to know which of those
installed bundles were implicitly or explicitly installed.
This commit implements the "--status" flag for bundle-list which can be
used to show which bundles were explicitly or implicitly installed.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
We used compare-like functions as arguments to other functions that
filter, sort, compare data. These functions are scattered accros the
code and they are sometimes difficult to identify so there is a lot of
code duplication.
This commit organizes all the compare like functions throughout the code
in the same place and with standard naming so it is easier to find them
and reuse them.
Closes#1167
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Swupd should not run post-update scripts after updating content from a
3rd-party repo since it may threaten the security of the system.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This PR re-enables the failing auto-update
tests while moving from travis to github actions
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
Sometimes is useful to see the list of dependencies in a tree view form,
for example when trying to remove bundles from a system.
This commit adds the ability of listing the dependencies of a bundle in
a tree view when --verbose is used.
Closes#929
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit moves the path where the content from 3rd-party bundles is
going to be installed from opt/3rd-party/<bundle_name> to
/opt/3rd-party/bundles/<bundle_name> so bundle directories are separated
from other top level directories like bin.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit improves the diagnose/repair --picky documentation in an
attempt to make it clearer for the user.
Closes#1205
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Using the "bundle-list --has-dep BUNDLE" command shows a list of bundles
that have BUNDLE as a dependency. However this list is not considering
the bundles that have BUNDLE as an optional dependency.
This commit completes the list by including these bundles.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When using "bundle-info BUNDLE --dependencies", information regarding
BUNDLE is presented to the user, this information includes the list of
direct and indirect dependencies BUNDLE has. All direct includes that
are optional (also-add) are marked as such, while there is no way to
distiguish what indirect dependencies are optional with the provided
information.
This commit expands the information shown by the command so indirect
dependencies that are optional are shown as such along with info about
the status of that dependency.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The 3rd-party repository directory is currently 3rd_party, this name is
incorrect and needs to be changed to 3rd-party.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The search-file command is restricted to looking for files in the
current version. This commit adds the --version option to the command
that can be used to seach for files in specific versions of Clear.
Closes#1155
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
Sometimes when a test finds a problem in the source code it is difficult
to determine what is the problem in the code, so the code needs to be
debugged. In order to do this, the test environment of the particular
test has to be created but without running the test, so we can run the
command executed by the test with the debugger.
This commit adds a function (create_test_environment_only) to create a
specific test environment based on a bats file, but without running the
test.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
For some options of bundle-list, like --deps and --has-dep, we sometimes
need to download a considerable amount of manifests, if that happens
swupd just seems to hang for some time, this time could be considerably
in slow networks.
This commit enables the spinner while the manifests are baing downloaded
during a bundle-list operation so users know swupd is not hung and it is
doing some downloading.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit adds a function to print a header in a consistent manner
accross different swupd functions.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When showing the information of a large bundle, there was a variable
that was incorrectly declared so it was overflowing, turning the size of
the bundle into a negative number.
This commit fixes the issue.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When performing a swupd operation, if the progress steps are defined
incorrectly, a buffer overflow may be triggered. This commit makes sure
the steps are still within the specified range by redefining the total
number of steps to avoid the memory problem.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
In order to report progress accuratelly, currently swupd requires a
hardcoded number of steps per operation so we can report how far in the
operation we are. Most of these step totals are wrong.
This commit fixes the number of steps in many swupd functions.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
The line breaks in the commands previously mentioned were off, this
commit fixes the spacing between lines in the output for those commands.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
A spinner was added to swupd to show some kind of progress while
downloading content which its amount is unknown. Once the content is
downloaded the stopped spinner should be removed from the screen. This
commit does that.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit makes a few small changes to the output of the commands to
make it look cleaner and to be consistent with the output of other swupd
commands.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit fixes a buffer overflow that was being triggered when adding
3rd-party repositories.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When we remove a 3rd-party repo from the system, we remove the directory
where all its contents got installed, but we don't remove its state
directory.
This commit removes it since we no longer need that state directory.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When performing signature verification to the MoM or to the version
file, if there is any error during the process, a series of errors are
printed to stderr. Many of these error messages are duplicated and most
of them are too detailed.
This commit filters those detailed messages so they are only seen if the
user is using the --debug flag, showing only a few more general
error messages about the signature failure.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit enhance the consistency and readability, of the messages
shown when the signature verification is skipped or fails.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This commit implements the swupd clean command for the 3rd-party bundles
so users are able to clean the cache on their state directories.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
When running an operation, swupd uses a certificate to validate things
ilke the MoM and the version file. The certificate that needs to be used
for 3rd-party repos is different than the one that has to be used for
upstream.
This commit enables the use of the 3rd-party repo certificate that will
be installed in the repo's directory with all swupd operations, except
when adding the repository, in those cases, since the os-core bundle
hasn't been installed yet, we need to provide the cert path through
other means, like using the -C flag..
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
This makes sure we always deallocate memory if there was an
error after the initial global_init
fix: #1165
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
When adding a 3rd-party repository we need to make sure that the URL
provided by the user is not already assigned to another 3rd-arty
repository, otherwise we can end up having the same repository multiple
times, just with different names.
This commit checks the URL doesn't already exists.
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>