summaryrefslogtreecommitdiff
path: root/include
AgeCommit message (Collapse)Author
2025-04-26mk: simplify main()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26lib.sh: use realpath to get sys python on venvLeah Rowe
In the previous revision, I make hardcoded use of /usr/local/bin and /usr/bin as search locations, instead of relying on PATH, when the user has a python venv, because in those cases, we cannot rely on PATH so we use a python command to detect the venv and then force use of the normal system path for python. However, there's no guarantee that the real Python will indeed live at these locations. For example, some distros like Nix or Guix will use many locations for different versions of a given package, and it's for the birds as to what given package version the user might be running. Therefore, this patch retains that current hardcoded assumption of /usr/local/bin and /usr/bin but *only* as a fallback solution, instead checking realpath first. The "realpath" command isn't technically POSIX standard, but in practise it is available on GNU coreutils, Busybox, and the various BSD userlands. I could perhaps *import* a realpath utility, and use that, but this should be fine. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-26lib.sh: Force use of System Python to prevent hangLeah Rowe
If the user has a virtual environment, the current logic will cause lbmk to hang. A useful workaround is to force use of the direct path to the system binary of python. This works by detecting a virtual environment first, and deferring to the old behaviour if no venv is found. If one is found, then it will not rely on PATH, but instead only search the standard locations /usr/local/bin and /usr/bin. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-23lib.sh: further condense the python checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-23lib.sh: further simplify the python checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-23lib.sh: condense the python checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-23lib.sh: simplify mk()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-23lib.sh: simplify cbfs()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-23lib.sh: simplify the python checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-22lib.sh: add missing copyright yearLeah Rowe
alper made a fix to this file a few hours ago, but forgot to update the copyright header i'm doing it for alper, as a courtesy Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-21lib.sh: Fix python3 detection when 'python' is python2Alper Nebi Yasak
Properly set $pyver to "3" when we detect we can use python3. In the following version checks, use the $python we detected instead of a 'python' from PATH because the latter might be a python2 while still co-existing with a python3. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2025-04-18Revert "git.sh: minor cleanup"Leah Rowe
This reverts commit e63d8dd20d99ec18ef03699516fd800a81b7f1df.
2025-04-18lib.sh: perform root check even earlierLeah Rowe
initialising variables, setting PWD, setting version, this is all unnecessary before the root check, because the dependencies commands use none of these. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18lib.sh: tidy up opening logic (put it together)Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18lib.sh: do root check before python checkLeah Rowe
we don't need python before the root check principle of least privilege Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18git.sh: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18lib.sh: simplify mktarball()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18vendor.sh: tidy up vendor_download()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-18lib.sh: fix missing s/TMPDIR/xbmktmpLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17lbmk: don't handle TMPDIR directlyLeah Rowe
lbmk creates TMPDIR as /tmp/xbmk_*, but it's theoretically possible that something could re-export it by mistake. this change retains the same initialisation, but further use is now via a new variable "xbmktmp", that stores the value of TMPDIR upon lbmk's initialisation of it. this reduces the chance of such a bug in the future, as described above, so it is a preemptive/preventative fix. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17rom.sh: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: yet even more code cleanupLeah Rowe
code equals bugs. code that doesn't exist can't have bugs, so it is superior by definition. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: even more cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: more cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: simplify process_release_romsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17vendor.sh: remove unnecessary checkLeah Rowe
the next part checks whether the file is below 512k, so there's no point checking if it's below 2, because the lowest a file size can be is zero, and expr will produce a result of -1 if decrementing from zero. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove unnecessary commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove link_crossgcc()Leah Rowe
merge it with git_prep Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove move_repo()Leah Rowe
merge it with git_prep, since it's only a small function and only called from there. the merged code still makes sense and its purpose is still quite clear on casual reading. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: remove prep_submodule()Leah Rowe
merge it with git_prep, since it's only a tiny function and only called from there. the for loop moved to the if block still makes sense on casual reading. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17git.sh: make git_prep command clearerLeah Rowe
the "u" argument can actually be any thing. git_prep handles git submodules only for single-tree projects, under any candition, or on multi-tree projects if the number of arguments to git_prep is above four. "u" is the 5th argument, meant to enable submodule downloads. it really doesn't matter what this string says, so let's just make it as clear as possible. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17mrc.sh: Make proper use of variable inside printfLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17simplify a few file checksLeah Rowe
the combination of x_ with the "e" function enables for much simpler file-check error handling, which is a unique innovation of lbmk as it pertains to sh. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17rom.sh: remove unnecessary checkLeah Rowe
the cbfs function will call cbfstool, which will perform the same check, and the same error condition would cause the same exit behaviour in lbmk. the error message would also provide output that is just as useful for debugging. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-17lbmk: minor cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-16lib.sh mktarball: stricter tar error handlingLeah Rowe
There was no error handling, *at all*, on the actual tar command, due to the lack of set -o pipefail, which we cannot rely on in sh. The x_ wrapper can be used in this case, as a mitigation. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: don't err on bruteforce me extractLeah Rowe
it wouldn't exit with error status anyway, since i'm setting +e here, but if that accidentally changed in the future, i still wouldn't want this to exit. the bruteforce me extraction naturally throws a lot of errors, hence +e, because of how the extraction works, but the result is checked at the end of the process, to compensate. hence +e, because otherwise this brute force extraction would never work. therefore, this is an extremely theoretical bug fix, the most quintessential of preemptive bug fixes, to the point that it is actually rather pedantic. The ":" in "|| :" will likely *never* be executed, but it handles the theoretical case where the subshell exits with non-zero status and +e is set; subshells aren't meant to behave this way anyway, but who knows what cursed sh implementation the user is on? Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: remove unnecessary xchanged="y"Leah Rowe
in these if clauses, what follows afterward is exactly the same: set xchanged and return. Therefore, these lines are redundant and they can be removed. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: set need_files="n" if skipping patchLeah Rowe
This change finally ensures that no insertions will be attempted, on the basis that readkconfig failed; this covers the instance whereby vcfg was set, but no scanned items were indicated e.g. Intel ME files not specified. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13vendor.sh: Don't handle vendor files if not neededLeah Rowe
This should speed up automated tests. Otherwise, it goes through all the extra checks that aren't needed, for each individual type of vendor file, and also errors out when handling pico serprog images; during automated testing, on the bin directory, you might try on every tarball, one of which is the pico tarball and this patch makes lbmk skip that one too. In general, we must not perform unnecessary tasks. Doing so may even cause other bugs that we couldn't easily detect. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13Revert "lib.sh: use eval for the command in x_"Leah Rowe
This reverts commit 3bfdecdc75bbc77f795736ac282f858f2eb7ab94. The commit that this reverses, caused sch5545 ec firmware downloads to fail, due to globbing.
2025-04-13lib.sh: fix bad eval writing resized fileLeah Rowe
x_ cannot be used, where output is redirectod to a file; only the conventional piping can be used. same as the last change. this and the other fix were caught during testing. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13lib.sh: fix bad eval writing version/versiondateLeah Rowe
x_ cannot be used, where output is redirected to a file; only the convention piping can be used, for errors. relying on x_ in these cases will cause unpredictable bugs. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-13lib.sh: use eval for the command in x_Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12lib.sh: tidy up the error handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12rom.sh: tidy up error handlingLeah Rowe
same as the last change Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12vendor.sh: tidy up error handlingLeah Rowe
x_ can be used nowadays on any function, because it properly handles globbing. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12vendor.sh: tidy up decat_fspfd()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-12git.sh: clean up fetch_project()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>