summaryrefslogtreecommitdiff
path: root/include/init.sh
AgeCommit message (Collapse)Author
2025-05-26xbmk: rename xbmklocal/xbmktmp variablesLeah Rowe
shorten them Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25init.sh: error out if .git/ is a symlinkLeah Rowe
the current behaviour is a relic from the older lbmk design, before recent auditing. the current logic would cause xbmk to continue execution, going into a child process with .git/ being a symlink. The .git/ directory should never be a symlink, because it is extremely error-prone. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-20Revert "vendor.sh: optimise find_me()"Leah Rowe
This reverts commit fb7aaa78bb080a473bdf0edf449bf08045e8366c. it caused a few issues. will re-do later the old code isn't really broken, just inefficient, because several files are scanned twice, but in practise the overhead isn't that great The error occurs sometimes, when bruteforcing me.bin: ERROR ./mk: Unhandled error for: mv /home/user/lbmk/tmp/me.bin /home/user/lbmk/cache/tmpdl/check This revert should fix the issue, for now.
2025-05-20vendor.sh: optimise find_me()Leah Rowe
i'm adding characters to 7ztest, which isn't being passed on through because everything runs in subshells; the next pass would default back to the original string, so a given file may be checked multiple times. fix this by mitigation; use the random string from mktemp as a suffix instead. in practice, this has not affected performance much, but it will nevertheless avoid unnecessary work by xbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19init.sh: looser XBMK_THREADS validationLeah Rowe
on child processes, we can simply correct it. we currently provide an error message, but this is silly. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19init.sh: Hardcode XBMK_CACHE for integrityLeah Rowe
I never really intended for this to be configurable, but the cache directory is also used during release builds. There's too much that can go wrong, letting the user decide where their cache is. Simplify it by hardcoding. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: merge xbmk_lock() with xbmk_set_env()Leah Rowe
it's just two lines, and we want much more granular control of where the lock is enforced. it should be JUST after confirming that the instance is a parent. it is at this moment that we should bail if a lock file exists, because this signals that another instance of xbmk is running. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: move xbmk_set_versionLeah Rowe
it's called before set_pyver, so move it above that Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: set pyver from set_envLeah Rowe
it's related to this function, no point calling from main Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: merge xbmk_mkdirs with set_envLeah Rowe
it's just two lines, and they relate. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: check version/versiondate once readLeah Rowe
once again, we are being stricter in child instances. we must ensure that these variables are set by xbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: error if version not readLeah Rowe
we no longer rely on the .git version being read by child instances, so we MUST ensure that it is being read. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: only update version files on parentLeah Rowe
don't update them on child instances, since it's a waste of time; the lock file prevents further execution, so we are just wasting time writing to disk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: simplify unknown version creationLeah Rowe
we don't need to read or write a file at all, in that case. we only then need to generate one if running ./mk release. the scenario in which no .git and no version files exist is when someone grabs the build system from a snapshot generated by e.g. forgejo instances. it's ill advised, so we advise against it, but it is mitigated in code. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: only set xbmk version on parent instanceLeah Rowe
On child instances, we need only read. Apply the principle of least privilege. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: initialise variables AFTER pathLeah Rowe
That way, unnecessary work is avoided on child instances. Of course, the current check assumes that TMPDIR wasn't already set by a wily user before running lbmk, but then those sorts of users probably know what they're doing. If they don't know, they will soon find out. Therefore, I have added additional checks on child instances, preventing the build system from running if XBMK_CACHE is not set; if it isn't, then that could very easy lead to certain system files being overwritten. The user must never know what happens if XBMK_CACHE is unset. We simply will not allow it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: merge create_pathdirs with set_pyverLeah Rowe
all this function does now is create the python symlink, based on work that was already performed in set_pyver Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: Set python version only on parentLeah Rowe
Do it after the creation of xbmkpath. This avoids performing an unnecessary check, since PATH will have already been corrected for child instances; Python will already be correct there. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: remove useless commandLeah Rowe
we mkdir -p xbmklocal, only to remkdir it immediately afterward, which is the intended behaviour; on parent instances, xbmklocal is to be re-created fresh. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: remove useless commentLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: xbmk_create_tmpdir to xbmk_mkdirsLeah Rowe
this function now simply creates directories that lbmk will use, rather than creating specific directories. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: move gnupath creation to create_tmpdirLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: move PATH init to set_envLeah Rowe
we must only set this in the parent instance, not child instances. this prevents the variable from being over-populated with repeated entries. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: check the lock file BEFORE git initLeah Rowe
this way, initialisation will not be performed erroneously while another parent instance of lbmk is running. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18init.sh: return from child in set_env insteadLeah Rowe
This is earlier than the current check, thus preventing the initialisation of a git repository and/or the recreation of xbmktmp and xbmklocal by erroneous parent executions of lbmk while another parent is running - the latter of which could have caused a massively unpredictable build failure, so this is also a pre-emptive bug fix, fixing all kinds of weird bugs. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10inject.sh: split to vendor.sh the download partsLeah Rowe
to the extent feasible, keep lbmk-specific parts on inject.sh to a minimum. this will later be used to re-sync cbmk's inject.sh with lbmk's, because cbmk's one doesn't handle vendor files. the way this is designed now, with this patch, will make cherry-picking lbmk to cbmk easier in the future, when keeping this part of cbmk in sync with lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-09lbmk: use x_ instead of err, where appropriateLeah Rowe
many places in lbmk used err, because older versions of x_ did not handle globbing properly. however, use of x_ is preferable on trivial commands. the only time err() should be called is what it has to be, when x_ can't work, or when a more useful error message is needed, for context. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-08init.sh: Only check XBMK_CACHE if it existsLeah Rowe
Otherwise, if it doesn't exist, the current check will wrongly exit with error status, preventing you from running the build system at all! Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07init.sh: remove useless exportLeah Rowe
we already reset to n if not y, afterward just rely on that Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07init.sh: also allow XBMK_RELEASE=Y or NLeah Rowe
as opposed to =n or =y Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07init.sh: Resolve XBMK_CACHE via readlinkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07init.sh: check XBMK_CACHE is a directory insteadLeah Rowe
it doesn't matter if it's not a file. that's the wrong check. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07init.sh: export LOCALVERSION in set_envLeah Rowe
Don't do it in set_version Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07init.sh: run set_version before set_envLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-07init.sh: Use readlink in pybin()Leah Rowe
Use realpath only as a fallback. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-05lbmk: Replace err with much simpler implementationLeah Rowe
The current implementation is insanely over-engineered, and completely unnecessary. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: Silence the output of git config --globalLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: Run git name/email check before initLeah Rowe
Otherwise, it returns if init is already done, which later leads to build errors in coreboot. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: single-quote xbmklock in xbmk_lock()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: define lock file in a variable insteadLeah Rowe
don't hardcode it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: tidy up xbmk_child_exec()Leah Rowe
make the command style more consistent, for example relying on x_ inside a subshell to print the command and arguments if a command failed. this is a good style, and i'll probably use it in other places on lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04lbmk: MUCH safer err functionLeah Rowe
Don't directly call a variable. Call a function that checks the variable instead. The new err function also checks whether an exit was actually done, and exits 1 if not. If an exit was done by the given function, but the exit was zero, this is also corrected to perform an exit 1. This fixes a longstanding design flaw of lbmk. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: tidy up the python version checkLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: move non-init functions to lib.shLeah Rowe
these were missed in a previous cleanup Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: simplify dependencies handlingLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-04init.sh: tidy up pathdir creationLeah Rowe
we can use remkdir here. it does the same thing. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03init.sh: *Re-create* tmpdirs on parent instanceLeah Rowe
To make sure any old files are removed, always re-create. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03init.sh: Always create xbmklocalLeah Rowe
If we're in a release work directory, TMPDIR is already set, so the local ./tmp won't be created, which would lead to an error. Fix it by creating xbmklocal before checking TMPDIR. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03lbmk: Unified local ./tmp handlingLeah Rowe
Make it an absolute directory, relative to xbmktmp. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-03init.sh: Explicitly create the xbmktmp directoryLeah Rowe
mktemp would normally do it, but we must not rely on that Signed-off-by: Leah Rowe <leah@libreboot.org>