17 Commits

Author SHA1 Message Date
Castulo Martinez e63dc805cf Adding flag validation to the swupd build process
swupd supports global flags and supports local flags that are specific
to subcommands. Flags that are specific to subcommands can be reused in
a different subcommand. Global flags should be unique and should not be
reused as local flags to avoid conflicts.

This commit adds a bash script that checks that the flags currently used
in swupd are valid (have no conflicts with other flags from the same
command or with the global flags). This script will be run as part of
the build process so in case an invalid flag is found the build will be
stopped. Alternatively, the script can be used by developers to validate
a new flag during the implementation time.

Signed-off-by: Castulo Martinez <castulo.martinez@intel.com>
2019-07-12 14:28:05 -07:00
Otavio Pontes 3fdb077ec8 Remove gen-manifest-hash.sh script
This functionality was moved to testlib.bash and we don't need this
script to generate new test cases.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2018-12-13 12:18:03 -08:00
Otavio Pontes c8b203504b Removing unused script
Script assert-certificate-validity.sh checks the validity of a signature
using openssl.
As we aren't using this to validate the signatures we generate in our tests,
I'm removing that from the repository.

Signed-off-by: Otavio Pontes <otavio.pontes@intel.com>
2018-12-13 12:18:03 -08:00
David Klimesh bcabe0e48a Update verify to include purpose for cert check
Newer versions of openssl require a valid purpose so
pass this in for the cert check.

Signed-off-by: David Klimesh <david.j.klimesh@intel.com>
2018-11-29 12:58:00 -08:00
Icarus Sparry 6d452a824d Fix findstatic warnings
Fixes #448

Make a number of functions static, and bodge around the extra symbol
that gcc adds (__gnu_lto_v1) when compiling with -flto=4

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2018-05-22 15:08:38 -07:00
Icarus Sparry bc5cae81dc Update swupd completion code
Make swupd save a copy of the current MoM in a readable location, so
the completion code for bundle-add has access to it.

Stop generating the completion code, just use the file directly.

Remove the short option from the completion code, whilst they are
useful for an expert there is little point typing minus tab and then a
letter rather than minus and the letter.

Add crude filename completion for hashdump.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2018-03-26 11:23:04 -07:00
Icarus Sparry bbb9774703 Fix generation of swupd.bash
When output was changed to stderr for user output, this broke
automatic generation of the bash completion function.

Add suitable redirection to the generation script to capture stderr.

Add test to check the generated file looks reasonable.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-11-02 09:06:57 -07:00
Icarus Sparry 92a6fcaf76 Make the backward compatability check work
Use the correct variable BASH_VERSINFO, rather than BASH_VERSION

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-03-27 13:55:52 -07:00
Icarus Sparry cc7544dfb8 Allow for bash versions before 4.4
bash 4.4 added the 'nosort' option for completion. Use this so the
flag options come before the bundle names.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-03-22 18:32:37 -07:00
Icarus Sparry 611d858797 Reinstate the script which writes the completion function
Include feature request from IRC to not offer os-core and
os-core-update bundles as completion targets for bundle-remove.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-03-22 18:32:37 -07:00
Icarus Sparry 9a8fd39bee Add package names to completion
Remove the script which creates the completion script based on the
output of swupd --help. It wasn't being used (e.g. the completion
didn't have bundle-list in it).

Restructure the completion script to use a case statement to list the
valid completion options. IMHO this makes the code easier to
understand.

Add in package name completion for bundle-add. This requires
/var/lib/swupd/XXXXX/Manifest.MoM to exist (where XXXXX is the
contents of /var/lib/swupd/version), be in the correct format
etc.

Add in package name completion for bundle-remove. This uses the
contents of /usr/share/clear/bundles to get the list of installed
bundles. It would be nice to use $(swupd bundle-list) but it aborts if
it is not being run as root, so this means you can't have completion
for "sudo swupd bundle-remove".

TODO: Fix bundle completion if --path is specified.

Signed-off-by: Icarus Sparry <icarus.w.sparry@intel.com>
2017-03-22 18:32:37 -07:00
Tudor Marcu 72ec546aac Update comment
The only test that is really useful for an OSV is the one that is run first,
which assumes all content passed in is correct. If that fails, the content
must be bad and an update would fail; if that test passes, then we know
at the very least verification and updates would succeed, and the content
is what we expect it to be. The tests performed after use combinations of
invalid inputs, which of course should all fail, and would raise huge red
flags regarding the OpenSSL implementation if they did not - pointing to
regressions or bugs in OpenSSL itself.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-09-06 11:26:03 -07:00
Tudor Marcu 33a0fcba95 Add certificate signature validation script
This script checks that a given data file and signature verify correctly against
a certificate. Without introducing fuzzing, this covers all (8) combinations of
valid and invalid files that may occur, and corrupts them in the more often
seen ways, such as a partially downloaded Manifest, or a wrong signature file.

Signed-off-by: Tudor Marcu <tudor.marcu@intel.com>
2016-09-02 13:35:08 -07:00
Patrick McCarty bd96083f8c Add helper script for test case creation
Eventually, I want to add scripting to more easily create create/manage
manifests for test cases, but for now this script addresses some of the
overhead.

Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-06-22 16:12:38 -07:00
Jose R Guzman 3db13fd519 Fix for completion when absolute path is given
Signed-off-by: Jose R Guzman <jose.r.guzman.mosqueda@intel.com>
2016-06-03 16:56:49 -05:00
Patrick McCarty 44cff67cb4 Move some auxiliary scripts to the scripts directory
Signed-off-by: Patrick McCarty <patrick.mccarty@intel.com>
2016-04-12 10:42:32 -07:00
Jose R Guzman cf9d47383c Adding script to create autocompletion function for complete command.
Signed-off-by: Jose R Guzman <jose.r.guzman.mosqueda@intel.com>
2016-04-12 10:11:16 -07:00