60 Commits
Author SHA1 Message Date
Castulo Martinez 2cb0dd80b4 Renaming "swupd verify" to "swupd diagnose"
This commit renames the "verify" command to "diagnose" to make it
more straightforward for the user to understand the purpose of the
command.

Closes #918

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-05-14 15:51:28 -07:00
Castulo Martinez dc8e9235d5 Making verify --fix a top-level command
The purpose of "swupd verify --fix" is to repair local issues relative
to a server manifest. However the verify command currently has many
flags, and some flags are mutually exclusive, this makes the command
very confusing to use for users.

This commit makes "swupd verify --fix" the top level command
"swupd repair". This new command still uses the verify code under the
covers.

Closes #914

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-05-14 14:33:49 -07:00
Castulo Martinez a84c60a500 Making verify --install a top-level command
The purpose of swupd verify --install is so it can be used to install
a new Clear OS in a target system. However since currently it is part
of the swupd verify command it makes it confusing as of to what its
purpose is.

This commit moves the swupd verify --install option to be a top level
command (swupd os-install) so its purpose is more straightforward. The
new command still uses the verify code to perform the task underneath.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-05-14 14:26:30 -07:00
Otavio Pontes 6c4b44ac37 docs: Use doxygen style on header API documentation
Documentation coverage on src/lib is now 100% and the goal is to eventually
reach that for everything on src/.

Also improve some documention on headers.
2019-04-23 14:59:43 -07:00
Otavio Pontes 30f4ec4436 docs: Add a doxyfile to make it easier to check documentation coverage 2019-04-23 13:27:10 -07:00
Otavio Pontes d8bb8f3abc search: Taking scope variable parameter out
--scope=b output is the same as -T 1. And if we have a real use case for
--scope=o we can create another parameter just for it.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-28 16:35:01 -07:00
Otavio Pontes 290ec7e503 Remove parameter --display-files from search-file
If search term is empty we will display all files

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-28 16:35:01 -07:00
Otavio Pontes 6d52b7594d verify: Use a different exit code when system is not correct
When using verify to check if the system is sane we should return a
non zero exit code if the system is invalid. And when repairing
(fix or install) we need to use a non zero exit code if some files
are still incorrect after verify has finished.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-27 16:47:36 -07:00
Otavio Pontes 88aaa29505 Set signature verification enabled as default
Signature verification was disabled as a default parameters to make it easier
for people to build the project on other distros. But this can be dangerous
as users may start using a built swupd without signature checking to
install a CL distro.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-07 13:09:58 -08:00
Otavio Pontes 085b520050 Add swupd-inspector command into swupd
Use a binary launcher to load swupd-inspector and execute that
when swupd inspector is run.

Closes #826

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-02-22 09:36:39 -08:00
Otavio Pontes c17c232f85 docs: Fix documentation on --force option
--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>
2019-02-11 14:24:31 -08:00
Otavio Pontes 90834ae18f docs: Remove generated manpages from repository
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>
2019-01-28 17:27:24 -08:00
Castulo Martinez 03ee2623b4 Reorganizing codes to match old values
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez 97187ac439 Adding guidelines for exit codes to the guide
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez a723c0bc4a verify should return consistent exit codes
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez 1aed824085 update should return consistent exit codes
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez 84046e107f mirror should return consistent exit codes
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez ff18daa680 clean should return consistent exit codes
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez b653c6308d hashdump should return consistent exit codes
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez acdc0e0d74 bundle-list should return consistent exit codes
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>
2019-01-24 15:23:15 -08:00
Castulo Martinez ce0dccf95c Make autoupdate return consistent exit codes
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 autoupdate.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-01-24 15:23:15 -08:00
Castulo Martinez 6c7b9e203b Return a more meaningful code on add failure
Some functions currently mask error codes by using a very general error
like SWUPD_COULDNT_INSTALL_BUNDLE (formerly EBUNDLE_INSTALL) in the case of
the bundle-add command.

This commit modifies the codes returned by the bundle-add in case of
failures so they are more meaningful for the actual issue.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-01-24 15:23:15 -08:00
Castulo Martinez 1b9f4f749e Return a more meaningful code on remove failure
Some functions currently mask error codes by using a very general error
like SWUPD_COULDNT_REMOVE_BUNDLE (formerly EBUNDLE_REMOVE) in the case of
the bundle-remove command.

