Commit Graph
65 Commits
Author SHA1 Message Date
Castulo Martinez 727797a051 Removing legacy verify command from autocompletion
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>
2020-01-28 15:02:20 -08:00
Castulo Martinez a562fb4fd3 Implement --file option for diagnose/repair
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>
2020-01-28 15:01:47 -08:00
Castulo Martinez 381f08dea1 Adding installation status to bundle-list
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>
2020-01-22 13:10:48 -08:00
Castulo Martinez 3f3ff08c8f Add ability to search files in specific version
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>
2020-01-08 11:36:48 -08:00
Castulo Martinez ca98b3a7db Adding "3rd-party clean" command
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>
2019-12-20 16:38:41 -08:00
Castulo Martinez 24de99dfcc Housekeeping on 3rd-party commands
This commit does some housekeeping in the 3rd-party commands:
 - Initialize the function "progress" only after swupd has initialized
   successfully.
 - Make functions that are not used outside of a file static.
 - Avoid using regex or partial verifications on tests when possible.
 - Add 3rd-party command flags to the default config file.
 - Don't use "repo" in help menus, use the whole "repository" word.
 - Add 3rd-party sub-commands to the flag_validator script.
 - Add missing values from the autocompletion scripts.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 12:14:08 -08:00
Castulo Martinez cb67bf7b67 Implementing the "3rd-party check-update" command
This commit adds the ability to check for updates on 3rd-party repos.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 11:50:33 -08:00
Castulo Martinez 11ddfefc88 Implementing the "3rd-party repair" command
This commit adds the ability to repair bundles from 3rd-party repos.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 11:23:37 -08:00
Castulo Martinez d96b6f6d92 Implementing the "3rd-party diagnose" command
This commit adds the ability to diagnose bundles from 3rd-party repos.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-20 10:57:37 -08:00
Castulo Martinez f48c58e737 Implementing 3rd-party update command
This commit adds the ability to update the system based on the 3rd-party
repositories the user have.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-12 08:41:45 -08:00
Castulo Martinez 33b4e9ea52 Implementation of 3rd-party bundle-info command
This commit adds a new "3rd-party bundle-info" command which can be used
to show information about a bundle from a 3rd-party repository. If no
3rd-party repository is specified, the bundle is searched for in all
available repositories.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-12 08:17:55 -08:00
Castulo Martinez 9d59dc068e Implementing the 3rd-party bundle-remove command
This commit adds the ability to remove 3rd-party bundles. If a repo is
not specified the bundle will be searched for in all repositories. All
options from the normal bundle-remove command are supported with
3rd-party bundles.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-11 16:11:35 -08:00
Castulo Martinez b91ecbbc6d Implement --repo flag for 3rd-party bundle-list
This commit adds the --repo flag for the 3rd-party bundle-list command
which can be used to specify the repository from which the bundles are
going to be listed.
2019-12-05 16:05:51 -08:00
Castulo Martinez be1573f064 Implementing 3rd-party bundle-list command
This commit introduces a new command to list bundles from all 3rd-party
repositories. At this point users cannot choose a specific repo to show
its bundles but rather all repos are shown.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-12-05 15:44:51 -08:00
Castulo Martinez 1216f89d79 Allow users to specify the 3rd-party bundle to use
When a user is adding bundles from a 3rd-party repository, if the user
doesn't specify the repository, swupd will search for the bundle in all
3rd-party repositories. If the bundle is in more than one 3rd-party
repository, he/she needs to specify the repo to use.

This commit adds the means to specify this repo by providing the
--repo/-R flag for 3rd-party bundle-add.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Castulo Martinez dd00a16659 Adding autocompletion for 3rd-party bundle-add
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-11-27 14:56:10 -08:00
Karthik Prabhu Vinod 8069064c43 Add third-party skeletal features
This PR starts the third-party repo-add, delete, list skeletal features
for swupd. This PR also add support for configure flag
to build third-party optionally for swupd, off by default.

Repo Add:
 sudo swupd 3rd-party add <repo_name> <URL>
Repo Remove:
 sudo swupd 3rd-party remove <repo_name>
Repos List:
 sudo swupd 3rd-party list

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-10-31 10:23:00 -07:00
John Akre bf4cdc03a0 os_install: Skip optional bundles when flag set
When the --skip-optional flag is set, optional (also-add) bundles will
be skipped.

Fixes: #1182

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-10-31 09:12:21 -07:00
Castulo Martinez 109f36ebeb Adding dummy --recursive flag for bundle-remove
This commit adds the --recursive flag to bundle-remove but doesn't
implement its functionality, only makes the flag available in the
command line and into the command's documentation.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-10-30 13:38:41 -06:00
Otavio Pontes 2bf4169a4a Don't mix tabs with spaces in the same file
And prefer tabs over spaces, because that's the project standard for
source files

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-10-29 11:54:25 -07:00
Karthik Prabhu Vinod c207c9240c Add --path to swupd autoupdate mechanism
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>

Fixes #527
2019-10-21 12:26:48 -07:00
Castulo Martinez f7aeea5cef Implement bundle-info command
The bundle-info command shows detailed data related to a specified
bundle. Among the data currently displayed it includes:
- If the bundle is installed or not
- If the bundle is experimental or not
- If the bundle is installed, it shows if there is an existing update
for the bundle
- The latest available version of the bundle
- The size of the bundle and all its dependencies
- The max size needed in disk to install a bundle if not installed

