Commit Graph

3813 Commits

Author SHA1 Message Date
Lyndon Brown c3f0d39675 config: apt-get should probably be an allowed and documented --apt value
since everywhere where 'apt' is a permitted value, 'apt-get' is also, it
just wasn't listed in the option's documentation and thus was also not
listed in the new validation check.

Gbp-Dch: Short
2020-04-23 15:23:30 +02:00
Lyndon Brown c57b8679a4 config: fix broken backwards compatibility hack
80aa5ab611 implemented a hack to handle
replacement of LB_LINUX_FLAVOURS with LB_LINUX_FLAVOURS_WITH_ARCH in
config files, but implemented it in the wrong place.

adding a conditional conversion within the config file meant that the old
value would only be read from **new** config files that are created
obviously without it, including re-saved configs if `lb config` were
re-run with additional options (not recommended). any existing value in an
existing config file would actually be ignored.

the right place to read the old value was in the Set_defaults() function
(since renamed).

a second issue also existed with the hack, it failed to excape the `$`
and thus printed the existing value of $LB_LINUX_FLAVOURS into the
conditional check being constructed in the config file, instead of
printing the name of the variable. the check embedded into the config
file thus became this on an amd64 machine:
```
if [ -n "amd64" ]
then
	LB_LINUX_FLAVOURS_WITH_ARCH="amd64"
fi
```
which is clearly not what was intended.

Gbp-Dch: Short
2020-04-23 15:23:15 +02:00
Lyndon Brown 3645719f22 config: stop writing 'default: <foo>' lines to config files
while helpful for users to know the defaults, the values printed as the
supposed defaults for most are actually the same values as being
configured, or in some cases a piece of text "autodetected or empty", and
thus the information is completely wrong and actually unhelpful since it
misinforms the user.

fixing this to give the real defaults is very much non-trivial.

as a workaround users wanting to know the default for an option can always:
 a. use `lb config` wit no options (or auto) in a clean directory and thus
    get a config with all defaults.
 b. look at the live-build code.

if they just want to reset an option, they can also just comment it out.

Gbp-Dch: Short
Closes: #904614
2020-04-23 15:16:46 +02:00
Lyndon Brown eb2eb9b51e installer: rework validation check for installer type
(and move the wget options setting down where it should be while at it)

the value of LB_DEBIAN_INSTALLER is now properly checked in the main
validation routine, so we can just directly exit here as a simple safety
check should validation be bypassed.

Gbp-Dch: Short
2020-04-23 15:16:26 +02:00
Lyndon Brown 9ab7a100da config: add missing deprecation warning
Gbp-Dch: Ignore
2020-04-23 15:14:16 +02:00
Lyndon Brown 780ce25288 config: minor reorganisation
Gbp-Dch: Ignore
2020-04-23 15:13:33 +02:00
Lyndon Brown cd68a4f61f config: strip unhelpful comments
Gbp-Dch: Ignore
2020-04-23 15:12:17 +02:00
Lyndon Brown 2d272fff5c config: expand validation coverage
to cover checking available value choices

Gbp-Dch: Short
2020-04-23 15:11:50 +02:00
Lyndon Brown 46bce5a6d1 config: reorganise validation checks
splitting into two parts will make things much tidier

Gbp-Dch: Short
2020-04-23 15:09:56 +02:00
Lyndon Brown 554a8d1108 tidy up grub bootloader compatibility checking
- add a validation check where an error will be printed
 - replace the check done in the grub scripts with one that simple exits
   if executed bypassing the validation check

Gbp-Dch: Short
2020-04-23 15:08:07 +02:00
Lyndon Brown 9b70092f25 config: tidy validation 2020-04-23 15:04:51 +02:00
Lyndon Brown 39572ccf3f config: merge defaults.sh and configuration.sh, part 2
...and second we then change the filename

Gbp-Dch: Short
2020-04-23 15:02:43 +02:00
Lyndon Brown 2d877a2cb9 config: merge defaults.sh and configuration.sh, part 1
the stuff in defaults.sh is only partially to do with setting default
config values, it also does other prep work like centralised comma
separated value to space separated conversion, and validation.