This commit modifies the codes returned by the bundle-remove in case of
failures so they are more meaningful for the actual issue.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-01-24 15:23:15 -08:00
Castulo Martinez a153a97477 Updating documentation about swupd exit codes
Updating the documentation about swupd codes on swupd.1 and
swupd.1.rst

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-01-24 15:23:15 -08:00
Otavio Pontes 83a6c23372 Change a bit the comments style for swupd
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-01-17 10:37:58 -08:00
Otavio Pontes e810ba1f36 verify: Add /usr/src to the list of protected directories on verify picky
Fixes #780

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-01-16 19:23:31 -08:00
William Douglas 1964084191 verify: Enable verifying a subset of bundles
Allow users to verify only a given subset of bundles rather than the
entire system. This also enables an alternative "installation" with a
verify --fix --bundles $foo where foo doesn't include os-core which is
useful for installing 3rd party content that lives outside of /usr.
2019-01-17 03:19:51 +00:00
Otavio Pontes a7adb91f24 Add swupd development guide
Add a simple development guide for swupd. We can maintain that as long as we
add new development rules to swupd project.
2019-01-08 15:08:12 -08:00
Otavio Pontes 2de6b51e35 docs: Add swupd-alias.7.rst to repository
We have defined that we are committing to the repository the rst files,
so I'm adding the alias rst file

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2018-12-12 09:26:25 -08:00
William Douglas 92e0caf470 Add alias feature for bundle-add
Add a new alias filetype that swupd understands. This file's format is
the following:

A potentially multiline file with an alias name per line followed by,
ont he same line, a list of bundle names with all fields being tab
separated.

If the same alias is defined in the same file, the first definition
will be used. Malformed lines will not be parsed but it is valid to
have multiple concurrent tabs in a line.

The files are to be read from both user and system alias directories
with stateless overrides of system files with user files. This implies
you can mask a system file with a user file of the same name if the
user file is a symlink to /dev/null. You can also override a system
file with a user file of the same name but with different content (the
contents of the system file will be unused). Alias files are
considered in lexicographical order sorted the same as bundle-list. If
two files provide the same alias than the one in the file that comes
first lexicographically will be used. User files will always come
before system files, such that if a user file 'u' defines alias 'a'
and a system file 's' also defines alias 'a' the user file definition
will be used instead of the system file definition.

The intended usage of this will be for OS content to provide alias
files that will then enable users to add content using the provided
aliases as well as enabling users to define their own alias for custom
package groups.

Eventually this feature may be considered for extension to other areas
aside from bundle-add but for now only bundle-add usage is to be
supported.
2018-12-07 11:04:09 -08:00
Matthew Johnson 48a016f001 man-pages: add os-format reference
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-10-22 14:11:43 -07:00
Otavio Pontes 3287a87e53 Remove 404 from the list of possible swupd return codes
Linux programs return code should be a number between 0 and 255, so 404 is an
invalid return code. Removing it from docs and from swupd-error.h file.

As it wasn't being used, this won't be a problem.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2018-10-18 10:19:29 -07:00
Otavio Pontes cffe1a66a4 Fix documentation and bash script after parameter rename
max-parallel-pack-downloads was renamed to max-parallel-downloads
and documentation needs to be fixed

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2018-10-10 14:22:46 -07:00
Castulo Martinez 6f846b9069 Adding the --keepcache option when doing updates
After running an update, the state directory is cleaned up.
Sometimes it is useful to be able to peek at the state directory
after an update, this is specially true when testing updates,
this way tests can verify what manifests were downloaded during
the update.

