summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/inject.sh23
-rw-r--r--include/lib.sh2
-rwxr-xr-xmk32
3 files changed, 16 insertions, 41 deletions
diff --git a/include/inject.sh b/include/inject.sh
index a200981f..9bfda2db 100644
--- a/include/inject.sh
+++ b/include/inject.sh
@@ -228,9 +228,7 @@ extract_kbc1126ec()
) || $err "$board: can't extract kbc1126 ec firmware - $dontflash"
x_ e "$appdir/ec.bin.fw1" f && x_ e "$appdir/ec.bin.fw2" f
-
- cp "$appdir/"ec.bin.fw* "${_dest%/*}/" || \
- $err "!cp 1126ec $_dest - $dontflash"; :
+ x_ cp "$appdir/"ec.bin.fw* "${_dest%/*}/"
}
extract_e6400vga()
@@ -318,10 +316,8 @@ inject()
esac
[ "$new_mac" = "keep" ] && new_mac=""
- if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then
- x_ make -C util/nvmutil clean
- x_ make -C util/nvmutil
- fi
+ [ -n "$new_mac" ] && [ "$new_mac" != "restore" ] && \
+ x_ make -C util/nvmutil clean && x_ make -C util/nvmutil
check_release "$archive" || $err "'$archive' is not a release archive"
@@ -510,11 +506,10 @@ insert()
_offset=""
- if [ "$_t" = "fsp" ]; then
- [ $# -gt 3 ] && _offset="$4"
- else
- [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ] && \
- $err "insert $*, $rom: offset given but empty (undefined)"
+ if [ "$_t" = "fsp" ] && [ $# -gt 3 ]; then
+ _offset="$4"
+ elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then
+ $err "insert $*, $rom: offset given but empty (undefined)"
fi
[ "$nukemode" = "nuke" ] || x_ e "$_dest" f
@@ -551,10 +546,6 @@ modify_mac()
printf "\nGbE NVM written to '%s':\n" "$archive"
x_ "$nvm" "$xbmklocal/gbe" dump | grep -v "bytes read from file" || :
-
- [ "$new_mac" = "restore" ] && \
- printf "\nDefault GbE file '%s' written, unmodified.\n" \
- "${CONFIG_GBE_BIN_PATH##*../}"; :
}
newmac()
diff --git a/include/lib.sh b/include/lib.sh
index d58716c3..50813352 100644
--- a/include/lib.sh
+++ b/include/lib.sh
@@ -146,7 +146,7 @@ find_ex()
$errx find "$@" 2>/dev/null | sort > "$fd" || \
$err "!find $(echo "$@") > \"$fd\""
while read -r fx; do
- "$xx" "$fx" || break; :
+ $xx "$fx" || break; :
done < "$fd"
x_ rm -f "$fd"
}
diff --git a/mk b/mk
index 312ffce3..28a4cb0c 100755
--- a/mk
+++ b/mk
@@ -277,9 +277,9 @@ check_project_hashes()
[ ! -f "$XBMK_CACHE/hash/$project$tree" ] || \
read -r old_pjhash < "$XBMK_CACHE/hash/$project$tree"
- x_ rm -f "$xbmktmp/project.hash"
- fx_ create_project_hash "$datadir" "$configdir/$tree" "$mdir" \
- -type f -not -path "*/.git*/*"
+ fx_ "x_ sha512sum" "$datadir" "$configdir/$tree" "$mdir" \
+ -type f -not -path "*/.git*/*" | awk '{print $1}' > \
+ "$xbmktmp/project.hash" || $err "!h $project $tree"
pjhash="$(sha512sum "$xbmktmp/project.hash" | awk '{print $1}')" || :
[ "$pjhash" != "$old_pjhash" ] && badhash="y"
@@ -292,12 +292,6 @@ check_project_hashes()
"elf/$project/$tree" "elf/$project/$target"; :
}
-create_project_hash()
-{
- [ ! -f "$1" ] || x_ sha512sum "$1" | awk \
- '{print $1}' >> "$xbmktmp/project.hash" || $err "!h $1"; :
-}
-
check_cross_compiler()
{
xgccargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
@@ -332,35 +326,25 @@ check_cross_compiler()
# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental"
check_gnu_path()
{
- [ $# -lt 2 ] && $err "check_gnu_path: Too few arguments"
- [ "$1" = "$2" ] && $err "check_gnu_path: Both arguments identical"
- for _gnuarg in 1 2; do
- eval "[ \"\$$_gnuarg\" = \"gcc\" ] && continue"
- eval "[ \"\$$_gnuarg\" = \"gnat\" ] && continue"
- $err "check_gnu_path: Invalid argument \"$_gnuarg\""
- done
command -v "$1" 1>/dev/null || $err "Host '$1' unavailable"
eval "`setvars "" gccver gccfull gnatver gnatfull gccdir gnatdir`"
- gnu_setver "$1" "$1" || $err "Command '$1' unavailable."
- gnu_setver "$2" "$2" || :
+ x_ gnu_setver "$1" "$1" && gnu_setver "$2" "$2" || :
eval "[ -z \"\$$1ver\" ] && $err \"Cannot detect host '$1' version\""
[ "$gnatfull" = "$gccfull" ] && return 0
eval "$1dir=\"$(dirname "$(command -v "$1")")\""
eval "_gnudir=\"\$$1dir\"; _gnuver=\"\$$1ver\""
- for _gnubin in "$_gnudir/$2-"*; do
- [ -f "$_gnubin" ] || continue
- [ "${_gnubin#"$_gnudir/$2-"}" = "$_gnuver" ] || continue
- _gnuver="${_gnubin#"$_gnudir/$2-"}"; break
+ for _bin in "$_gnudir/$2-"*; do
+ [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ] \
+ && _gnuver="${_bin#"$_gnudir/$2-"}" && break; :
done
gnu_setver "$2" "$_gnudir/$2-$_gnuver" || return 1
[ "$gnatfull" = "$gccfull" ] || return 1
(
- rm -f "$XBMK_CACHE/gnupath/"* || $err "Cannot clear gnupath/"
- cd "$XBMK_CACHE/gnupath" || $err "Can't cd to gnupath/"
+ remkdir "$XBMK_CACHE/gnupath" && x_ cd "$XBMK_CACHE/gnupath"
for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do
_gnuutil="${_gnubin##*/}" && [ -e "$_gnubin" ] && \
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"