this is split into two parts to keep the diff simple, first we move the
two small functions from configuration.sh into default.sh...

Gbp-Dch: Short
2020-04-23 15:02:38 +02:00
Lyndon Brown 34c3f79be4 config: better handle error condition
Gbp-Dch: Ignore
2020-04-23 15:02:14 +02:00
Lyndon Brown 576ec6165a config: reorganise the option case block
move away from the somewhat config file grouping based organisation to
an alphabetised list, after grouping into script-specific; general;
build-specific and other.

the config file based organisation was a bad choice, making it hard to
find the right place to insert options for instance.

Gbp-Dch: Short
2020-04-23 15:01:48 +02:00
Lyndon Brown 6c51a80e99 config: organise getopt longoption set
alphabetised per line lists, broken up into multiple lines where exceeding
80 chars.

Gbp-Dch: Short
2020-04-23 15:00:18 +02:00
Lyndon Brown 51f6f2e41d config: remove spurious secondary validation check
it is already done just before writing the config to disk; this check is
happening just after doing so and is thus pointless.

Gbp-Dch: Short
2020-04-23 14:59:47 +02:00
Lyndon Brown f8a401f068 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
2020-04-23 14:53:06 +02:00
Lyndon Brown 5fb790e43e config: rename Set_config_defaults() to Prepare_config()
it mostly applies defaults where a value does not exist, but does more in
some cases. the new name better reflects its usage and functionality.

Gbp-Dch: Short
2020-04-23 14:52:20 +02:00
Lyndon Brown 7de8a0faa7 config: rename Check_config_defaults() to Validate_config()
this is used after applying user settings on top of the defaults,
so is not specific to checking defaults; it's a validation checker.

