summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)Author
2020-05-05s/Install_package/Install_packages/Lyndon Brown
it installs one or more, so should be plural for clarity Gbp-Dch: Short
2020-05-05make temporary state of installed tools recoverableLyndon Brown
some scripts temporarily install packages to accomplish some work before then removing them. the list of packages installed is kept in memory in a variable. a weakness of this design is that if a failure occurs or the user cancels, and then following this the user re-runs `lb build`, letting it try to pick up and recover from where it left off, that list of packages that had been installed is lost, resulting in those packages that were installed then being a permanent part of the chroot. here we fix this weakness by backing up the list to a file, which is always read from on removal. thus in a recovery situation, any packages still installed from a situation like that just described, will be removed upon the next use of `Remove_package()`. this is not perfect, since we are having to wait for opportunistic execution of the remove function. we need to find a suitable place for the `Cleanup_temp_packages()` function to be used. - doing so in `Init_config_data()` would not be suitable because we don't hold the lock when that's run, even if we ignored the hijacking of that function for taking such action... - doing it in `Exit()` doesn't seem a good fit either. - putting it explicitly in every build script just seems a little messy... perhaps a local exit trap like for removing the lock...? note that `binary_rootfs` skips running the remove function after installing tooling, since it just throws the wrapper chroot away, which then leaves the file around with stale data for the next remove instance to pick up, which then does not actually remove it because it's not installed. this is not ideal either... perhaps the optimisation should be removed from that script? Gbp-Dch: Short
2020-05-05config: catch and report unexpected argumentsLyndon Brown
after handling arguments, catch and report any remaining "non-option" arguments. for instance users could make the basic mistake of using `lb config --bootloaders syslinux grub-efi`, i.e. failing to quote the multiple bootloaders (i actually encountered a user doing this who swore that "it just worked"). catching and reporting such mistakes could be valuable to users. previous behaviour: ``` $ lb config --bootloaders syslinux grub-efi P: Updating config tree for a debian/buster/amd64 system P: Symlinking hooks... ``` new behaviour: ``` $ lb config --bootloaders syslinux grub-efi [2020-05-05 18:56:07] lb config --bootloaders syslinux grub-efi E: Unexpected argument found: grub-efi ``` Gbp-Dch: Short
2020-05-05debootstrap: fix wrong param for Check_package callLyndon Brown
debootstrap must obviously exist in the host. we thus must pass 'host' not 'chroot' such that a warning about needing to install it on your host system is output, rather than it being added to a list of packages to be installed, which never occurs in this script. Gbp-Dch: Ignore
2020-05-04rename binary_loopback_cfg to binary_grub_cfgLyndon Brown
when loopback support was introduced, it initially duplicated the code for generating a grub2 config, before the duplicated code was removed from the grub-pc script, effectively thus moving grub config generation to the loopback feature script. grub-efi support was added after this. this results in a misleading filename, since the `binary_loopback_cfg` script is essential for use of grub-pc|grub-efi, and actually only has a single line of code on top that's needed for adding actual loopback support on top. (when grub-pc and grub-efi are not used, the entire script is still needed for loopback support to work). so here we rename it to make better sense, and correct/clarify bits of documentation. Gbp-Dch: Short
2020-05-04binary_iso: properly handle multiple bootloadersLyndon Brown
with LB_BOOTLOADER_BIOS and LB_BOOTLOADER_EFI introduced, we can simplify and correct things here. previously it was possible for more than one of each type to be added. Gbp-Dch: Short
2020-05-04config: improve BIOS/EFI bootloader selection handlingLyndon Brown
the design choice from when EFI support was introduced was to change `--bootloader` to `--bootloaders`, with users specifying their selection of BIOS and EFI bootloaders together. at this time there were not even any decent validation checks being performed, and invalid combinations could cause some chaos. since then proper validation was put in place, including checking that only a single instance of each of BIOS and EFI bootloaders exists in the selection. here we tweak things such that we stick with the same option, but we split the selection up such that we store the BIOS and EFI selections separately within the saved config file, and offer it up to scripts to help simplify those scripts. we must however retain support for splitting from the combined option, both because we still use it in the combined option, and for backwards compatibility with older saved configs. Gbp-Dch: Short
2020-05-04fully validate BIOS/EFI bootloader combinationsLyndon Brown
thus far, config bootloader validation only did the basic check that each bootloader specified was a known and supported bootloader, it did not check combinations. it now checks combinations, and strips out the previous "bootloader role" stuff. the no-bootloaders warning is duplicated, covering two slightly different situations (empty string, and whitespace string). this is anticipated to be just temporary, with this just being the first step in better handling bootloader selections. Gbp-Dch: Short
2020-05-04binary_hdd: remove incorrect local scopeLyndon Brown
the "FIXME" function wrapper is just to temporarily disable the code. Gbp-Dch: Ignore
2020-05-04indentation fixLyndon Brown
Gbp-Dch: Ignore
2020-05-04fix redundant and incorrect source selectionsLyndon Brown
"grub" presumably was what is now called "grub-legacy" removed both because there is already a proper piece of code adding bootloader packages. Gbp-Dch: Ignore
2020-05-04fix another overlooked "grub" -> "grub-legacy" instanceLyndon Brown
Gbp-Dch: Ignore
2020-05-04extend config validation to all build componentsLyndon Brown
while `lb build` ran the config validation check, spotting invalid configs and stopping with an error, the major build stages if executed directly did not, nor did the component stages. here we move execution of the validation function into the common init function, with an exported variable used to indicate that validation has been performed. thus validation is performed no matter what part of the build system you execute, but only once. Gbp-Dch: Short
2020-05-04get rid of a couple of useless variablesLyndon Brown
Gbp-Dch: Ignore
2020-05-04clean: tweak initLyndon Brown
`Init_config_data` is more suited to build scripts than here. note that it's not used in `config` either. this deliberately does not pass along arguments to it because `Arguments()` can only handle the basic common options, not the `clean` set. this is somewhat confusing and causes a pointless execution of `getopt`. furthermore the function is expanding slightly further beyond it's original scope, with yet more change coming that's unsuitable for `clean`, so it makes sense to avoid using the function here just for the couple of function calls needed. validation of the config is disabled, as it is not performed currently. it is not clear if it should be enabled or not for `clean`. it may be useful to not validate, if we wish to be able to provide users with an option to be able to delete the config. Gbp-Dch: Ignore
2020-05-03config: fix stale live-build version in iso-preparerLyndon Brown
using `$VERSION` as part of the default `$LB_ISO_PREPARER` means that when you simply run `lb config` once, this variable is stored as a part of the string, and replaced on use, but if you run `lb config` twice, it gets replaced with a fixed version, that is then used in all subsequent builds. let's replace with a placeholder (`@LB_VERSION@`) that can be used both in the default, or in user strings, and will be replaced on use only. this means that subsequent builds will always reflect the actual version of live-build used. Gbp-Dch: Ignore
2020-05-03disk_info: obey new UTC timestamp controlLyndon Brown
2020-05-03source_disk: de-duplicate date constructionLyndon Brown
Gbp-Dch: Ignore
2020-05-03syslinux: obey new UTC timestamp controlLyndon Brown
2020-05-03config: provide UTC timestamp controlLyndon Brown
`DATE_UTC_OPTION` is set in `Prepare_config()` for use by scripts, even though only a few scripts will actually use it, since it allows those scripts to be cleaner. we may want to possibly extend this as a `DATE_OPTIONS` variable perhaps as part of enabling proper reproduciblity. Gbp-Dch: Short
2020-05-03syslinux: support timezone date componentLyndon Brown
since date is not obtained as UTC, timezone is an important detail of understanding the given time, which users may want to make use of. Gbp-Dch: Short
2020-05-03syslinux: fix date construction accuracy issueLyndon Brown
don't construct each part from a fresh "now", which can result in inaccuracies in the overall date due to "now" drifting over the individual date calls. instead feed the full date that was obtained back into it when extracting the component parts. Gbp-Dch: Ignore
2020-05-03config: fix storage of --jffs2-eraseblock valueLyndon Brown
broken since it's introduction in 9ffb223d703a4bbb76e5278e59b3cc183f2f1aca Gbp-Dch: Short
2020-05-03config: small output alignment fixLyndon Brown
Gbp-Dch: Ignore
2020-05-03fix usage/help/man bugsLyndon Brown
- the definition of $PROGRAM as used in $USAGE strings defined in each script has been broken for a long time, being simply "lb" when it needs to be "lb COMMAND". - `config` changed $PROGRAM to "lb config" thus its output was correct in this regard unlike everything else, but with the switch to a more "intelligent" `Man()` function recently, it means that instead of `man lb config`, what was actually run was `man lb config config`, which displayed the manpage, then on exiting with `q`, it showed some sort of index line todo with a "config" search (no exact manpage match?), for which you had to enter `ctrl+c` to get rid of. this revises things to fix the issues, minimising change by changing $PROGRAM to "lb COMMAND", with the frontend overriding this. Gbp-Dch: Ignore
2020-05-03archives: output actual error for bad pass paramLyndon Brown
Gbp-Dch: Ignore
2020-05-03adjust action arg consumption orderLyndon Brown
did not properly consider all usage cases properly in deciding placement. this captured `--usage` in `$PROGRAM --usage` as the action for instance. Gbp-Dch: Ignore
2020-05-02clean: output error on invalid argumentLyndon Brown
2020-05-02options: de-duplicate common option handlingLyndon Brown
2020-05-02config: refactor basic package list constructionLyndon Brown
Gbp-Dch: Ignore
2020-05-02clean: expand debuggingLyndon Brown
Gbp-Dch: Ignore
2020-05-02clean: fix missing 'noauto' param for substage executionLyndon Brown
these should be bypassing the possibility of running the auto script surely, just like how this is done for `--all`, otherwise you pass through the auto file twice. Gbp-Dch: Ignore
2020-05-02clean: improve arg handlingLyndon Brown
- detect lack of options using actual arg count rather than first arg being an empty string. - fix string splitting issues by looping properly on "${@}" - tidier Gbp-Dch: Ignore
2020-05-02improve stagefiles encapsulationLyndon Brown
- added and used Stagefiles_dir() - added and used Stagefile_exists() pretty self explanatory. Gbp-Dch: Short
2020-05-02caching: output error on invalid action paramLyndon Brown
for bootstrap, the check is moved to the case statement for greater robustness, and for consistency with other scripts. Gbp-Dch: Ignore
2020-05-02output error for incorrect action in chroot prep scriptsLyndon Brown
...alongside printing usage (which is perhaps unnecessary), so that it is actually clear to users that a problem occurred, and what. and capture it before option processing of remaining args. Gbp-Dch: Ignore
2020-05-02tidy up Echo_breakage()Lyndon Brown
- it's only used by the debootstrap script after alternatives were dropped long ago, so let's move it, avoiding it being loaded for everything else. - there's no need to pass printing another message through it. - there's little point in making the sid distinction if you happen to decide to build sid, it's a given that it's less stable than stable. really, is there any need for this at all? Gbp-Dch: Ignore
2020-05-02debootstrap: remove useless obtaining debootstrap verbose help stringsLyndon Brown
Gbp-Dch: Ignore
2020-05-02move and rename Common_config_files()Lyndon Brown
for better encapsulation, and for consistency with other config file handling functions in the new location. Gbp-Dch: Ignore
2020-05-01grub2: fix duplicate live entriesLyndon Brown
in tweaking a previous commit to remove some excessive change before submission, i mistakenly identified the part of the sed replacement restored here as being unnecessary to its functionality, but in fact it is. without it the placeholder is not actually removed. the lack of removal of the placeholder meant that you ended up with duplicate copies of the live menu entries. Gbp-Dch: Ignore
2020-05-01bootloaders: change 'Advanced options' to 'Utilities'Lyndon Brown
more fitting now that we've moved the advanced installer entries out to a different submenu, leaving just memtest (and HDT on syslinux). the advanced.cfg file is also renamed to utilities.cfg in the syslinux case, but in a backwards compatible way of moving the user advanced.cfg file over the new one, if the user provides a file with the old name. alternatively we could just leave the old name in place, but that would be a little odd. Gbp-Dch: Short
2020-05-01Replace 'which' with 'command -v' to test for the existance of an executablejohnraff
This is considered to be more robust. Two instances remain: scripts/build/chroot_archives, line 257: if [ "${LB_APT}" = "aptitude" ] && [ ! $(Chroot chroot "which aptitude") ] The command is run inside a chroot where the environment might be special, and would need further testing. manpages/Makefile, line 42: @if [ ! -x "$$(which po4a 2>/dev/null)" ]; \ I am insufficiently familiar with makefile syntax to edit this.
2020-05-01grub2|loopback: avoid perl for live entry creation, use temp fileLyndon Brown
instead of cramming the live entries into a string via a layer of functions for terminating entries with newlines, which we then have to run through perl to tweak the newlines for correct use with sed... let's write the entries to a temp file, then use that file in the sed replacement. the helper functions injecting newlines to the end of entries as they were built into a long string have obviously become unnecessary and so were removed. one function was renamed for reasons of consistency and clarity. the file is initially deleted before use for reasons of wanting to bullet proof the codebase to work properly under conditions of recovering from failure/cancellation, `--force` re-running and such. this removes the last use of perl. Gbp-Dch: Short
2020-04-30config: optimise --ignore-system-defaultsLyndon Brown
Gbp-Dch: Ignore
2020-04-30workaround checkbashisms mistakeLyndon Brown
it reported: "possible bashism in scripts/build/binary_loopback_cfg line 284 (should be '.', not 'source')" which is clearly a misidentification. Gbp-Dch: Ignore
2020-04-30syslinux: fix errors re-running under `--force`Lyndon Brown
robustification is required to not just `--force` but recovery from failure or user cancellation. Gbp-Dch: Short
2020-04-30grub2: fix lost pre-prepared files detailLyndon Brown
partly lost in some adjustments that were made to the submitted work, which was focused on restoring the 'start installer' entry. there is no need for dynamic setting of these two `source` imports in the default file, in fact user modifications should also use the fixed import commands in future. note that the old placeholders however remain replaced, which inject precisely this string, for backwards compatibility. Gbp-Dch: Ignore
2020-04-30bootstrap_cache: fix failure conditionLyndon Brown
during testing i encountered an unexpected error resulting from the following condition: - bootstrap was cached - cache of bootstrap packages was empty (from playing with `lb clean`) - installer was not none|live everything works fine up until the main installer script, which comes to an abrupt halt with an error due to the missing cached bootstrap packages that it wants to copy. this situation is easy to unintentionally create, as i managed to do. here we catch the failure condition, correcting for it. this is done by checking for the missing cached packages when restoring the bootstrap from the cache, and skipping this if the packages were missing, thus forcing the bootstrap to be rebuilt. the packages should then be found within the cache, allowing the installer stage to complete successfully. of course the bootstrap stage will only cache the packages if caching is enabled, but if caching is disabled and installer enabled, the config validation will catch that, reporting that problem. Gbp-Dch: Short
2020-04-29loopback: tidy formattingLyndon Brown
Gbp-Dch: Ignore
2020-04-29selinux: fix output consistencyLyndon Brown
install mode was silent when selinux was not enabled, whilst remove mode always output a "Begin unmounting..." message. this makes both modes silent when selinux is not enabled. this also happens to fix an unintended side effect of d79c96232b40fb082233c97ac8d4f75b821ecefe whereby a warning subsequently was always emitted in remove mode when selinux was not in use, which was not ideal. Gbp-Dch: Short