File do.texmf of Package texlive
#!/bin/bash
#
# Extract the choosen scheme into an own tar ball
# default scheme if that from tetex.
#
# Author: Werner Fink <werner@suse.de>
#
dopopd=no
if ! test -x ./tlpm-x86_64-linux.pl ; then
if test -d setuptl/ ; then
pushd setuptl/
dopopd=yes
else
echo "Please change into Master directory" 1>&2
exit 1
fi
fi
: ${TMPDIR:=/var/tmp}
tmfsrc=${TMPDIR}/texmfsrc
mkdir $tmfsrc || exit 1
script=$(mktemp ${TMPDIR}/tlpm.XXXXXX) || exit 1
instmy=$PWD/TLPM/instmy.pm
master=$PWD/..
trap 'rm -f $script $instmy; rm -rf $tmfsrc; test -e $master/00INST.TL.bak && mv $master/00INST.TL.bak $master/00INST.TL' \
EXIT SIGTERM SIGINT SIGHUP SIGPIPE SIGSEGV
if test -e $master/00INST.TL ; then
mv $master/00INST.TL $master/00INST.TL.bak
test -$? -eq 0 || exit 1
fi
sed -r 's/(\$tlpm_os=")[^"]*(")/\1none\2/;s/(TLPM::inst)/\1my/' < ./tlpm-x86_64-linux.pl > $script
test -$? -eq 0 || exit 1
chmod 755 $script
test -$? -eq 0 || exit 1
sed -r 's/(--parents )(.#)/\1--preserve=mode,timestamps\2/' < \
TLPM/inst.pm > $instmy
test -$? -eq 0 || exit 1
ed -s $instmy <<-'EOF'
/^sub extract_dvd/
/^{/,/^}/d
a
{
local ($path);
open(CPY, join(" ", "|xargs -r", $tl_xcopy, $extract_params, "-t", &doubleq($tl_target)));
foreach $path (@extract_files)
{
printf CPY "%s\n", $path;
}
close(CPY);
}
.
wq
EOF
texmfdocc=$tmfsrc/texmf-doc
texmfdist=$tmfsrc/texmf-dist
texmfmain=$tmfsrc/texmf
tardocc=${TMPDIR}/texmf-doc
tardist=${TMPDIR}/texmf-dist
tarmain=${TMPDIR}/texmf-main
mkdir -p $texmfdocc
mkdir -p $texmfdist
mkdir -p $texmfmain
mkdir $texmfdocc/doc
ln -sf $texmfdocc/doc $texmfdist
($script -s $master -d $tmfsrc) <<-EOF
inst -ru scheme-full.scheme
quit
EOF
test -$? -eq 0 || exit 1
linkai=no
if test -d $texmfdist/source/fonts/ai/vf ; then
linkai=yes
oldai=$texmfdist/source/fonts/ai/vf
newai=$texmfdist/fonts/source/ai/vf
mkdir -p $newai
mv $oldai/* $newai/
fi
if test -d $texmfdocc/doc/latex/cmastro ; then
cmastro=$texmfdocc/doc/latex/cmastro
nwastro=$texmfdist/tex/latex/cmastro
mkdir -p $nwastro
rm -f $cmastro/00*
rm -f $cmastro/*pk
rm -f $cmastro/do.sh
mv $cmastro/astro.{sty,tex} $nwastro/
fi
rm -rf $texmfdocc/{tpm,list,source}
rm -rf $texmfdist/{tpm,list,source}
rm -rf $texmfmain/{tpm,list,source}
rm -f $texmfdist/doc
rm -f $tmfsrc/tlpm.*
rm -f $tmfsrc/README
if test $linkai = yes ; then
mkdir -p $texmfdist/source/fonts/ai
ln -sf ../../../fonts/vf/ai $texmfdist/source/fonts/ai/vf
fi
find $tmfsrc/ -name 'ls-R' | xargs -r rm -f
test "$dopopd" = "yes" && popd
export BZIP=-9
pushd $texmfdocc
tar -cj -f ${tardocc}.tar.bz2 *
popd
pushd $texmfdist
tar -cj -f ${tardist}.tar.bz2 *
popd
pushd $texmfmain
tar -cj -f ${tarmain}.tar.bz2 *
popd