84 Commits

Author SHA1 Message Date
William Douglas d20f1ed3d4 Fixup lint errors for 'ineffectual assignment' 2022-11-03 09:14:37 -07:00
William Douglas e999af5e5b Fixup gofmt errors 2022-11-03 09:14:37 -07:00
Mark D Horn 6e576e12ea model: Change ister Version to new type UintString
As of go 1.14 JSON decoder no longer accepts invalid numbers.
https://golang.org/doc/go1.14#encoding/json

Switch Version to a new type and add Unmarshaler to handle the
type which allows unsigned integer or 'latest' as valid values.

Dropped required coverage by 1% for model.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-05-21 16:43:35 -07:00
Mark D Horn 13b15fab04 model: Centralize model initialization
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-05-21 11:08:32 -07:00
Mark D Horn 13b28fd349 yaml: switch to strict unmarshal
Enable Strict Unmarshal to ensure that we fail on unknown
tokens and duplicate tokens.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-05-08 15:03:31 -07:00
Mark D Horn 158fc80191 model: Fix case of allowInsecureHTTP
Documentation and standard convention requires allowInsecureHTTP
to be camel-case, but the code and documentation were both incorrect.
Some users will need to update the YAML files if they already
had the incorrect 'AllowInsecureHttp' which is now 'allowInsecureHTTP'.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-05-08 15:03:09 -07:00
Mark D Horn 2c5af619ef boolset: switch PostArchive from bool to boolset
Change the PostArchive model type from bool to boolset to account
for default of true and state if the value was explicitly set.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-05-07 17:04:00 -07:00
Mark D Horn 4f2caf0e33 boolset: switch AutoUpdate from bool to boolset
Change the AutoUpdate model type from bool to boolset to account
for default of true and state if the value was explicitly set.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-05-07 17:04:00 -07:00
Mark D Horn 59302346d6 linter: enable whitespace
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-04-24 14:53:17 -07:00
Mark D Horn 4244fbaf43 storage/ui: swapfile instead of swap partition
New default is the creation of a /var/swapfile if not
swap partition is explicitly defined in the YAML file
or via Advanced Configuration.

Now use and report media sizes in XiB

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-04-15 17:23:59 -07:00
Mark D Horn b1b702385e swapfile: Add new swap file size option
The size of the swapfile can be set in the YAML file
and overridden by the command line argument.

Update for usage of XiB or XB units.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-04-15 17:23:59 -07:00
Karthik Prabhu Vinod 8da9febcd4 Fix long line issues
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2020-04-10 00:08:40 -07:00
Mark D Horn 636e4804fc model: refactor method name IsDesktopInstall
Renaming method to be more clear.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-03-27 15:07:10 -07:00
Mark D Horn 9283a120fd Enable override for partition validation
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-03-27 15:07:10 -07:00
Mark D Horn be9d9bc64e Update partitioning support in legacy mode
Fixes: #517

Enable the possibility of no /boot partition in legacy mode.
- add warning if no /boot and legacy
  Warn the user that installing in legacy mode without a /boot
  partition means the install will never boot in UEFI mode.
- Force off 64bit mode
  When an ext file system is used for the /boot content
  (no /boot partition, and booting legacy mode) we need to
  disable 64bit flag or the image file system not boot.
  https://wiki.syslinux.org/wiki/index.php?title=Filesystem#ext
- Blocked use of XFS due to partition table requirement to use MBR.
- Do not allow encryption of / w/o /boot

Refactor validation code for reuse by both standard and advanced
disk partitioning. Add new standard Desktop and Server wrapper
functions.

Move validation to common function, remove from Find Targets, and
remove redundant validation function.

Enable the skip size for advanced partitions.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-03-27 15:07:10 -07:00
Mark D Horn ef45a32849 args: model: New options for partition checks
Add command line arguments and YAML file configurations for settings
skipping partition size checks during validation.

Skip Validation All implies Skip Size.

Never write skip validation options to YAML

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-03-27 15:07:10 -07:00
Mark D Horn 9addbc449a telemetry: Prevent error when not present
We were attempting to run the telemetry command to opt out
on the target when the binary was not present.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-03-25 18:30:27 -07:00
Mark D Horn 7e277776a9 controller: Add post-image YAML hook
Fixes: #531

