mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-17 18:34:57 +02:00
xbmk: use sbase sha512sum, not host sha512sum
the --status flag seems to be a GNUism as stated in the previous commit, i import sbase suckless now, so as to have a consistent implementation of sha512sum. this ensures that its output is reliable, when i'm using the output of this command within backticks. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+2
-1
@@ -313,7 +313,8 @@ bad_checksum()
|
|||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
csum="$(x_ sha512sum "$2" | awk '{print $1}')" || \
|
build_sbase
|
||||||
|
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
|
||||||
err "!sha512 '$2' $1" bad_checksum "$@"
|
err "!sha512 '$2' $1" bad_checksum "$@"
|
||||||
|
|
||||||
if [ "$csum" = "$1" ]; then
|
if [ "$csum" = "$1" ]; then
|
||||||
|
|||||||
@@ -35,11 +35,14 @@ checkvarschk=""
|
|||||||
is_child=""
|
is_child=""
|
||||||
basetmp=""
|
basetmp=""
|
||||||
|
|
||||||
|
sha512sum="util/sbase/sha512sum"
|
||||||
|
|
||||||
xbmk_init()
|
xbmk_init()
|
||||||
{
|
{
|
||||||
xbmkpwd="`pwd || err "Cannot generate PWD"`" || err "!" xbmk_init "$@"
|
xbmkpwd="`pwd || err "Cannot generate PWD"`" || err "!" xbmk_init "$@"
|
||||||
xbmklock="$xbmkpwd/lock"
|
xbmklock="$xbmkpwd/lock"
|
||||||
basetmp="$xbmkpwd/xbmkwd"
|
basetmp="$xbmkpwd/xbmkwd"
|
||||||
|
sha512sum="$xbmkpwd/util/sbase/sha512sum"
|
||||||
|
|
||||||
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
||||||
x_ xbmkpkg "$@"
|
x_ xbmkpkg "$@"
|
||||||
|
|||||||
@@ -162,6 +162,13 @@ unpad_one_byte()
|
|||||||
x_ mv "$unpaddedfile" "$1"
|
x_ mv "$unpaddedfile" "$1"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
build_sbase()
|
||||||
|
{
|
||||||
|
if [ ! -f "$sha512sum" ]; then
|
||||||
|
x_ make -C "$xbmkpwd/util/sbase"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
fx_()
|
fx_()
|
||||||
{
|
{
|
||||||
xchk fx_ "$@"
|
xchk fx_ "$@"
|
||||||
|
|||||||
+5
-3
@@ -442,11 +442,13 @@ project_up_to_date()
|
|||||||
"$@"
|
"$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
fx_ "x_ sha512sum" find "$@" -type f -not -path "*/.git*/*" | awk \
|
build_sbase
|
||||||
'{print $1}' > "$xbtmp/tmp.hash" || err "!h $project $hashdir" \
|
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
|
||||||
|
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
|
||||||
|
err "!h $project $hashdir" \
|
||||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||||
|
|
||||||
hash="$(x_ sha512sum "$xbtmp/tmp.hash" | awk '{print $1}' || \
|
hash="$(x_ "$sha512sum" "$xbtmp/tmp.hash" | awk '{print $1}' || \
|
||||||
err)" || err "$hashname: Can't read sha512 of '$xbtmp/tmp.hash'" \
|
err)" || err "$hashname: Can't read sha512 of '$xbtmp/tmp.hash'" \
|
||||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||||
|
|
||||||
|
|||||||
+7
-3
@@ -602,11 +602,13 @@ prep()
|
|||||||
|
|
||||||
mksha512()
|
mksha512()
|
||||||
{
|
{
|
||||||
|
build_sbase
|
||||||
|
|
||||||
if [ "${1%/*}" != "$1" ]; then
|
if [ "${1%/*}" != "$1" ]; then
|
||||||
x_ cd "${1%/*}"
|
x_ cd "${1%/*}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ sha512sum ./"${1##*/}" >> "$2" || \
|
x_ "$sha512sum" ./"${1##*/}" >> "$2" || \
|
||||||
err "!sha512sum \"$1\" > \"$2\"" "mksha512" "$@"
|
err "!sha512sum \"$1\" > \"$2\"" "mksha512" "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -711,11 +713,13 @@ vfile()
|
|||||||
# must be called from a subshell
|
# must be called from a subshell
|
||||||
check_vendor_hashes()
|
check_vendor_hashes()
|
||||||
{
|
{
|
||||||
|
build_sbase
|
||||||
|
|
||||||
x_ cd "$tmpromdir"
|
x_ cd "$tmpromdir"
|
||||||
|
|
||||||
if [ "$has_hashes" != "n" ] && [ "$nuke" != "nuke" ]; then
|
if [ "$has_hashes" != "n" ] && [ "$nuke" != "nuke" ]; then
|
||||||
sha512sum --status -c "$hashfile" || x_ sha1sum --status \
|
( x_ "$sha512sum" -c "$hashfile" ) || \
|
||||||
-c "$hashfile"
|
x_ sha1sum -c "$hashfile"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
x_ rm -f "$hashfile"
|
x_ rm -f "$hashfile"
|
||||||
|
|||||||
Reference in New Issue
Block a user