Commit Graph

461 Commits (c20e29005fa28b0a5732175fba43d233c3d76adc)

Author SHA1 Message Date
Leah Rowe c20e29005f release.sh: use x_ on find command for nuke()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18 19:15:13 +01:00
Leah Rowe 97603a43cf release.sh: simplify nuke() EVEN MORE
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18 19:15:07 +01:00
Leah Rowe 534a4d4870 get.sh: move nuke() to release.sh
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-18 19:15:00 +01:00
Leah Rowe 8b646abe9a release.sh: simplify prep_release_bin()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18 19:14:38 +01:00
Leah Rowe aeb1187a8a release.sh: don't move src/docs/
otherwise, ./mk -b (without argument) will fail, on release
archives. also, perhaps i should add an mkhelper to build it?

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-18 19:13:56 +01:00
Leah Rowe 8cb0c224a5 get.sh: FURTHER simplify nuke()
this is getting almost comical now

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17 12:18:26 +01:00
Leah Rowe 8cb23315d9 get.sh: simplify tmpclone()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-17 11:09:35 +01:00
Leah Rowe 8d6244bb7f get.sh: fix bad mkdir command
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-17 11:09:25 +01:00
Leah Rowe 4582a21abf inject.sh: Stronger hash verification
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-16 13:43:00 +01:00
Leah Rowe fd98310f5b properly exit 1 when calling fx_
in a few places, we use the presence of a file found
by fx_ to cause an exit, but the command that runs
looks something like:

exit 1 "string"

this yields an error, and a non-zero exit, because of
too many arguments to "exit", but we wanted a non-zero
exit anyway.

nevertheless, this is incorrect.

to fix it, eval is used instead. if the never-going-to-exist
condition one day exists where exit 1 actually returns, not,
you know, exits, we will use err instead, with the string
as argument.

this should be fine. it's a bit hacky, but so is fx_, and
it works. fx_ is used in several places to keep the sloccount
down, providing a common way to perform while loops on the
output of a command; that is its only purpose..

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-15 02:42:26 +01:00
Leah Rowe e96dfae0b3 get.sh: simplify nuke()
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-15 02:12:34 +01:00
Leah Rowe 3bfb82cb82 get.sh: fix broken printf statement
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:45:37 +01:00
Leah Rowe 9c24b170c2 get.sh: use subshells on try_ functions
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-14 21:45:31 +01:00
Leah Rowe 4f926ee708 get.sh: simplify try_copy()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:45:24 +01:00
Leah Rowe 36cf7892df get.sh submodules: Don't delete files recursively
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-14 21:45:14 +01:00
Leah Rowe 398f265359 get.sh: simplify fetch_submodules() config check
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-14 21:45:06 +01:00
Leah Rowe a3f48f3115 get.sh: simplify fetch_submodules()
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-14 21:44:42 +01:00
Leah Rowe 142b79b206 get.sh: fix caching of crossgcc tarballs
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-14 21:42:52 +01:00
Leah Rowe a658265a86 release.sh: Don't run prep_release with fx_
The result of the printf statement is sorted, making
it do binaries first, which results in a lot of junk
files then being present inside the source archive.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:42:32 +01:00
Leah Rowe aaa0a1ff93 git.sh: rename to get.sh
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>
2025-05-14 21:42:17 +01:00
Leah Rowe 2d691c7377 git.sh: Only create destination repo on success
Don't leave a broken cache laying around, which would
otherwise break lbmk for the user.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:42:10 +01:00
Leah Rowe 6199bc5b95 git.sh: cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:42:02 +01:00
Leah Rowe 1dd18a9a55 git.sh: Re-implement redundant git downloads
And this time it works.

I'm now calling xbmkget() which in turn calls tmpclone(),
instead of me calling tmpclone() directly.

The git-pull is done on both remotes, regardless of whether
the first succeeds. This way, if I forgot to update a mirror,
downloads would probably still work.

This also fixes an issue people were having, for example where
the gnulib repository of GRUB was always being downloaded
every time.

I'm using a new directory, XBMK_CACHE/clone, instead
of XBMK_CACHE/repo (which I used before), in case people
still have the old caches from before.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:41:53 +01:00
Leah Rowe 176c0fa1c4 rom.sh: reduce indendation in check_coreboot_utils
call it via fx_, instead of using a for loop

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:41:42 +01:00
Leah Rowe 584de778f8 release.sh: simplify release()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:41:31 +01:00
Leah Rowe ed8644177b release.sh: clean up the vdir after release
do this after moving the version directory within it.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:40:56 +01:00
Leah Rowe 2ca6337b0a release.sh: remove src_dirname variable
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:40:48 +01:00
Leah Rowe abfa2d1ec7 release.sh: build in tmp directory first
don't move to the real directory until the work
is done.

that way, a re-try can be done, while analysing
the old files. it is created based on the tmpdir,
under XBMK_CACHE/

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:40:26 +01:00
Leah Rowe d3ec7e8635 release.sh: remove unnecessary mkdir command
the following git clone command creates that directory

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:40:12 +01:00
Leah Rowe b68447e75c release.sh: split up build_release()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:39:35 +01:00
Leah Rowe 4b36ba9765 release.sh: delete tmp/cache from the tarball
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:38:11 +01:00
Leah Rowe 5861c25a7c lib.sh: remove rmgit()
We don't need to call it from git.sh, because it's
only being done when building a release anyway,
and we already run rmgit when doing a release.

