From ea319c1b817e65ad0808f08343b3203e62ab15a9 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 12 Feb 2023 11:48:38 -0700 Subject: scripts: Clean up the scripts to be clearer and more consistent --- scripts/main.sh | 58 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 25 deletions(-) (limited to 'scripts/main.sh') diff --git a/scripts/main.sh b/scripts/main.sh index d89f387..73eada7 100755 --- a/scripts/main.sh +++ b/scripts/main.sh @@ -1,30 +1,38 @@ #!/bin/bash +readonly image=../scratch/dump-zero.img + +###################################################################### + set -e -b=../scratch/dump-zero -gen() ( + +run-btrfs-rec() { local tgt=$1; shift local log=${tgt%.*}.log if test -s "$tgt"; then return fi - { set -x; command time --verbose "$@"; } \ - >"$tgt" \ - 2> >(tee >&2 "$log") -) + { + set -x; + command time --verbose \ + ./bin/btrfs-rec \ + --pv="$image" \ + "$@" + } >"$tgt" 2> >(tee >&2 "$log") +} set -x -CGO_ENABLED=0 go build -trimpath ./cmd/btrfs-rec -mkdir -p "$b.gen" +make build +gendir="${image%.img}.gen" +mkdir -p "$gendir" +export GOMEMLIMIT="$(awk '/^MemTotal:/{ print $2 "KiB" }' /dev/null -export GOMEMLIMIT="$(awk '/^MemTotal:/{ print $2 "KiB" }'