#!/bin/zsh
DO=$0
main() {
	args build_dir fstab= filename! decompressor=
	fstab-mounted
	fresh-build-dir
	eval $(getvars)

	dep_add_file $filename
	if [[ -n $decompressor ]]; then
		$decompressor < $filename | (cd $build_dir && exec cpio -i)
		(( ${(j.|.)pipestatus} )) \
			&& die "$DO: Failed to extract file: ${(qqq)filename}"
	else
		cpio -i -D $build_dir < $filename \
			|| die "$DO: Failed to extract file: ${(qqq)filename}"
	fi
	dep_add_dir_mtimes $build_dir
}
. ./common.zsh
# vim: fileencoding=utf8 ft=zsh noet sw=4 ts=4 sts=4