The function itself is only two simple fx_ calls,
so we can just do that from build_release().

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:37:51 +01:00
Leah Rowe 1f2c8e47d4 lib.sh: remove mk()
i don't need it. i can use fx_ instead, on functions
that previously called mk().

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:37:22 +01:00
Leah Rowe 19888e2cb8 lib.sh: move xbmkget() to git.sh
in cbmk, it's only used from there.

in lbmk, it's also used from vendor.sh.

however, i plan to further expand git.sh at
some point, tidying it up so that git cloning
is also done from xbmkget, with dlop=git and
git.sh would then be renamed to get.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:36:31 +01:00
Leah Rowe 9c5f59cc42 lib.sh: remove mksha512sum()
this is unused in cbmk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:35:54 +01:00
Leah Rowe 279b7f20be lib.sh: split up try_file()
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:35:31 +01:00
Leah Rowe 3347e3d314 lib.sh: move _ua to try_file()
it's only used there

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:35:25 +01:00
Leah Rowe 57f68535a2 inject.sh: remove the hashfiles variable
we only use it once, and it's a trivial string

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:34:51 +01:00
Leah Rowe d07bd53b07 inject.sh: define xchanged here instead
this is used here, and also needed in cbmk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:33:39 +01:00
Leah Rowe 47b9a261d7 lib.sh: use fx_ in rmgit()
with fx_, i have more much granular control over
how errors are handled.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:32:53 +01:00
Leah Rowe ed9f6338af lib.sh: split up xbmkget()
it was too complicated. most of the logic has been moved
to a new function, try_file()

the for loop is handled by xbmkget(), whereas each try
is now handled in try_file()

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:32:39 +01:00
Leah Rowe 753af0a7a2 inject.sh: only compile nvmutil if needed
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:32:33 +01:00
Leah Rowe 387f4b785b inject.sh: simplified serprog check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:32:26 +01:00
Leah Rowe 31bab5c10c remove another confusing message
the current message says the file name, and implies that
the given file has already been updated.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-14 21:31:47 +01:00
Leah Rowe 6c3ea129a4 inject.sh: Remove confusing path on tar creation
The path is wrong. The correct path is printed afterward.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 20:49:19 +01:00
Leah Rowe 3062f04c45 inject.sh: re-add mac address confirmation
it just makes the script more user-friendly

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 20:24:30 +01:00
Leah Rowe cf8ca4cdd6 inject.sh: further cleanup
this is based on lbmk commit e5af201060e

this removes more code that is not needed in cbmk's version
of inject.sh

lbmk and cbmk inject.sh are now much more in sync, in that
they are much more similar to each other than before.

the cbmk version only handles MAC addresses, and does not
do vendor file downloading or patching.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 20:16:23 +01:00
Leah Rowe a82ca2da5f tree.sh: only create elfdir in copy_elf()
otherwise, we create empty directories where build.list
doesn't exist, like on coreboot.

we already create a directory when needed, when actually
copying elf files, so let's just leave it at that.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 18:22:30 +01:00
Leah Rowe 33debfcf1c tree.sh: simplified srcdir check on make-clean
this is the check that ksips a given target if the tree
directory does not exist, on the clean command.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 18:22:25 +01:00
Leah Rowe 2acdfefdf9 inject.sh: bring in sync with lbmk 0f931b508a8
see lbmk commit:
0f931b508a8eb34e70b2ed3628ac4fe74f22b8e8
from 10 May 2025

The lbmk version of inject.sh also contained logic to
download vendor files, which cbmk doesn't and won't support.

This made merging patches between the two projects harder, so
lbmk's version has been modified to mostly only include the MAC
address related code on inject.sh, just like the Canoeboot one.

On lbmk, extra functionality for vendor files is now provided
on include/vendor.sh, which cbmk lacks (and will never have).

With a few minor alterations, this script is now very much in
sync with the lbmk version.

In fact, just to provide the point, here is the diff between
lbmk's version of inject.sh, compared to the version in cbmk
introduced by this commit. Observe:

(< is a subtracted line, and > is an added line. So the < shows
what was removed from lbmk's version when adding to cbmk, and
the > lines show what cbmk added to its version).

yes me cbmk$ colordiff ../lbmk/include/inject.sh include/inject.sh
89,90d88
< 	[ -n "$vcfg" ] && check_vcfg
<
94,95d91
< 	mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py"
< 	kbc1126_ec_dump="$xbmkpwd/$cbdir/util/kbc1126/kbc1126_ec_dump"
103,104d98
< 	[ "$nukemode" = "nuke" ] || x_ ./mk download "$board"
<
112,113c106,107
< 		e "$tmpromdir/$_hashes" f && \
< 		    has_hashes="y" && hashfile="$_hashes" && break; :
---
> 		e "$tmpromdir/$_hashes" f && err \
> 		    "'$archive': vendorfile insertion unsupported"
118,120d111
< 	fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
< 	( check_vendor_hashes ) || err "Can't verify hashes for '$archive'"; :
<
129d119
< 	setvfile && return 1; :

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-05-10 18:20:44 +01:00