76 Commits
Author SHA1 Message Date
John Akre eac860e338 Add statedir-cache support
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>
2019-08-20 14:45:34 -07:00
Otavio Pontes 299977fec4 update: Download search-files indexes on update
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>
2019-08-14 13:04:23 -07:00
John Akre 031c06776e os-install: Add download flag
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>
2019-08-07 14:12:34 -07:00
Castulo Martinez 165be11ab9 Adding information about the config file
Closes #1020

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-30 09:54:56 -07:00
Castulo Martinez e82e21d7a3 Updates to the man pages
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-30 09:54:56 -07:00
Castulo Martinez 17e1148763 Update the man pages about "swupd verify -B"
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-29 15:20:56 -07:00
Castulo Martinez 62925f2191 Removing --bundle flag from diagnose
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>
2019-07-29 15:20:56 -07:00
Castulo Martinez 2e3a584558 Removing --bundle flag from repair
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>
2019-07-29 15:20:56 -07:00
Castulo Martinez 6a0849646d Adding --extra-files-only flag to diagnose/repair
Since --picky was made a superset of diagnose/repair, there is the need
of a new flag that only finds/repairs the extra files that are not in
any manifest.

Many things were included in this commit:
- This commit adds the new flag --extra-files-only for this purpose.
- The commit also refactors the verify function to simplify its workflow
and remove code duplication
- It also adds some validations for flags that are mutually exclusive in
verify/diagnose/repair
- Updates the documentation

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-19 10:46:20 -07:00
Castulo Martinez e0256bee24 Make "diagnose --picky" a superset of "diagnose"
Running "swupd diagnose --picky" result in only identifying the extra
files in the system, but doesn't run the other standard checks that a
"swupd diagnose" do. "swupd diagnose --picky" should do everything
"swupd diagnose" does plus searching for the extra files.

This commit fixes the issue by making diagnose --picky a superset of
diagnose. The commit also makes some changes in the output of --picky so
it is consistent with the rest of the diagnose output.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-19 10:46:20 -07:00
Castulo Martinez b5f418b108 Adding --wait-for-scripts flag
When running tasks that require to run post update scripts in swupd,
for most users we don't want to wait for the scripts to finish running,
those can be run in the background so we can finish the task faster.
However for some users like DevOps, clr-installer, and QA, it is useful
to have a way to instruct swupd to wait until these scripts have finish
running.

This commit adds a way of doing this by introducing the
--wait-for-scripts flag.

Closes #909

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-17 10:50:17 -07:00
Otavio Pontes ad87ab124e docs: Improve swupd search docs
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-15 16:23:50 -07:00
Otavio Pontes 1b791c9b1e docs: Fix wording on documentation related to swupd verify deprecation
Also removes TODOs that aren't going to be executed anymore

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-15 16:23:50 -07:00
Otavio Pontes 4ca53af48a progress: Add a flag to run swupd without progress report
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-07-15 11:44:24 -07:00
Castulo Martinez 10bc311e4c Fixing duplicated flags in swupd
Some swupd flags from subcommands clash with some global flags.

This commit fixes the issue by renaming the duplicated flags in the
subcommands.

Closes #946
Closes #950

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-12 14:28:05 -07:00
Otavio Pontes 9fe500d038 docs: Add document explaining how we do signature verification on swupd
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-06-28 15:52:16 -07:00
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