Add new hook to be called after image generation is completed.

Update base image test to use post-image hook

This is useful for image manipulation such as compression, format
modification, etc.
2020-02-27 15:00:31 -08:00
Karthik Prabhu Vinod 31797ecb54 model,log: Small extraneous files fixes
Signed-off-by: Karthik Prabhu Vinod <karthik.prabhu.vinod@intel.com>
2020-02-13 15:54:28 -08:00
Mark D Horn 7478c9e280 model: clean up generated YAML files
Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-02-12 18:37:08 -08:00
Mark D Horn f65cd665ba ISO: Add metadata to ISO images
Add the publisher and the application/image type to the ISO.
- ApplicationId set to 'server' by default, 'desktop' if any
  bundles are included which contain the name 'desktop.
  - ApplicationId can be overridden via the YAML file
- Publisher only set if included in YAML file

Add new test coverage.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2020-02-05 16:51:06 -08:00
Mark D Horn b9970047f9 Allow skipping swupd configuration file copy
Fixes: #600

Only copy the swupd configuration files from the host to the target
by default when running the interactive installer (gui or tui).
Otherwise, observe the setting from the configuration YAML or the
command line (highest) argument.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-12-11 10:47:05 -08:00
Mark D Horn a4f83fd0fe model: controller: Keep Image default
--keep-image defaults to true, we only try to remove an
image file if it is set to false.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-11-26 14:50:47 -08:00
Mark D Horn a9befd5b40 gui: tui: Check for invalid interactive options
Ensure we do not allow the user to set options, either
via command line or in the default configuration file,
which would not be valid during an interactive installation.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-11-25 17:23:40 -08:00
Mark D Horn a46992d460 model: Refactor to enable command line overrides
Enable conversion from JSON to YAML to have values overridden by
the command line arguments.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-11-19 18:18:05 -08:00
Mark D Horn 2afeff5721 model: Warning on extra kernels for json to yaml
When converting an ister JSON configuration file to a
clr-installer YAML configuration file, we want to ensure
a single kernel is set. Additional kernel result in a
warning as ISO mainly due to ISO generation limitation
in the code.

Add new coverage test for multiple kernels.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-11-19 18:18:05 -08:00
John Akre 53db1a1fd9 swupd: Support skipping optional bundles
Optionally included bundles (also-add) can now be omitted from the
install target by passing the --swupd-skip-optional flag or by setting
the swupdSkipOptional field in the config file.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-11-04 09:06:25 -08:00
Mark D Horn e482042355 swupd: model: Allow format to be set in config
Fixes: #559

Allow the format to be set in the configuration YAML file
as well as on the command line.

Useful for mixes.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-10-08 14:09:00 -07:00
Mark D Horn 2e3c5bf50b Support insecure updates over HTTP
Fixes: #478

Add new --allow-insecure-http flag to support the use of HTTP URLs.
This is needed to allow swupd to download content from http sites;
generally development mixes.

Also enable the use of the setting in both the TUI and GUI to allow
the user to set a swupd mirror which is HTTP.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-30 17:32:36 -07:00
John Akre 1527c25d6d Add offline install support
When creating installer images with offline support, installation
content for a minimum set of bundles will be downloaded to the
/var/lib/clr-installer/offline-content directory inside the installer
image. The offline-content directory will be used instead of the network
to install bundles when it exists.

To generate images with offline support, the --offline command line
argument or the offline config file field can be set.

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-09-23 16:08:10 -07:00
John Akre bf89aeaa40 Add targetBundles support to config
The targetBundles field in the config file specifies the minimum set of
bundles that the installer image's installer will install to the target
media. To achieve this functionality, a config file is generated and
inserted into the installer image at /var/lib/clr-installer.yaml. This
config file contains the list of bundles specified by targetBundles and
a minimum set of entries based on the config file used to generate the
installer image (keyboard, language, timezone, kernel).

