From 3b4bd6d59371d09489ef12b7e4a9cc34dfa57cc9 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Wed, 5 Oct 2022 02:07:29 -0700 Subject: [PATCH] meta: fit build-all into a 80x48 screen and fix a couple edge cases --- build-all | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/build-all b/build-all index 9070807..68ff800 100755 --- a/build-all +++ b/build-all @@ -1,39 +1,25 @@ #!/usr/bin/env sh -yes_retrieve() -{ : \ - && local image="$1" ok=1 out= g= \ - && shift \ - && [ -d out ] \ - && out="$(realpath out)" \ +yes_retrieve() { : \ + && local ok=1 out= g= image="${1?missing argument}" && shift \ + && [ -d out ] && out="$(realpath out)" \ && for f in "$@" \ - ;do : \ - && g="out/${f##*/}" \ - && { ! [ -e "$g" ] || mv "$g" "$g~" ;} \ + ;do g="out/${f##*/}" && { ! [ -e "$g" ] || mv "$g" "$g~" ;} || return \ ;done \ && podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \ cp -- "$@" "/out/" \ && for f in "$@" \ - ;do : \ - && g="out/${f##*/}" \ - && if [ -e "$g" ] \ - ;then : \ - && { ! [ -e "$g~" ] || rm "$g~" ;} \ - ;else : \ - && printf '%s: %s\n' yes_retrieve "failed to copy file $f to $g" \ - && ok=0 \ - ;fi \ - ;done \ + ;do if g="out/${f##*/}" && [ -e "$g" ] \ + ;then ! [ -e "$g~" ] || rm "$g~" || return \ + ;else printf 'yes_retrieve: %s\n' "failed to copy file $f to $g"; ok=0 \ + ;fi ;done \ && [ $ok = 1 ] \ ;} dbg_retrieve() { yes_retrieve "$1" "$2" && yes_retrieve "$1" "$2.dbg" ;} : \ - && me="$(readlink -f "$0")" \ - && cd "${me%/*}" \ -\ - && { [ -d out ] || mkdir out ;} \ + && me="$(readlink -f "$0")" && cd "${me%/*}" && { [ -d out ] || mkdir out ;} \ \ && podman build -t notwa-util notwa-util \ && podman build -t cosmo cosmo \