#!/bin/ash -efu

. "${0%/*}"/mki-sh-functions

[ -d "$chroot" ] ||
	fatal "$dir: not look like a work directory of hasher."

cat >"$chroot/tmp/packimage.sh"<<-EOF
#!/bin/sh -efu
cd /.our
/.host/find -mindepth 1 -maxdepth 1 -exec rm -rf -- '{}' '+'
/.host/find /.image/ -mindepth 1 -maxdepth 1 -exec cp -alt /.our/ -- '{}' '+'
#/.host/find /.image/ -mindepth 1 -maxdepth 1 -exec rm -rf -- '{}' '+'
EOF

mki_exec_once "$chroot/tmp/packimage.sh"
mki-copy-our2out