This commit also adds the following command flags:
--version: so a user can display information for a bundle in a
specific version, not only the current version.
--dependencies: this flag can be used to show all optional and required
bundles that are directly and indirectly included by the specified
bundle.
--files: this flag can be used to show all files that are part of a
given bundle.

All flags can be combined to show specific data.

This is the first of a series of PRs to implement the bundle-info
features referred to at #461.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-10-04 08:42:55 -07:00
Castulo Martinez e419e7fa9d Refactor bundle-remove to include improvements
This commit does a major refactor of the bundle-remove command to
include these improvements:

- Adds a "--force" flag that can be used to remove a bundle that is
required by other installed bundles along with all the bundles that
depend on it
- When attempting to remove a bundle which is required by other
installed bundles, swupd used to show the list of dependencies in a tree
view, this list was very large in some cases. This commit changes the
output of such cases from a tree view to a simple deduplicated list of
bundles that require the bundle to be removed. The user can still see
the old tree view by including the --verbose when running the command
- Stops notifying telemetry of user errors, like user trying to remove
an invalid bundle, or a bundle that was not installed, etc
- Consider all bundles provided in the bundle-remove command when
checking for dependencies (required by)
- Instead of removing each bundle in the command one by one, consolidate
all bundles to be removed, validate them and remove them all at once.
This will optimize the tasks to be executed for removing bundles.

One change included in this commit for bundle-remove is propagated to
bundle-list:

- When using "bundle-list -D BUNDLE" to find what bundles depend on
BUNDLE. The list will be presented in a simplified deduplicated list of
dependencies by default instead of the tree view that used to be
default. The user can still see the old tree view by running the command
appending the --verbose flag

Closes #891
Closes #732
Closes #674

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-09-30 14:40:01 -07:00
Castulo Martinez 5ff26d385f Re-enabling the --bundles option with repair
Now that --bundles has been made safe to use, it can be re-enabled with
repair to only repair problems with the selected bundles.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-09-20 15:26:51 -07:00
Castulo Martinez 395a1c5c98 Re-enabling the --bundles option in diagnose
Now that the -B/--bundles option has been made safe to be used with
diagnose it can be re-enabled.

This commit enables the --bundles option when using diagnose, so users
can now only verify that the comma separated list of bundles are
correctly installed. The --bundles option cannot be used along with the
--picky option or the --external-files-only, these two options remove
all files in the picky-tree path that are not listed in any of the
manifests from installed bundles, when using --bundles the manifests
considered are only those from the bundles in the list, so the user
would end up deleting many files which is probably not what they want.
So these options are not allowed.

Users will still be able to use --bundles with --picky or --bundles with
--extra-files-only with the "verify" command (for backward
compatibility). The verify command has been superseded and will be
removed from the documentation eventually, so only users that know about
this command and are already using it for something would continue to
use --bundles with --picky or --extra-files-only.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-09-20 15:26:51 -07:00
Karthik Prabhu Vinod 15be9a7f09 Show format bump
Now, we have global option
and info_verbose logging level.
For this PR, we have verbose for info,
check-update which shows format versions.
This also helps future implementations leverage
the use of a verbose option for their own need.

commands:
swupd check-update --verbose
swupd info --verbose

Fixes #1066

Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2019-09-18 14:22:30 -07:00
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 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
Lucius Hu f8c68f3151 swupd.bash: faster bundle-add 2019-07-25 10:23:22 -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 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 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 43ba5def2a Require a force flag to continue with insecure URL
Currently users can set content and version urls based on http or https
protocols. This pose a security risk if users decide to use http.

This commit blocks swupd from working with http unless is specifically
allowed by using the --allow-insecure-http flag.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-27 14:48:50 -07:00
Castulo Martinez 91cc01bf14 Extract global flags to own variable in swupd.bash
This commit extracts all the global flags to its own "global" variable
in the swupd.bash script so it is easier to maintain.

The commit also fixes some inconsistencies with the flags in the script.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-06-27 14:48:50 -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 3e7721583d swupd.bash" Remove extra " when setting COMPREPL
Bash completion was adding line breaks because of that extra " on COMPREPLY

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-05-10 12:43:06 -07:00
Castulo Martinez 2d29ae07f4 Removes iter manifests from bundle-add completion
There is a bug in the code that causes swupd bundle-add <TAB><TAB>
to list regular bundle names as well as iterative manifest names.

This commit fixes the issue by removing the iterative manifests from
the list of results.

Closes #906

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-05-09 15:33:00 -07:00
Castulo Martinez 069af9decf Enabling the --json-output flag as a global option
The --json-output flag can be enabled for every swupd command.

This commit converts it to be a global flag, and enables it in every
swupd command.

Closes #869

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-04-01 12:03:23 -07:00
Otavio Pontes 7d6fa1db05 search: Add support to regular expressions in search-file
Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2019-03-28 16:35:01 -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
Castulo Martinez 67e4e8dda9 Autocompletion for --debug and --quiet
Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-03-28 13:05:36 -07:00
Castulo Martinez 7d1ceb3806 Add functions to report progress
This commit add a few functions to report partial progress on a given
step, either in JSON format or standard so a user or another app can
tell what is the current progress status of a swupd operation at all
times.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-03-25 16:07:40 -07:00
Castulo Martinez c5a271299c Add search-file to autocompletion script
Since search became search-file and there is a new search, the
autocompletion script needs to be updated.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-03-05 16:44:12 -08:00