docs/cookbook/container: don't delete *.out and *.code during build.

If mkdocs is running in parallel, it can get upset if one of these
files exists when it lists the directory, but doesn't exist when it
goes to generate the output.  Fundamentally this is a problem in mkdocs
more than in our code, but we might as well avoid it.
This commit is contained in:
Avery Pennarun 2019-02-02 23:54:27 -05:00
commit 6fbda9a7b3
3 changed files with 9 additions and 8 deletions

View file

@ -3,6 +3,7 @@ debootstrap
debian debian
libs libs
simple simple
*.code
*.dockjson *.dockjson
*.fakeroot *.fakeroot
*.fs *.fs
@ -11,6 +12,7 @@ simple
*.initrd *.initrd
*.layer *.layer
*.list *.list
*.out
*.runkvm *.runkvm
*.runlocal *.runlocal
*.rundocker *.rundocker

View file

@ -1,6 +1,6 @@
rm -rf *~ .*~ simple libs debian \ rm -rf *~ .*~ simple libs debian \
*.fs debian.fakeroot *.gz \ *.fs debian.fakeroot *.gz \
*.dockjson *.image *.image.gz *.initrd \ *.code *.dockjson *.image *.image.gz *.initrd \
*.layer *.list \ *.out *.layer *.list \
*.runkvm *.runlocal *.rundocker \ *.runkvm *.runlocal *.rundocker \
*.sha256 *.sha256

View file

@ -1,7 +1,7 @@
./need.sh python kvm busybox ./need.sh python kvm busybox
redo-ifchange "$2.initrd" memcalc.py redo-ifchange "$2.initrd" memcalc.py
rm -f "$3.out" "$3.code" rm -f "$1.out" "$1.code"
# Linux only allows an initrd of size < 50% of RAM, # Linux only allows an initrd of size < 50% of RAM,
# so set a RAM amount based on the initrd size. # so set a RAM amount based on the initrd size.
@ -16,18 +16,17 @@ kvm \
-no-reboot \ -no-reboot \
-display none \ -display none \
-chardev stdio,mux=on,id=char0 \ -chardev stdio,mux=on,id=char0 \
-chardev file,id=char1,path="$3.out" \ -chardev file,id=char1,path="$1.out" \
-chardev file,id=char2,path="$3.code" \ -chardev file,id=char2,path="$1.code" \
-serial chardev:char0 \ -serial chardev:char0 \
-serial chardev:char1 \ -serial chardev:char1 \
-serial chardev:char2 >&2 -serial chardev:char2 >&2
read rv <$3.code || true read rv <$1.code || true
[ -z "$rv" ] && exit 99 [ -z "$rv" ] && exit 99
if [ "$rv" -eq 0 ]; then if [ "$rv" -eq 0 ]; then
sed -e 's/\r//g' "$3.out" >$3 sed -e 's/\r//g' "$1.out" >$3
echo "ok." >&2 echo "ok." >&2
else else
echo "kvm program returned error: $rv" >&2 echo "kvm program returned error: $rv" >&2
fi fi
rm -f "$3.out" "$3.code"
exit "$rv" exit "$rv"