2022-09-23 13:21:45 -07:00
|
|
|
#!/usr/bin/env sh
|
|
|
|
|
|
|
|
yes_retrieve() {
|
2022-09-23 13:34:14 -07:00
|
|
|
local image="$1"
|
|
|
|
local ok=1
|
|
|
|
local out=
|
2022-09-23 13:21:45 -07:00
|
|
|
shift || return
|
2022-09-23 13:34:14 -07:00
|
|
|
[ -d out ] || return
|
|
|
|
out="$(realpath out)" || return
|
|
|
|
for f in "$@"; do
|
|
|
|
local g="out/${f##*/}"
|
|
|
|
if [ -e "$g" ]; then
|
|
|
|
mv "$g" "$g~"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
podman run -v="$out":/out --rm --entrypoint /bin/busybox "$image" \
|
|
|
|
cp -- "$@" "/out/" || return
|
|
|
|
for f in "$@"; do
|
|
|
|
local g="out/${f##*/}"
|
|
|
|
if [ -e "$g" ]; then
|
|
|
|
if [ -e "$g~" ]; then
|
|
|
|
rm "$g~"
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
printf '%s: %s\n' yes_retrieve "failed to copy file $f to $g"
|
|
|
|
ok=0
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
[ $ok = 1 ]
|
2022-09-23 13:21:45 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
dbg_retrieve() {
|
|
|
|
: \
|
|
|
|
&& yes_retrieve "$1" "$2" \
|
|
|
|
&& yes_retrieve "$1" "$2.dbg" \
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
: \
|
2022-09-23 13:34:14 -07:00
|
|
|
&& me="$(readlink -f "$0")" \
|
|
|
|
&& cd "${me%/*}" \
|
2022-09-23 13:30:01 -07:00
|
|
|
\
|
2022-09-23 13:34:14 -07:00
|
|
|
&& { [ -d out ] || mkdir out ;} \
|
2022-09-23 13:30:01 -07:00
|
|
|
\
|
|
|
|
&& podman build -t notwa-util notwa-util \
|
|
|
|
&& podman build -t cosmo cosmo \
|
|
|
|
&& podman build -t cosmo-kuroko cosmo-kuroko \
|
2022-09-23 13:21:45 -07:00
|
|
|
\
|
|
|
|
&& dbg_retrieve cosmo-kuroko /bin/kuroko.com \
|
|
|
|
;
|