Files
infix/board/common/mkrauc.sh
T
Tobias Waldekranz d16ad7eedc build: Define build id and version in one place
Before this change, setting `GIT_VERSION` in `make`'s environment was
intended to allow the user to specify a custom build id.  As it turns
out, `test/test.mk` had duplicated the logic from
`board/common/post-build.sh` to unconditionally override any value set
in it.  Because of the way `make` handles variables, where assignments
to variables inherited from the environment are exported back to
it[^1], this would mean that `test.mk` would always clobber any value
set by the user.  Furthermore, there is also this file called
`buildroot/package/git/git.mk`, which also (reasonably) has opinions
about what the proper value of `GIT_VERSION` should be.  In summary,
this was a bit of a mess.

Therefore: Make sure that there is one single place where we determine
the build id and version, and make sure that those variables are
scoped under the `INFIX_` prefix to avoid clashing with any other
component.

[^1]: https://www.gnu.org/software/make/manual/html_node/Environment.html
2024-12-05 10:29:21 +01:00

44 lines
758 B
Bash
Executable File

#!/bin/sh
set -e
name=$1
compat=$2
sign=$3
crt=$(ls $sign/*.crt)
key=$(ls $sign/*.key)
common=$(dirname "$(readlink -f "$0")")
work=$BUILD_DIR/mkrauc
mkdir -p "$work"
cp -f "$common/rauc-hooks.sh" "$work/hooks.sh"
# RAUC internally uses the file extension to find a suitable install
# handler, hence the name must be .img
cp -f "$BINARIES_DIR/rootfs.squashfs" "$work/rootfs.img"
cp -f "$BINARIES_DIR/rootfs.itbh" "$work/rootfs.itbh"
cat >"$work/manifest.raucm" <<EOF
[update]
compatible=${compat}
version=${INFIX_VERSION}
[bundle]
format=verity
[hooks]
filename=hooks.sh
[image.rootfs]
filename=rootfs.img
hooks=post-install
EOF
rm -f "$BINARIES_DIR/$name.pkg"
rauc --cert="$crt" --key="$key" \
bundle "$work" "$BINARIES_DIR/$name.pkg"