diff --git a/build-all b/build-all index 32eed61..9070807 100755 --- a/build-all +++ b/build-all @@ -1,47 +1,33 @@ #!/usr/bin/env sh -yes_retrieve() \ +yes_retrieve() { : \ - && local image="$1" \ - && local ok=1 \ - && local out= \ + && local image="$1" ok=1 out= g= \ && shift \ && [ -d out ] \ && out="$(realpath out)" \ && for f in "$@" \ ;do : \ - && local g="out/${f##*/}" \ - && if [ -e "$g" ] \ - ;then : \ - && mv "$g" "$g~" \ - ;fi \ + && g="out/${f##*/}" \ + && { ! [ -e "$g" ] || mv "$g" "$g~" ;} \ ;done \ && podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \ cp -- "$@" "/out/" \ && for f in "$@" \ ;do : \ - && local g="out/${f##*/}" \ + && g="out/${f##*/}" \ && if [ -e "$g" ] \ ;then : \ - && if [ -e "$g~" ] \ - ;then : \ - && rm "$g~" \ - ;fi \ + && { ! [ -e "$g~" ] || rm "$g~" ;} \ ;else : \ && printf '%s: %s\n' yes_retrieve "failed to copy file $f to $g" \ && ok=0 \ ;fi \ ;done \ && [ $ok = 1 ] \ - ;} \ -; + ;} -dbg_retrieve() \ -{ : \ - && yes_retrieve "$1" "$2" \ - && yes_retrieve "$1" "$2.dbg" \ - ;} \ -; +dbg_retrieve() { yes_retrieve "$1" "$2" && yes_retrieve "$1" "$2.dbg" ;} : \ && me="$(readlink -f "$0")" \