This commit adds the --keepcache option to swupd update so it can
be used when writing tests for updates.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2018-10-03 15:43:11 -07:00
Otavio Pontes 15b987ccb1 download: Add a parameter to control the parallel pack downloads
Add parameter --max-parallel-pack-downloads to control the number
of packs to be downloaded in parallel. This is usefull if for some
reason the default value is too high or low for your configuration.
2018-09-11 14:27:10 -07:00
Otavio Pontes 8fb7ca8f2f Fixing typos and orthography errors on docs and codebase
Errors reported by codespell (https://github.com/codespell-project/codespell)
2018-08-24 11:15:41 -07:00
Matthew Johnson 51538dd495 swupd-add-pkg: remove deprecated script
Replaced by mixin in the mixer-tools project.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-08-15 11:49:33 -07:00
Otavio Pontes 69e0ae9736 docs: Fix typo (s/privilged/privileged/) 2018-08-15 09:57:38 -07:00
Icarus Sparry a1b10fc81b Notes on debugging Travis.
Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2018-07-23 11:37:05 -07:00
Brian J Lovin 82a88d30a8 manpage: Add --skip-diskspace-check to bundle-add
Added a description for the new --skip-diskspace-check flag
to the bundle-add section of the swupd manpage.

Fixes #506

Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com>
2018-06-29 14:23:20 -07:00
Matthew Johnson 5f39d1e86e manpages: add return-code documentation
Additionally remove the unused EPREP_MOUNT error code.
Fixes #296

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-06-18 10:50:40 -07:00
Matthew Johnson 356ce157c1 swupd-add-pkg: remove sudo invocations
Instead of doing this behind the user's back expect them to do it
themselves. This also removes the inconsistencies of running some
commands with sudo -E and others without -E. If users want to provide -E
let them do it themselves.

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-05-10 14:52:09 -07:00
Matthew Johnson b654f34115 Add documentation for mirror subcommand
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-04-30 14:25:57 -07:00
Matthew Johnson 6dd8c6abb6 docs: move 'info' subcommand to alphabetical order
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-04-30 14:25:57 -07:00
Caio Marcelo de Oliveira Filho c9469307f4 update: allow update to a specific version using -m
Allow updating to a version greater than current using -m. Also
supports 'latest' that has the same behavior as not passing any flag.

If the requested version is smaller than the server version (which
is the latest one available in the current format), use that. If not,
use the latest available and re-execute.

Care was taken so that a "update -m LAST_OF_A_BUMP" will not trigger a
re-execution of update.

At the moment version_url is still used, but a future improvement
could avoid it by first looking at the format of the given version
first.

Fixes #257.
2018-04-14 20:34:58 -07:00
Geoffroy Van Cutsem 317d44fe3c Update "swupd verify" documentation to cover all options
Add "swupd verify" options that were missing from the documentation
(swupd.1.rst and swupd.1) but listed by the tool when calling
"swupd verify -h". The order was also slightly changed to be
identical to the order used by "swupd verify -h".

Signed-off-by: Geoffroy Van Cutsem <geoffroy.vancutsem@intel.com>
2018-04-14 16:28:09 -07:00
Caio Marcelo de Oliveira Filho 88eea5f9e9 Add info command to show OS version and URLs
Fixes #218.

Signed-off-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-01-25 10:02:44 -08:00
Matthew Johnson de773f8ecf Add missing flags to man page
The following flags have been added to the man page
--no-scripts
--nosigcheck
--ignore-time
--certpath
--time
--no-boot-update

Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2018-01-23 14:05:32 -08:00
Matthew Johnson 24e0803d85 Update out-of-date man page
Signed-off-by: Matthew Johnson <matthew.johnson@intel.com>
2017-12-01 11:00:02 -08:00
Patrick Ohly d59738ece7 swupd verify: fix --picky, add --picky-tree and--picky-whitelist
The code implementing the suppression of /usr/lib/kernel,
/usr/lib/modules and /usr/local did a rather simplistic prefix
comparison with strncmp() to match path names against these
exceptions. As a result, paths like /usr/lib/kernel.old which should
get reported also got skipped.

An if check tested the wrong variable, so the result from strdup()
wasn't checked.

The replacement code uses regular expression matching and allows
replacing the default (--picky-whitelist
"/ignore-this-top-level-dir"). A single parameter is enough when using
the | operator.

A/B partition update must remove extra files in the entire partition,
which can be selected with --picky-tree=/, and also needs to override
the default whitelist.

Fixes #336
Implements #239

Signed-off-by: Patrick Ohly <patrick.ohly@intel.com>
2017-11-30 17:15:09 -08:00