meta: simplify build-all a little

This commit is contained in:
Connor Olding 2022-10-04 21:41:16 -07:00
parent df4f8b9dac
commit 0cf6e31d07

View file

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