summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLyndon Brown <jnqnfe@gmail.com>2020-03-28 06:11:15 +0000
committerRaphaƫl Hertzog <hertzog@debian.org>2020-04-23 14:53:06 +0200
commitf8a401f068a83f71ac266f91dc07c4228f5efff7 (patch)
tree65cfdd3642581d3f6b2881cf80ca26678fdb40bd
parent5fb790e43e5dff20340278f9ca7a66939b0f15f9 (diff)
downloadvyos-live-build-f8a401f068a83f71ac266f91dc07c4228f5efff7.tar.gz
vyos-live-build-f8a401f068a83f71ac266f91dc07c4228f5efff7.zip
config: add --validate option
running `lb config --validate` causes the script to stop after running the validation check on the config compiled at that point, prior to writing the config to disk. this gives users the ability to check the validity of a config without modifying or rewriting the saved config. note that if users provide new config options alongside --validate, these are taken into account in the check performed. the 'check complete' message will not be seen if an error is reported by the check function, while it will be seen if only warnings are given, but it would require a redesign of the validation check function to make any improvement in that area, and it's perhaps not worth it. Gbp-Dch: Short
-rw-r--r--manpages/en/lb_config.14
-rwxr-xr-xscripts/build/config13
2 files changed, 16 insertions, 1 deletions
diff --git a/manpages/en/lb_config.1 b/manpages/en/lb_config.1
index 897a0db6c..4b258f8a0 100644
--- a/manpages/en/lb_config.1
+++ b/manpages/en/lb_config.1
@@ -232,6 +232,8 @@
.br
[\fB\-\-updates\fR true|false]
.br
+ [\fB\-\-validate\fR]
+.br
[\fB\-\-verbose\fR]
.br
[\fB\-\-win32\-loader\fR true|false]
@@ -479,6 +481,8 @@ selects which program is used to install tasks. By default, this is set to tasks
enables or disables Secure Boot support when using grub-efi, by installing signed shim and grub-efi packages. By default, this is set to auto, which means if the packages are available they will be installed, but if not only a warning will be printed and the normal non-signed grub-efi will be used.
.IP "\fB\-\-updates\fR true|false" 4
defines if debian updates package archives should be included in the image or not.
+.IP "\fB\-\-validate\fR" 4
+requests that the config be validated only, not changed, thus after the validation check the script ends rather than writing an updated config. Please note that at the time of writing, many options do not have corresponding validation checks.
.IP "\fB\-\-verbose\fR" 4
increases the verbosity of messages output by \fBlb build\fR.
.IP "\fB\-\-win32\-loader\fR true|false" 4
diff --git a/scripts/build/config b/scripts/build/config
index d9ada6f84..9c375b4b9 100755
--- a/scripts/build/config
+++ b/scripts/build/config
@@ -129,6 +129,7 @@ USAGE="${PROGRAM} [--apt apt|aptitude]\n\
\t [--tasksel apt|aptitude|tasksel]\n\
\t [--uefi-secure-boot auto|enable|disable]\n\
\t [--updates true|false]\n\
+\t [--validate]\n\
\t [--verbose]\n\
\t [--win32-loader true|false]\n\
\t [--zsync true|false]"
@@ -159,7 +160,7 @@ Local_arguments ()
net-root-path:,net-root-server:,net-cow-filesystem:,net-cow-mountoptions:,net-cow-path:,
net-cow-server:,net-tarball:,onie:,onie-kernel-cmdline:,firmware-binary:,firmware-chroot:,swap-file-path:,swap-file-size:,
loadlin:,win32-loader:,source:,source-images:,breakpoints,conffile:,color,no-color,debug,force,
- help,ignore-system-defaults,quiet,usage,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:,
+ help,ignore-system-defaults,quiet,usage,validate,verbose,version,bootstrap-qemu-static:,bootstrap-qemu-arch:,
uefi-secure-boot:,
bootstrap-qemu-exclude:"
# Remove spaces added by indentation
@@ -220,6 +221,11 @@ Local_arguments ()
exit 0
;;
+ --validate)
+ _VALIDATE_MODE="true"
+ shift
+ ;;
+
--clean)
_CLEAN="true"
shift
@@ -940,6 +946,11 @@ fi
Prepare_config
Validate_config
+if [ "${_VALIDATE_MODE}" = "true" ]; then
+ Echo_message "Validation check complete! Please address any problem notices given above."
+ exit 0
+fi
+
# Creating or updating saved config
if [ ! -e config ]