Commit Graph

68 Commits (25.06_branch)

Author SHA1 Message Date
Leah Rowe 34d134f2f2 init.sh: don't use eval to read version files
it's not necessary, and was the cause of a recent issue,
which i mitigated, but why mitigate it?

prevent bugs. don't use eval unless absolutely necessary.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:46:16 +01:00
Leah Rowe b63612871d init.sh: use backslash for dotfiles in eval
see:

commit f0c629dcc6c3f2242a735567cdd6855fa108d1a5
Author: Leah Rowe <leah@libreboot.org>
Date:   Sat Apr 12 13:51:49 2025 +0100

    lib.sh: write version/versiondate to dotfiles

and this bug report:

https://codeberg.org/libreboot/lbmk/issues/284

The report indicates that the above commit broke bash,
when sh (on the user's system) is bash.

I know sometimes when using bash, I need to use the
back slash when dealing with dots, e.g. when grepping
something.

Also double quote references to dotfiles, e.g. when
directing the output of printf.

I never noticed the issue myself, since I use dash.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:46:10 +01:00
Leah Rowe 4ff7cd3d77 init.sh: make git name/email error more useful
instruct the user what to do in these conditions

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:45:25 +01:00
Leah Rowe ec287ca69e init.sh: move git name/mail check to xbmk_git_init
the command -v check has been removed, since this function
already calls git immediately, which would accomplish the
same thing since that causes an error if git isn't there.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:45:19 +01:00
Leah Rowe f89e5ad87a init.sh: tidy up the git name/email check
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:45:13 +01:00
Leah Rowe f3caaf394e mk: move git check to init.sh xbmk_set_version
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:44:24 +01:00
Leah Rowe f30892e92f init.sh: tidy up xbmk_init()
more version-related code moved to xbmk_set_version

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:44:18 +01:00
Leah Rowe cbf486789d mk: move git_init to init.sh
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:44:14 +01:00
Leah Rowe 2c39a2bc7b init.sh: minor cleanup
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:44:08 +01:00
Leah Rowe d6d8ee1d4b init.sh: clean up setvars
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:44:03 +01:00
Leah Rowe ef78f88117 init.sh setvars: make err a printf for eval
setvars is always invoked with eval, so make the error
condition a message for eval, to ensure that it is reliably
handled, in case of error condition.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:43:58 +01:00
Leah Rowe 3221ca7742 init.sh: merge xbmk_child_init with xbmk_init
the for loop at the end of xbmk_init does essentially
the same thing. adapt accordingly, and merge.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:43:52 +01:00
Leah Rowe 723e979c8c init.sh: split xbmk_child_init into functions
one function, for one task. skeleton functions for
performing multiple tasks. that is the basic coding
style guideline for lbmk.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:43:47 +01:00
Leah Rowe 0d86ef50ac init.sh: move parent fork to new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:43:41 +01:00
Leah Rowe 68d5660cca init.sh: Provide more complete error info
On initialisation of the child instance, ./mk is
executed, but an error from it won't reveal what
command was actually executed.

This change makes that the case, since x_ does
print the command that caused an error.

This is useful for debugging. However, we don't
want x_ to cause a real exit, because we still
need to handle the lock file from the parent
instance.

Therefore, the first child instance is executed
inside a subshell, and xbmk_rval is set if that
subshell returns non-zero.

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:43:35 +01:00
Leah Rowe 2c8570c07a move variables out of init.sh to others
move them where they are used, or if they are used
in many places, move them to lib.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:42:08 +01:00
Leah Rowe a16d9f35a2 re-split include/init.sh to lib.sh
move non-init functions to lib.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:40:33 +01:00
Leah Rowe 6d54f46148 rename include/lib.sh to init.sh
this is in prep for the next change, where non-init
functions will be moved to another file, again named
include/lib.sh

Signed-off-by: Leah Rowe <leah@libreboot.org>
2025-04-30 15:37:55 +01:00