INSTALL_OPTS="-v --group=root --owner=root"

mv -v asciidoc.py asciidoc
install ${INSTALL_OPTS} --mode=755 -p ./asciidoc ./a2x ${INSTALL_ROOT}/usr/bin &&
install ${INSTALL_OPTS} --mode=755 -d ${INSTALL_ROOT}/etc/asciidoc &&
install ${INSTALL_OPTS} --mode=644 -p ./*.conf ${INSTALL_ROOT}/etc/asciidoc &&
install ${INSTALL_OPTS} --mode=755 -d ${INSTALL_ROOT}/etc/asciidoc/filters &&
install ${INSTALL_OPTS} --mode=644 -p ./filters/code-filter.conf ${INSTALL_ROOT}/etc/asciidoc/filters &&
install ${INSTALL_OPTS} --mode=755 -p ./filters/code-filter.py ${INSTALL_ROOT}/etc/asciidoc/filters &&
install ${INSTALL_OPTS} --mode=755 -d ${INSTALL_ROOT}/etc/asciidoc/docbook-xsl &&
install ${INSTALL_OPTS} --mode=644 -p ./docbook-xsl/* ${INSTALL_ROOT}/etc/asciidoc/docbook-xsl &&
install ${INSTALL_OPTS} --mode=755 -d ${INSTALL_ROOT}/etc/asciidoc/stylesheets &&
install ${INSTALL_OPTS} --mode=644 -p ./stylesheets/*.css ${INSTALL_ROOT}/etc/asciidoc/stylesheets &&
install ${INSTALL_OPTS} --mode=755 -d ${INSTALL_ROOT}/etc/asciidoc/images/icons &&
for file in images/icons/* ; do
	if [ -d $file ] ; then
		install ${INSTALL_OPTS} --mode=755 -d /etc/asciidoc/$file &&
		install ${INSTALL_OPTS} --mode=644 -p $file/* ${INSTALL_ROOT}/etc/asciidoc/$file
	elif [ -f $file ] ; then
		install ${INSTALL_OPTS} --mode=644 -p $file ${INSTALL_ROOT}/etc/asciidoc/$(dirname $file)
	fi 
done

