summaryrefslogtreecommitdiff
path: root/include/err.sh
AgeCommit message (Collapse)Author
2024-04-24haswell: only provide NRI-based ROMs in releasesLeah Rowe
release="n" is set in target.cfg on haswell build targets that use mrc.bin script/update/release exports LBMK_RELEASE="y" script/build/roms skips building a given target if release="n" in target.cfg *and* LBMK_RELEASE="y" you could also do the export yourself before running ./build roms, for example: export LBMK_RELEASE="y" ./build roms all This would skip these ROM images. The native haswell raminit is now stable enough in my testing, that I wish to delete the MRC-based targets. This is in line with Libreboot's Binary Blob Reduction Policy, which states: if a blob can be avoided, it should be avoided. The problem is that users often run the inject script in *lbmk* from Git, instead of from the src release archive. I forsee some users running this on modern lbmk with older release images. If the mrc-based target isn't there, the user may use an NRI-based target name, and think it works; they will insert without MRC. I foresaw this ages ago, which is why Caleb and I ensured that the script checks hashes, and hashes are included in releases. Therefore: for the time being, keep the MRC-based configs in lbmk but do not include images for them in releases. This can be done indefinitely, but I'll probably remove those configs entirely at some point. On the following boards, Libreboot now will *only* provide NRI-based ROM images for the following machines: * Dell OptiPlex 9020 SFF * Dell OptiPlex 9020 MT * Lenovo ThinkPad T440p * Lenovo ThinkPad W541/W540 I now recommend exclusive use of NRI-based images, on Haswell hardware. It's stable enough in my testing, and now supports S3. Signed-off-by: Leah Rowe <leah@libreboot.org>
2024-03-27safer, simpler error handling in lbmkLeah Rowe
in shell scripts, a function named the same as a program included in the $PATH will override that program. for example, you could make a function called ls() and this would override the standand "ls". in lbmk, a part of it was first trying to run the "fail" command, deferring to "err", because some scripts call fail() which does some minor cleanup before calling err. in most cases, fail() is not defined, and it's possible that the user could have a program called "fail" in their $PATH, the behaviour of which we could not determine, and it could have disastrous effects. lbmk error handling has been re-engineered in such a way that the err function is defined in a variable, which defaults to err_ which calls err_, so defined under include/err.sh. in functions that require cleanup prior to error handling, a fail() function is still defined, and err is overridden, thus: err="fail" this change has made xx_() obsolete, so now only x_ is used. the x_ function is a wrapper that can be used to run a command and exit with non-zero status (from lbmk) if the command fails. the xx_ command did the same thing, but called fail() which would have called err(); now everything is $err example: rm -f "$filename" || err "could not delete file" this would now be: rm -f "$filename" || $err "could not delete file" overriding of err= must be done *after* including err.sh. for example: err="fail" . "include/err.sh" ^ this is wrong. instead, one must do: . "include/err.sh" err="fail" this is because err is set as a global variable under err.sh the new error handling is much cleaner, and safer. it also reduces the chance of mistakes such as: calling err when you meant to call fail. this is because the standard way is now to call $err, so you set err="fail" at the top of the script and all is well. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-27lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24lbmk scripts: shorter code linesLeah Rowe
while seemingly pedantic, this does actually make code easier to read. mostly just switching to shorthand for variable names, where no expansions or patterns are used Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-24lbmk scripts: general code cleanupLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23lbmk scripts: general code cleanup/optimisationLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-23set version/projectname properlyLeah Rowe
lbmk used to set version/versiondate directly in err.sh, but now it's handled there by a function, which is called by the main script. script/update/release hadn't yet been adapted. the only change necessary is to call check_project() script/update/trees also makes use of it script/build/roms is using "projectname" Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-12-16fix several shellcheck warningsLeah Rowe
lbmk didn't quote certain arguments in commands, or used ! -z instead of -n, things like that. simple fixes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-11-08build: don't generate version/versiondate as rootLeah Rowe
don't run it directly at the bottom of err.sh, because otherwise the version and versiondate files will be generated when running "./build dependencies distroname" which would then create these files, but as root because the user runs that specific command as root. the rest of lbmk, for any other command, prevents use of the root account, so running check_project during "./build dependencies distroname" will cause the build system to fail (because as non-root user, the user will run lbmk and it will try to update those files, and fail because it can't, due to lack of permissions) this patch fixes the issue, by only generating those files if the user is *not* root Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20move git_init to the main build scriptLeah Rowe
also, don't use x_ because it totally b0rks on these commands. handle exit status directly. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-20always re-generate .git in lbmkLeah Rowe
in release archives, .git is excluded but the version and versiondate files are included. from these, the git history is re-created with the exact date (but not taking into account timezone, at present). in this way, lbmk will have git history in a release archive. some build systems, like coreboot, prefer that there be git history available, so this is a nice workaround on those build systems. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-14x/xx: slightly more verbose error messagesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-09include/err.sh: don't run check_gitLeah Rowe
it's already executed in "build" running it in err.sh makes the user have to set git name/email as root, when running dependencies scripts. this is a regression, that this patch fixes. git isn't needed to install dependencies. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-07unified projectname/version/versiondate handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04check git/version: properly call err()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04check_git: call fail() first (fallback to err)Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04more verbosely print git config errorLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-04include/err.sh: checkgit,checkversionLeah Rowe
call these as functions, instead of executing scripts Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02include/err x_(): more verbose error messageLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-10-02include/err: remove unused variableLeah Rowe
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-09-30simplify initialising variables in shell scriptsLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25Update email address for Leah Rowe copyrightsLeah Rowe
also, some of them were out of date; years now updated. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-09-25Use SPDX license headers on all scriptsLeah Rowe
This results in much cleaner copyright and license declarations. SPDX headers are legally recognised and make auditing easier. Also, remove descriptions of each script, from each script. Libreboot documentation at docs/maintain/ describes them. Signed-off-by: Leah Rowe <leah@libreboot.org>
2023-08-23unify err functions across scriptsLeah Rowe
include/err.sh this new handling also does mundane things, such as tell you what script b0rked Signed-off-by: Leah Rowe <leah@libreboot.org>