make copying files from containers much more robust
This commit is contained in:
parent
150b4ae76b
commit
6d38d60857
1 changed files with 28 additions and 4 deletions
32
build-all
32
build-all
|
@ -1,9 +1,32 @@
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
yes_retrieve() {
|
yes_retrieve() {
|
||||||
local a="$1"
|
local image="$1"
|
||||||
|
local ok=1
|
||||||
|
local out=
|
||||||
shift || return
|
shift || return
|
||||||
podman run -v="play":/out --rm --entrypoint /bin/busybox "$a" cp -- "$@" "/out/"
|
[ -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 ]
|
||||||
}
|
}
|
||||||
|
|
||||||
dbg_retrieve() {
|
dbg_retrieve() {
|
||||||
|
@ -14,9 +37,10 @@ dbg_retrieve() {
|
||||||
}
|
}
|
||||||
|
|
||||||
: \
|
: \
|
||||||
&& cd "$(readlink -f "$0")" \
|
&& me="$(readlink -f "$0")" \
|
||||||
|
&& cd "${me%/*}" \
|
||||||
\
|
\
|
||||||
&& [ -d out ] || mkdir out \
|
&& { [ -d out ] || mkdir out ;} \
|
||||||
\
|
\
|
||||||
&& podman build -t notwa-util notwa-util \
|
&& podman build -t notwa-util notwa-util \
|
||||||
&& podman build -t cosmo cosmo \
|
&& podman build -t cosmo cosmo \
|
||||||
|
|
Loading…
Add table
Reference in a new issue