summaryrefslogtreecommitdiff
path: root/include/get.sh
AgeCommit message (Collapse)Author
3 daysget.sh: reduce the number of eval statementsLeah Rowe
also split up try_fetch() Signed-off-by: Leah Rowe <leah@libreboot.org>
3 daysget.sh: allow force-pull via -F instead of -fLeah Rowe
use of ./mk -F behaves the same as -f before the previous commit. this can be useful, during development when we want to update revisions. Signed-off-by: Leah Rowe <leah@libreboot.org>
3 daysget.sh: only pull if the local revision is missingLeah Rowe
we pull from upstream in cached git repos, before performing an operation, and we run from the cache, but we do this every time, even if a local revision exists, defeating the purpose of the caching; on unreliable/intermittent internet connections, this can cause a problem. this also causes us problems with gnulib.git and grub.cfg, which for *some reason* are really slow, even when doing a pull. this change improves the efficiency of the build system, during release builds, on a development repository where we already have lots of caches. Signed-off-by: Leah Rowe <leah@libreboot.org>
9 daysget.sh: remove unnecessary check in try_copyLeah Rowe
the check for whether a file is present is unnecessary, because the following cp command would also print the file name if it doesn't exist, and exit with the same non-zero status. let cp do the work. Signed-off-by: Leah Rowe <leah@libreboot.org>
9 daysget.sh: rename try_file to try_fetchLeah Rowe
the previous function name was misleading, because this tries multiple methods including git and curl. therefore, this was renamed to match what it dose. Signed-off-by: Leah Rowe <leah@libreboot.org>
9 daysxbmk: tidy up some if statementsLeah Rowe
this is an extension of the previous work to unroll most of the condensed code lines. Signed-off-by: Leah Rowe <leah@libreboot.org>
10 daysmake notices a bit more readableLeah Rowe
add line breaks, so that the license and author are visually separated. this makes it easier to read. Signed-off-by: Leah Rowe <leah@libreboot.org>
11 daysget.sh: unroll condensed code linesLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-18Revert "xbmk: don't use backticks for command substitution"Leah Rowe
This reverts commit 4999a49de39667b3239fc2010d0e99c958b29417.
2025-09-13xbmk: much more verbose error messagesLeah Rowe
use the new functionality in err(), whereby a given function name and arguments can be provided, for debugging purposes. something similar was already done in a few places, and replaced with this unified functionality. this patch will make xbmk much easier to debug, under fault conditions. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-11xbmk: don't use backticks for command substitutionLeah Rowe
the newer way handles escaped characters better, and it can be nested more easily. it's also more readable. personally, i prefer the old way, because it's more minimalist, but it occurs to me that a lot of people nowadays don't know about backticks, but they do know of the modern way. to make the code more readable, i have modernised it. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-05get.sh: put tmpgit in xbtmpLeah Rowe
similar to the previous failed patch, which tried to also generate it each time, but that led to issues. this version of the same change merely maintains the current hardcoding logic, while putting it in xbtmp. that way, it's more robustly cleared upon exit from the parent instance of xbmk. this also reduces the chance of race conditions, since it's in a unique place each time, rather than going in XBMK_CACHE. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-04Revert "get.sh: put tmpclone dirs in xbtmp"Leah Rowe
This reverts commit 01a779d4ebcdfc7df406263aeb1dffb800eb0220. This commit broke ./mk -d coreboot for vendor files in lbmk.
2025-09-02get.sh: put tmpclone dirs in xbtmpLeah Rowe
and generate them, don't hardcode them - this reduces the chance of race conditions, which we have seen in the past and which current execution flow in xbmk even mitigates in a few places, by doing things in a certain order. this change makes the code more robust and easier to maintain. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-02xbmk: remove xbloc, re-use xbtmp insteadLeah Rowe
we no longer separate them. xbloc was the on-disk tmp directory, whereas xbtmp used to be in /tmp which we assumed to be tmpfs (it may not be, but often is on many workstation setups - and our documentation recommended doing this). as mentioned in the previous commit, benchmarking shows little speed difference using tmpfs /tmp versus on-disk /tmp, for our purposes at least. therefore, the handling of tmp files is being greatly simplified. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-02get.sh: remove unnecessary variable, repofailLeah Rowe
it is entirely unused Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-09-02get.sh xbget: don't use eval for file/dir checksLeah Rowe
the actual code works fine, but it's quite hacky. there are times when use of eval is acceptable; this is not one of those times, but i'd used it in this instance when i was being a bit crazy about code size reductions during my audits. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26get.sh: simplify fetch_project()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26get.sh: simplify try_copy()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26get.sh: tidy up bad_checksum()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26get.sh: simplify fetch_targets()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26general cleanup in get.sh and vendor.shLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26xbmk: rename xbmklocal/xbmktmp variablesLeah Rowe
shorten them Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26get.sh: consolidate printf statementsLeah Rowe
stick it in git_prep, which both single- and multi-tree projects will use, when downloading git repositories. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26get.sh: remove redundant printf in fetch_projectLeah Rowe
The following execution will result in another printf that says exactly what is being downloaded. There is no need to inform the user twice about what is being downloaded. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-26get.sh: remove superfluous command in try_git()Leah Rowe
A git-pull is performed immediately after git-fetch. Git-pull already performs git-fetch as a prerequisite. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-25get.sh: Properly error out if tmpclone failsLeah Rowe
We rely on a non-zero exit on other try_ commands, which works fine there because we then check the file afterward and error out accordingly. For git repositories, we assume that both mirrors are identical and therefore once we get to the first clone attempt, we assume that it must succeed. Therefore, if it does not succeed, we must fail. This fixes a regression I found in testing, where sometimes a failed patching attempt would not result in an error exit, and would therefore result in broken sources being present. In practise, I always very closely watch the terminal when testing xbmk, especially when updating project patches, so we probably didn't introduce any broken sources in practice. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-22get.sh: Always update git remotesLeah Rowe
Right now, if cache/clone/PROJECT/ already exists, the logic for pulling new changes doesn't execute, and neither does the logic for updating remotes. This is bad when updating revisions, because then manual updating is required, defeating the purpose of xbmk's own automation in this regard. Fix it by only checking the cached download on files, not Git repositories; the try_git function itself will already perform this check, before updating remotes and pulling in new commits from upstream. The updating only happens when a given target directory doesn't exist, e.g. src/flashprog/ or src/grub/default/, so this won't slow down release builds for example. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-22get.sh: re-generate remotes every timeLeah Rowe
that way, when a remote changes in config/, it will be updated automatically, without user intervention. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19get.sh: add missing check in fetch_project()Leah Rowe
we check the main url, but not backup urls. this patch fixes that oversight. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19get.sh: stricter URL check in xbmkget()Leah Rowe
don't skip if the URL is empty. throw an error instead. i decree that all links must be properly initialised, because that is the design of lbmk. where only one link is provided, such as in a local copy operation, the second would succeed no better than the first so two identical paths are given. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19get.sh: make xbmkget() easier to understandLeah Rowe
the intent once again is that this for loop shall return, with zero status, if success is observed. otherwise, the loop breaks and an error is thrown. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-19get.sh: Make xbmkget err on exiting the loop checkLeah Rowe
The idea in this function is that if a file or repo is successfully handled, a return will be performed from the loop. If the loop exits for any reason, an error is thrown. The current code is probably fine, but I can forsee future modifications possibly causing bugs here. Make it unambiguous, by always throwing an error if execution reaches the end of the function. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17get.sh: remove useless messageLeah Rowe
the user doesn't care where the temporary git repo is git shows that information anyway, in the git clone command Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17get.sh: simplify bad_checksum()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17get.sh: move nuke() to release.shLeah Rowe
we really only need it there, because the context is for release archives. normal use of the git repository doesn't matter in the context of deletions, because that will not be distributed. only the result of ./mk release will be distributed. the builds produced will not change as a result of this, for people using the normal git repository, because the files in question are never used anyway, in our configs. this is being done to make working on local repos easier. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17get.sh: FURTHER simplify nuke()Leah Rowe
this is getting almost comical now Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17get.sh: simplify tmpclone()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17get.sh: fix bad mkdir commandLeah Rowe
this is the mkdir call that createsn the directory where a cached git repository is moved to, during creation. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-16vendor.sh: Properly verify SHA512SUM on extractionLeah Rowe
I currently check the downloaded files e.g. .exe file, but then I don't check - or even define - sha512sums for the files extracted from them e.g. me.bin This patch fixes that. It also caches the hashed files, so that extraction is faster on a re-run - this makes release builds go faster, when running ./mk release If a checksum is not defined, i.e. blank, then a warning is given, telling you to check a specific directory. This way, when adding new vendor files, you can add it first without specifying the checksum, e.g. me.bin checksum. Then you can manually inspect the files that were extracted, and define it, then test again. In a given pkg.cfg for config/vendor, the following variables are now available for use: FSPM_bin_hash for fsp m module FSPS_bin_hash for fsp s module EC_FW1_hash for KBC1126 EC firmware (1st file) EC_FW2_hash for KBC1126 EC firmware (2nd file) ME_bin_hash for me.bin MRC_bin_hash for mrc.bin (broadwell boards) REF_bin_hash for refcode (broadwell boards) SCH5545EC_bin_hash for sch5545 firmware (Dell Precision T1650) TBFW_bin_hash for Lenovo ThunderBolt firmware (e.g. T480/T480s) E6400_VGA_bin_hash for Dell E6400 Nvidia VGA ROM In practise, most people use release archives, and the inject script, so I knew those were reliable, because the ROM images were hashed prior to removing files. This patch benefits people using lbmk.git directly, without using release files, because now they know they have a valid file e.g. me.bin Previously, only the download was checked, not the extracted files, which meant that the only thing preventing a brick was the code not being buggy. Any number of bugs could pop up in the future, so this new level of integrity will protect against such a scenario, and provide early warning prompting bug fixes. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-15get.sh: add missing eval to dx_ in nuke()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-15get.sh: simplify nuke()Leah Rowe
more specifically, re-write it so that it can be called with fx_ this means that the single-tree check for nuke.list can be made much simpler Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh: fix broken printf statementLeah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh: use subshells on try_ functionsLeah Rowe
This way, we can use x_ which will then print the command that failed, if we need to debug future errors. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh: simplify try_copy()Leah Rowe
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh submodules: Don't delete files recursivelyLeah Rowe
I overlooked this in a previous patch. It doesn't really matter, since we're operating on a file anyway, but it's not correct. Files should have rm -f on them, not rm -Rf, for deletion. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh: simplify fetch_submodules() config checkLeah Rowe
We already do what the old code does in setcfg, by virtue of the fact that the st variable is later checked, after loading this config conditionally, where the st variable is otherwise blank. We can avoid the unnecessary work after loading the config, by returning if the config is absent. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh: simplify fetch_submodules()Leah Rowe
We are calling xbmkget in the same way, whether it's a subfile or subrepo. Rename these variables to subcurl and subgit, so that we can call xbmkget unconditionally. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14get.sh: fix caching of crossgcc tarballsLeah Rowe
they were always re-downloading every time. i've basically re-written most of xbmkget. there was some erroneous conditions under which it wrongly deleted the cached file, resulting in it being downloaded again. Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-13git.sh: rename to get.shLeah Rowe
it now handles more than just git, and i forsee it handling even more in the future, e.g. rsync, ftp, bittorrent. Signed-off-by: Leah Rowe <leah@libreboot.org>