Signed-off-by: John Akre <john.w.akre@intel.com>
2019-09-23 16:08:10 -07:00
Alex Jaramillo 8e3af8152c telemetry: do not fail if bundle is not installed
This change removes the need for telemetrics bundle to be present for
the installer to work.

Signed-off-by: Alex Jaramillo <alex.v.jaramillo@intel.com>
2019-09-23 15:43:27 -07:00
Mark D Horn b4c1c98a55 model: Save autoUpdate to the YAML when false
Since we have code which assumes we want autoUpdate to be true
unless it is added to the YAML file, we need to be sure it is
write to the YAML when false.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn bfc624d8fc model: args: Clean up of temp config files
Need a new command line arg to flag for the deletion
of a temp state YAML file.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn b86ff39669 telemetry: model: Only save when user defined
We should only store the telemetry answer when it was
user selected. This fix was needed due to the new advanced
configuration which save the temporary state.

Need to update the ister model for the new change.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn a2216162f0 test: Add model test for new code
No easy way to test all of the error conditions of
Marshaling and Unmarshaling, so dropping the coverage by 1%

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn db3a17c7c6 gui: base media page layout complete
- model: Store precheck status in model
- Refactor sudo user into reusable function
- Enable the partitioning tool button

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn a1edb51e1d model: Refactor model clean for reuse
Write out the model without media

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn 7098434b5a storage: Change InstallSelected to be a map
Change InstallSelected to be a map with the key being
the name of the TargetMedias from the model to support
installing across multiple disks.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn c34252d846 model: Add lock file to model
This is needed to ensure proper locking while running the external
tool for disk partitioning for Advanced disk configuration during
interactive installations.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Mark D Horn b078557b0b media: Validate across multiple media
It is possible that to split the required partitions
across several media.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-09-12 19:20:47 -07:00
Brian J Lovin 18661f08ed model: Add tests for Karg clearing
Add a couple tests to ensure we can clear both Add and Remove kernel
arguments.

Signed-off-by: Brian J Lovin <brian.j.lovin@intel.com>
2019-07-02 14:54:57 -07:00
Mark D Horn 63824e6df6 kernel: bug fix for clearing parameters
graphical will crash if you "confirm" without a value
for the kernel command line.

Also fixed the same bug in the text-based interface.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-07-02 14:54:57 -07:00
Alex Jaramillo eb019bcd7a telemetry: Include hypervisor to telemetry payload
Include the name of the hypervisor in the telemetry payload when
installed in VM.

Signed-off-by: Alex Jaramillo <alex.v.jaramillo@intel.com>
2019-06-26 15:50:40 -07:00
Mark D Horn d96230f8d9 tui: gui: Do not display version in Demo mode
For documentation purposes (screen shots), we do not want to
include the version string. Having a version string in the image
requires updating all image each release.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-05-08 16:04:27 -07:00
Reagan Lopez 9ee68d0a3e Initialize localization in test files
Signed-off-by: Reagan Lopez <reagan.lopez@intel.com>
2019-04-23 18:52:18 -07:00
Mark D Horn cff36aa736 Generate ISO Framework hook
Create the command line argument and configuration file changes
to support generating an ISO from the raw image.

TODO: Integrate the ISO generation code

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-04-19 15:06:47 -07:00
Mark D Horn 3334c1ff67 storage: Identify Install Target types
Safe: gpt disk with sufficient space
Destructive: All media (expect mounted)
Modify: all gpt disks

When adding new partitions, ensure we store the new
partition number and update the device name.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-04-18 12:48:36 -07:00
Mark D Horn 5dbee42d7d Fix Network Interface Copy
Fixes Issue: #261

Pull Request #236 introduced a bug where local network interfaces
are always copied to the target media.
This PR correct this by only copying when copyNetwork is set to
true; this is enabled in the UI when the users changes a network
interface (for static).

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-03-12 15:17:58 -07:00
Mark D Horn f424bdb143 Track user selected bundle separately
Fixes Issue: #242

Only show user selected bundles on the summary menu item for
bundle selection; not core, required bundles.

Make the latest user bundle changes more evident by prepending
them to the list of bundles to install.

Signed-off-by: Mark D Horn <mark.d.horn@intel.com>
2019-03-06 13:20:26 -08:00