apenwarr-redo/docs/cookbook/container/simple.fs.do
Avery Pennarun 3923a7d3f8 cookbook/container: example of building+running docker containers.
This got... long... and complicated.  But I think it's a really good
demonstration of getting redo to do complicated things elegantly.  At
least, I hope it is.
2019-01-08 01:42:33 -05:00

25 lines
524 B
Text

exec >&2
# We can pull in the 'hello' binary built in an earlier
# example. Notice that it's safe to have dependencies
# that cross directory boundaries, even when we're building
# both of those directories in parallel.
FILES="
/bin/sh
../hello/hello
"
if [ -x /bin/busybox ]; then
# Optional, except for runkvm
FILES="$FILES /bin/busybox"
else
redo-ifcreate /bin/busybox
fi
redo-ifchange $FILES
fs=${1%.fs}
rm -rf "$fs"
mkdir -p "$fs/bin"
cp $FILES "$fs/bin/"
ln -s bin/hello "$fs/init"
redo-ifchange "$fs/bin/sh"