Gbp-Dch: Short
2020-04-23 14:51:58 +02:00
Lyndon Brown 430fdc3040 config: move defaults set in wrong function
Gbp-Dch: Ignore
2020-04-23 14:51:28 +02:00
Lyndon Brown 39e4d3e3cb --binary-images can support only a single type
whilst some parts of the codebase were set up to work with multiple types
specified, others did not work with it and would not necessarily be easy
to adjust. this thus makes some tweaks to adjust things accordingly.

 - option renamed to singular form (maintaining backwards compatibility)
 - a validation check has been added
 - unnecessary glob style type references fixed
 - checks with In_list changed to a direct singular comparison
 - typo of type "netboot" written as just "net" fixed (though unreachable
   so of no consequence; really the code could be removed but it's trivial)

Gbp-Dch: Short
2020-04-23 14:51:09 +02:00
Lyndon Brown cede584a5c manpages: fix typo
Closes: #926238
2020-04-23 11:52:13 +01:00
Lyndon Brown 920ec1605b manpages: fix typo
bad escape, '-\' should have been '\-'

resulted in test showing "--mirror-tstrap" instead of "--mirror-bootstrap"

Gbp-Dch: Ignore
2020-04-23 11:52:13 +01:00
Lyndon Brown 4dc91c4007 manpages: remove unhelpful and largely obsolete fixme notices 2020-04-23 11:52:13 +01:00
Lyndon Brown 6b734df9f3 fix incorrect handling of -c|--conffile
this option actually only has an impact when used for `lb config`; it thus
was incorrectly accepted and captured by Arguments() and the documentation
was wrong.

going back through git history, this has been incorrect since the v0.99 days.

also, reorganised the list alphabetically (no-color was inserted in the
wrong place).

Gbp-Dch: Short
2020-04-23 11:52:13 +01:00
Lyndon Brown e4134e1583 manpages: fixup synopsis
live-build page: list of individual commands outdated (color options not
added); incorrect (conffile is `lb config` specific as to be addressed
otherwise separately); is unnecessary here; and the synopsis suggests
usage without a command (e.g. `lb --help` is wrong when it is not).

lb: consistensy fix in formatting.

all: placeholders should be in capitals for consistency; "OPTIONS" is
better the "live-build options" as a placeholder.

config: unlike the others where "live-build options" is replaced with
"OPTIONS", it makes more sense to specifically list the info (help; usage;
version} options, since below the full list of other options including
other generic options are given.

Gbp-Dch: Short
2020-04-23 11:52:13 +01:00
Lyndon Brown 3547c66669 manpages: fix mistake
Gbp-Dch: Ignore
2020-04-23 11:52:13 +01:00
Lyndon Brown db5188aa99 config: support comma and space separated list of source image types 2020-04-23 11:52:13 +01:00
Lyndon Brown 19eccf0108 manpages: document that multiple source image types can be requested
the same is not the case for binary images since although some parts
of the codebase support it, others do not.

Gbp-Dch: Short
2020-04-23 11:52:13 +01:00
Lyndon Brown 3428cb36a7 manpages: revise documentation of --linux-packages
including documenting use of the value "none"

Gbp-Dch: Short
2020-04-23 11:52:13 +01:00
Lyndon Brown 233be38de4 manpages: document that --linux-flavours is space separated 2020-04-23 11:52:13 +01:00
Lyndon Brown b77c3f3b0b manpages: fix typo
"more than that" -> "more than one"

Gbp-Dch: Ignore
2020-04-23 11:52:13 +01:00
Lyndon Brown fcdb3e8eea manpages: document space separation for --keyring-packages 2020-04-23 11:52:13 +01:00
Lyndon Brown 997c978c0e manpages: document all values for --interactive 2020-04-23 11:52:13 +01:00
Lyndon Brown d38a097809 config: support comma or space separated archive area lists 2020-04-23 11:52:13 +01:00
Lyndon Brown 673b811627 config: support both comma and space separated to-cache stages 2020-04-23 11:52:13 +01:00
Lyndon Brown 9abdf31d9f manpage: document that multiple stages to cache should be space separated 2020-04-23 11:52:13 +01:00
Lyndon Brown 9b61541ef1 manpage: fix consistency issues
- in underlining option parameters
 - in some cases of single or multiple (quoted + space separated) values

Gbp-Dch: Ignore
2020-04-23 11:52:13 +01:00
Lyndon Brown b833eb3650 manpages: indicate in usage that multiple bootloaders can be given
Gbp-Dch: Ignore
2020-04-23 11:52:13 +01:00
Lyndon Brown f73797158e bootloaders: improve bootloader list handling
two parts of the code worked with both comma and space separated lists,
while two others only worked with comma separated.

swapping out commas with spaces when we setup the var in
Set_config_defaults() means that individual scripts no longer need to worry
about it and everything supports both; and that we can avoid the
IFS/OLDIFS mess.

Gbp-Dch: Short
2020-04-23 11:52:04 +01:00
Lyndon Brown ae9143141d manpages: fix mistake
the bootloader list should be comma separated not space. i do not know
what possessed me to write space based in
aed4e0fef2.

fix "booloader" typo while at it.

Gbp-Dch: Ignore
2020-04-23 11:46:36 +01:00
Lyndon Brown 286caf03be fix outdated grub-legacy bootloader name references 2020-04-23 11:46:36 +01:00
Lyndon Brown da57ad77b9 manpage: document that multiple archive areas should be space separated 2020-04-23 11:46:36 +01:00
Lyndon Brown 91d446d93e Fix permissions & ownership of copied /etc/resolv.conf
Closes: #857740

[tweaked by Raphaël Hertzog to fix the chown root:root call]
2020-04-23 12:20:35 +02:00
Lyndon Brown 6fa4b5bae9 binary_hdd: fix variable name typo 2020-04-23 10:14:55 +00:00
Lyndon Brown 9fb3d69046 config: fix wrong saved value for parent archive areas 2020-04-23 10:13:21 +00:00
Lyndon Brown 1a0c813c46 chroot_apt: fix broken removal 2020-04-23 10:05:51 +00:00
Lyndon Brown affcbb95d1 chroot_apt: improve readability 2020-04-23 10:05:51 +00:00
Lyndon Brown 7d46dd81fc chroot_dpkg: remove redundant chmod
left over from before using `ln` to setup the diversion

Gbp-Dch: Ignore
2020-04-23 09:57:25 +00:00