summaryrefslogtreecommitdiff
path: root/script
AgeCommit message (Collapse)Author
2023-10-02update/project/trees: optimise error handlingLeah Rowe
some x_ calls are made that aren't needed. this is now corrected. additionally, some x_ calls were being made that are quite error-prone, like ones that use $PWD. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02update/project/trees: simplified error handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02update/project/trees: general code cleanupLeah Rowe
reduced sloccount, without reducing functionality Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02update/project/trees: rm yet another rm lineLeah Rowe
good lord, redundancy is indeed redundant. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02update/project/trees: remove one more rm lineLeah Rowe
the one at the end of main is unnecessary, because it's handled inside the for loop. this file isn't used anywhere else, so it's OK. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02update/project/trees: remove redundant rm commandLeah Rowe
as it turns out, i delete "seen" inside the for loop, which is a more thorough way to do it. thus, the first rm command is unnecessary. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02update/project/trees: remove unnecessary linebreakLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02update/project/trees: rm "seen" in the right placeLeah Rowe
it must be done *after* setting cfgsdir Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02build/grub/payload: remove unnecessary linebreaksLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02build/coreboot/utils: remove unnecessary checkLeah Rowe
the file check is sufficient (target.cfg) Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02build/coreboot/utils: simplify argument handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02build/boot/*: unify more logic in main()Leah Rowe
slight sloccount reduction. light renaming of functions between the two scripts, placing more logic in main() under include/boot.sh Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02do not handle errors on mktemp in shell scriptsLeah Rowe
errors are not defined for mktemp, and the /tmp file system should be assumed reliable. if /tmp is *unreliable*, then this is not something that lbmk either can or should fix; the user clearly has bigger problems. manpages for mktemp do not define errors. it is assumed to be completely reliable. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01Greatly simplify error handling in shell scriptsLeah Rowe
Instead of having detailed error messages, run most commands through a function that calls err() under fault conditions. Where detail is still required, err() is still called manually. Where it isn't, the error message is simply whatever command was executed to cause the error. This results in a massive sloccount reduction for lbmk; specifically, 178 sloc reduction, or a 8.1% reduction. The total sloccount is now 2022, for shell scripts. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01build/boot/roms: optimise main() for code sizeLeah Rowe
handle everything in the getopts loop Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01build/boot/roms_helper: shorten variable namesLeah Rowe
also: further reduce the number of arguments passed, to certain functions as and when feasible, in cases where those are global variables that never change. the cbfstool argument in mkUbootRom wasn't even used. that function was only using the global variable, which again is only set once. i also shortened a few messages, removed a few errant line breaks and reduced sloccount by exactly 1 in main() by re-arranging how the shift command is used. it's mainly about shortening variable names, to then reduce the number of line breaks, but it's a surgical code size reduction in build/boot/roms. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-01build/boot/roms: dont do init/displaymode argumentLeah Rowe
These are only ever initialised globally, and set once. Other instances where they are set are only in cases where they are passed as argument, at the start of a function, so they are being *needlessly* re-set. Set them only once and use them globally. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms_helper: simplify rom file handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms_helper: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30general code formatting cleanup in shell scriptsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30simplify initialising variables in shell scriptsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: only do 1 custom kbd/payload/modeLeah Rowe
-k, -p and -d let you set keymap, payload and displaymode respectively, but the handling for this is buggy when passing multiple arguments. Support only one argument, for simplicity. This is how people use them anyway, and it makes lbmk less buggy. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: move usage() to include/boot.shLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/*: unified main() functionLeah Rowe
The *same* main() function is now used on both scripts. However, merging both scripts together would be less efficient on sloccount, and would be error-prone. The purpose of having roms_helper is that the variables get re-initialised the same way each time, for each board, automatically. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: split up handle_targets()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: check all targets before buildingLeah Rowe
If one of them doesn't exist, error out. Previously, a build would start but then it would error out later on. This implements the mentality: fail early, fail hard Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: merge handle_targets/build_targetLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: only run confirm_targets onceLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: rename buildrom to build_targetLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: split up main()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: simplify buildrom() handlingLeah Rowe
Only one for loop is required. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: support "all" if argument passedLeah Rowe
e.g. -k ukqwerty previously, this would not work: ./build boot roms -k ukqwerty all only this would work: ./build boot roms all this patch fixes the bug. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30build/boot/roms: move help() to bottom of fileLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-30update/*/*: unified scanning of revisions/sourcesLeah Rowe
update/blobs/download and update/project/repo both use the same logic, for setting variables with awk and a specially formatted configuration file. unify this logic under include/option.sh, and use that. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29blobs/download: move helpers to include/blobutilLeah Rowe
mkdirs() should be in include/blobutil.sh, as should extract_archive(), because that is primarily where they are used. script/update/blobs/download calls these functions aswell, but it sources include/blobutil.sh so it's OK. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29include/blobutil: try curl first, then wgetLeah Rowe
Don't use only wget. Some systems may only have curl. The user can always install wget anyway, but why not support both? I've added the right user agent string. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29include/blobutil: simplify check_defconfig()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29blobs/download: do IntelME extract in one functionLeah Rowe
Just one function. Just one. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29blobs/download: do final check of _dest in fetch()Leah Rowe
This way, the file is checked regardless of what type of blob is handled, not just Intel ME. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29blobs/download: don't pass dl_path as argumentLeah Rowe
Because fetch() is only called now from blobs/download, we can reliably know what dl_path should be. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29blob scripts: unified handling of blob destinationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29remove unused variables in blob scriptsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29merge include/fetch.sh, blobutil.sh, defconfig.shLeah Rowe
They are only ever used by script/update/blobs/*, so put them all in blobutil.sh. This cuts down on the number of scripts in lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29update/blobs/*: simplify mrc.bin handlingLeah Rowe
mrc.bin is now handled by include/mrc.sh, adapted from now-deleted script/update/blobs/mrc much of the logic has been re-written or adapted for inside script/update/blobs/download mrc links/hashes now defined in config/blobs/sources the new code is simpler (and smaller). in addition, lbmk can now easily handle mrc.bin files for other platforms such as broadwell. watch this space. the full .zip download is now cached, like with other vendor downloads. this means it won't be re-downloaded if it was already downloaded before. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-29update/blobs/*: unified download/checksum logicLeah Rowe
Use the same logic between blobs/download and blobs/mrc. The logic is taken from blobs/download. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28blobs/download: remove unnecessary linebreaksLeah Rowe
generally condense the code, but not in a way that makes the code unreadable. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28blobs/download: remove unnecessary messagesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28blobs/download: simplify downloading of filesLeah Rowe
individual functions for downloading each archive have been removed. instead, eval is used in fetch_update(), which is now renamed to fetch(). Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28blobs/download: remove unnecessary error pipesLeah Rowe
the called functions directly call err() under fault condition, so this additional handling is redundant. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-28blobs/download: unified archive extractionLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>