--- install-xetex.old	2006-07-20 16:05:08.000000000 +0900
+++ install-xetex	2006-07-20 16:13:45.000000000 +0900
@@ -21,61 +21,65 @@
 	exit 100
 fi
 
+texbindir=__PREFIX/bin
+destroot=__DESTROOT/
+
 # find the existing tex binary, possibly following a symlink
-texbin=`which tex`
-if [ ! -x "${texbin}" ]; then
-	echo "### error: existing tex binary couldn't be found"
-	exit 100
-fi
-if [ -L ${texbin} ]; then
-	texbin=`readlink ${texbin}`
-fi
-texbindir=`dirname ${texbin}`
+#texbin=`which tex`
+#if [ ! -x "${texbin}" ]; then
+#	echo "### error: existing tex binary couldn't be found"
+#	exit 100
+#fi
+#if [ -L ${texbin} ]; then
+#	texbin=`readlink ${texbin}`
+#fi
+#texbindir=`dirname ${texbin}`
 
 # copy the xetex binary to the same dir as standard tex
-cp -pf Work/texk/web2c/xetex ${texbindir}/xetex
+cp -pf Work/texk/web2c/xetex ${destroot}/${texbindir}/xetex
 echo ${texbindir}/xetex >> ${filelist}
 if [ -e Work/texk/xdv2pdf/xdv2pdf ]; then
 	programs="xdv2pdf T1Wrap"
 	for f in ${programs}; do
-		cp -pf Work/texk/xdv2pdf/${f} ${texbindir}/${f}
+		cp -pf Work/texk/xdv2pdf/${f} ${destroot}/${texbindir}/${f}
 		echo ${texbindir}/${f} >> ${filelist}
 	done
 	# the mergemarks script is in the original source dir, not under Work
-	cp -pf texk/xdv2pdf/xdv2pdf_mergemarks ${texbindir}/xdv2pdf_mergemarks
-	chmod +x ${texbindir}/xdv2pdf_mergemarks
+	cp -pf texk/xdv2pdf/xdv2pdf_mergemarks ${destroot}/${texbindir}/xdv2pdf_mergemarks
+	chmod +x ${destroot}/${texbindir}/xdv2pdf_mergemarks
 	echo ${texbindir}/xdv2pdf_mergemarks >> ${filelist}
 fi
 
-# copy our texmf additions into the local texmf tree
-texmflocal=`kpsewhich --var-value TEXMFLOCAL`
-if [ "x${texmflocal}" == "x" ]; then
-	# if --var-value didn't work, try to find the definition in the texmf.cnf file
-	CNF=`kpsewhich texmf.cnf`
-	texmflocal=`sed -rne "s/^[ \t]*TEXMFLOCAL[ \t]*=[ \t]*(\/[^ \t]+).*/\1/p" ${CNF}`
-fi
+# copy our texmf additions into the dist texmf tree
+texmflocal=__PREFIX/share/texmf-dist
+#texmflocal=`kpsewhich --var-value TEXMFLOCAL`
+#if [ "x${texmflocal}" == "x" ]; then
+#	# if --var-value didn't work, try to find the definition in the texmf.cnf file
+#	CNF=`kpsewhich texmf.cnf`
+#	texmflocal=`sed -rne "s/^[ \t]*TEXMFLOCAL[ \t]*=[ \t]*(\/[^ \t]+).*/\1/p" ${CNF}`
+#fi
 
-mkdir -p ${texmflocal}
-if [ -d texmf/.svn ]; then
-	# if we're installing from a Subversion WC, make a copy and clean it up
-	# (don't rely on svn export here in case svn isn't in the current PATH)
-	cp -pRf texmf Work/texmf-nosvn
-	find Work/texmf-nosvn -depth \( -name ".svn" -or -name ".DS*" \) -exec rm -rf {} \;
-	cp -pRf Work/texmf-nosvn/* ${texmflocal}/
-	rm -r Work/texmf-nosvn
-else
-	cp -pRf texmf/* ${texmflocal}/
-fi
+mkdir -p ${destroot}/${texmflocal}
+#if [ -d texmf/.svn ]; then
+#	# if we're installing from a Subversion WC, make a copy and clean it up
+#	# (don't rely on svn export here in case svn isn't in the current PATH)
+#	cp -pRf texmf Work/texmf-nosvn
+#	find Work/texmf-nosvn -depth \( -name ".svn" -or -name ".DS*" \) -exec rm -rf {} \;
+#	cp -pRf Work/texmf-nosvn/* ${texmflocal}/
+#	rm -r Work/texmf-nosvn
+#else
+	cp -pRf texmf/* ${destroot}/${texmflocal}/
+#fi
 find texmf -type f -and -not -path "*/.*" -print | sed -e "s@^texmf@${texmflocal}@" >> ${filelist}
 
 # copy the pool file to /web2c under TEXMFLOCAL
-mkdir -p ${texmflocal}/web2c
-cp -pf Work/texk/web2c/xetex.pool ${texmflocal}/web2c/xetex.pool
+mkdir -p ${destroot}/${texmflocal}/web2c
+cp -pf Work/texk/web2c/xetex.pool ${destroot}/${texmflocal}/web2c/xetex.pool
 echo ${texmflocal}/web2c/xetex.pool >> ${filelist}
 
 # update kpathsearch databases because we've installed a bunch of stuff
-texhash ${texmflocal}
+#texhash ${texmflocal}
 
 # this will build the format files on the system where this script is run;
 # for packaged binary installations, we must repeat this on the target
-sh ./rebuild-formats
+#sh ./rebuild-formats
