#!/bin/sh # $Id$ # # install-live.sh -- install live packages. This is install-tl.sh # in the `demo' and `live' distributions. # # Copyright (c) Thomas Esser, Sebastian Rahtz, 1996, 1997, 1998, 1999, # 2000, 2001, 2003, 2004, 2005, 2006. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # # Send bug reports or suggestions to tex-live@tug.org. # # Call this script with a full-featured bourne shell, which may be # /bin/sh, /bin/bsh (e.g. AIX-4.XX), /bin/sh5 (e.g. ULTRIX) or # /bin/bash (on GNU systems) on your system. # set this for debugging... debug=${OVERRIDE_DEBUG-false} unset CDPATH # avoid unwanted output while test $# -gt 0; do case $1 in --debug) debug=true;; --cddir=*) cddir=`echo $1 | sed 's/.*=//'`;; *) break;; esac shift done HERE=`cd \`dirname $0\` && /bin/pwd` . $HERE/utils.sh . $HERE/common.sh series_init() { thisdir=`pwd` CDDIR=${cddir-${OVERRIDE_CDDIR-$thisdir}} LISTS=${OVERRIDE_LISTS-$CDDIR/texmf/lists} BIN=${OVERRIDE_LISTS-$CDDIR/bin} test -d $LISTS || fatal "$0: $LISTS: no such directory. Are you sure this is the TeX Live CD?" echo "Initializing collections... " setvars systems=`(cd $LISTS; ls bin-tex.* | sed -e 's/bin-tex.//')` all_schemes=`(cd $LISTS; ls *.scheme | sed -e 's/-/_/g' -e 's/\.scheme//' | sort )` sc=24 for s in $all_schemes; do S=`echo $s | sed -e 's/_/-/g' ` sc=`expr $sc + 1` eval N=\"\$iden_${sc}\" eval SCHEMES_${N}=\"$s\" T=`grep '^\*Title' $LISTS/$S.scheme | sed -e 's/\*Title: //'` C=`grep '^\*Size' $LISTS/$S.scheme | sed -e 's/\*Size: //'` C=`expr $C / 1000` eval schemes_${s}_n=\"$T\" eval schemes_${s}_ident=\"$N\" eval schemes_${s}_du=\"$C\" done all_lang_collections=`(cd $LISTS; ls collection-lang* | sed 's/-/_/g' | sort )` sc=0 for s in $all_lang_collections; do S=`echo $s | sed 's/_/-/g'` sc=`expr $sc + 1` eval N=\"\$iden_${sc}\" eval LP_${N}=\"$s\" T=`grep '^\*Title' $LISTS/$S | sed -e 's/\*Title: //'` C=`grep '^\*Size' $LISTS/$S | sed -e 's/\*Size: //'` C=`expr $C / 1000` eval p_${s}_n=\"$T\" eval p_${s}_ident=\"$N\" eval p_${s}_du=\"$C\" series_select_level $s 0 done all_collections=`(cd $LISTS; ls collection* | grep -v collection-lang | sed 's/-/_/g' | sort )` sc=0 for s in $all_collections; do S=`echo $s | sed 's/_/-/g'` sc=`expr $sc + 1` eval N=\"\$iden_${sc}\" eval P_${N}=\"$s\" T=`grep '^\*Title' $LISTS/$S | sed -e 's/\*Title: //'` C=`grep '^\*Size' $LISTS/$S | sed -e 's/\*Size: //'` C=`expr $C / 1000` eval p_${s}_n=\"$T\" eval p_${s}_ident=\"$N\" eval p_${s}_du=\"$C\" series_select_level $s 0 done scheme_select scheme_full selected_scheme=scheme_full echo "Done initializing collections." all_collections_anz=`echo $all_lang_collections $all_collections | awk '{print NF}'` systems_init } # This is run when the user does "R" to run live. # (Not available for the compressed image.) # install_cd() { TEXDIR=$CDDIR unset TEXMFCNF unset TEXMFMAIN TEXMFCNF_DIR=$TEXDIR/texmf/web2c echo "Preparing destination directories... " >&2 test -d "$CDDIR" || fatal "$CDDIR does not seem to be the TeX Live CD-ROM." alldirs="$TEXMFSYSVAR" test -z "$TEXMFSYSVAR" || alldirs="$alldirs $TEXMFSYSVAR/fonts/pk $TEXMFSYSVAR/fonts/tfm $TEXMFSYSVAR/web2c $TEXMFSYSVAR/pdftex/config $TEXMFSYSVAR/tex/generic/config $TEXMFSYSVAR/web2c $TEXMFSYSVAR/xdvi $TEXMFSYSVAR/dvips/config $TEXMFSYSVAR/etex/plain/config" for dir in $alldirs; do while test ! -d $dir || test ! -w $dir; do mkdirhier $dir test -d $dir || { warn "could not make directory '$dir'"; continue; } test -w $dir || { warn "cannot write to directory '$dir'"; continue; } done done test -z "$TEXMFSYSVAR" || chmod -R a+w $TEXMFSYSVAR || warn "command 'chmod -R a+w $TEXMFSYSVAR' failed" test -z "$opt_varfonts_dir" || chmod 1777 $opt_varfonts_dir/pk $opt_varfonts_dir/tfm || warn "command 'chmod 1777 $opt_varfonts_dir/pk $opt_varfonts_dir/tfm' failed" pd=$this_platform_fn have_system=false if test -x $TEXDIR/bin/$pd/mktexlsr; then have_system=true bindir=$TEXDIR/bin/$pd PATH=$TEXDIR/bin/$pd:$PATH export PATH TEXMFSYSVAR echo Current system detected as $pd. fi make_var_skeleton cp $TEXDIR/texmf/tex/generic/config/language.dat $TEXMFSYSVAR/tex/generic/config/language.dat test -f $TEXDIR/texmf-dist/tex/plain/config/language.def && cp $TEXDIR/texmf-dist/tex/plain/config/language.def $TEXMFSYSVAR/tex/plain/config test -f $TEXDIR/texmf/xdvi/XDvi && cp $TEXDIR/texmf/xdvi/XDvi $TEXMFSYSVAR/xdvi cp $CDDIR/texmf/dvips/config/config.ps $TEXMFSYSVAR/dvips/config/config.ps cp $CDDIR/texmf/dvipdfm/config/config $TEXMFSYSVAR/dvipdfm/config cp $TEXDIR/texmf/web2c/mktex.cnf $TEXMFSYSVAR/web2c cp $TEXDIR/texmf/web2c/updmap.cfg $TEXMFSYSVAR/web2c cp $CDDIR/texmf-dist/tex/context/config/cont-usr.tex $TEXMFSYSVAR/tex/context/config/cont-usr.tex cp $CDDIR/texmf/tex/generic/config/pdftexconfig.tex $TEXMFSYSVAR/tex/generic/config/pdftexconfig.tex test -z "$TEXMFSYSVAR" || chmod -R a+w $TEXMFSYSVAR || warn "command 'chmod -R a+w $TEXMFSYSVAR' failed" TEXMFCNF__fix_fmtutil make_local_skeleton $bindir/updmap --nohash --quiet --cnffile $TEXMFSYSVAR/web2c/updmap.cfg --dvipsoutputdir=$TEXMFSYSVAR/fonts/map/dvips/updmap --dvipdfmoutputdir=$TEXMFSYSVAR/fonts/map/dvipdfm/updmap --pdftexoutputdir=$TEXMFSYSVAR/fonts/map/pdftex/updmap $have_system && $bindir/mktexlsr cat <$work_dir/$arg.list for i in $all_collections do I=`echo $i | sed 's/_/-/g'` grep "^[A-Za-z0-9]" $LISTS/$I.$arg >> $work_dir/$arg.list done for i in $all_lang_collections do I=`echo $i | sed 's/_/-/g'` grep "^[A-Za-z0-9]" $LISTS/$I.$arg >> $work_dir/$arg.list done } list_files() { :>$work_dir/tmp.jobs :>$work_dir/tmp col=`echo $1 | sed 's/_/-/g'` $debug && echo " [ -> collection $col]" >&2 packages= morecols= filters="| grep -v '^ *$' " if test "$opt_source" = X; then filters="$filters | grep -v texmf-dist/source/" fi if test "$opt_doc" = X; then filters="$filters | grep -v texmf-dist/doc/" fi if test -f $LISTS/$col; then packages=`grep "^+" $LISTS/$col | sed 's/.//'` morecols=`grep "^-" $LISTS/$col | sed 's/.//'` grep "^[a-z]" $LISTS/$col >> $work_dir/tmp grep '^\!' $LISTS/$col >> $work_dir/tmp.jobs for i in $all_systems do eval \$p_${i}_s || continue eval this=\$p_${i}_fn if test -f $LISTS/$col.$this; then $debug && echo " debug:system package $col.$this" >&2 grep "^[\!a-z]" $LISTS/$col.$this >> $work_dir/tmp fi done for i in $packages do list_package $i $col done eval sort -u < $work_dir/tmp $filters >> $work_dir/$col.list eval sort -u < $work_dir/tmp.jobs | tr ' ' '=' >> $work_dir/$col.jobs fi rm $work_dir/tmp $work_dir/tmp.jobs for p in $morecols do list_files $p done } list_package() { :>$work_dir/ptmp.jobs :>$work_dir/ptmp pack=`echo $1 | sed 's/_/-/g'` # if no lists file, return. Many packages exist only on win32, e.g., # lib-geturl, and so we won't have lists for them when not installing # that arch. test -s $LISTS/$pack || return col=$2 filters="| grep -v '^ *$' " if test "$opt_source" = X; then filters="$filters | grep -v texmf-dist/source/" fi if test "$opt_doc" = X; then filters="$filters | grep -v texmf-dist/doc/" fi $debug && echo " debug:package $pack" >&2 grep "^[A-Za-z0-9]" $LISTS/$pack >> $work_dir/ptmp grep '^\!' $LISTS/$pack >> $work_dir/ptmp.jobs for j in $all_systems do eval \$p_${j}_s || continue eval this=\$p_${j}_fn if test -f $LISTS/$pack.$this; then $debug && echo " debug:list_package:system package $pack.$this" >&2 grep "^[A-Za-z0-9]" $LISTS/$pack.$this >> $work_dir/ptmp fi done eval sort -u < $work_dir/ptmp $filters >> $work_dir/$col.list eval sort -u < $work_dir/ptmp.jobs | tr ' ' '=' >> $work_dir/$col.jobs rm $work_dir/ptmp $work_dir/ptmp.jobs for i in `grep "^+" $LISTS/$pack | sed 's/.//'` do list_package $i $col done } # This is run when the user does "I" for a normal disk install. # install_now() { list_file_func=list_files list_package_func=list_package common_start_install echo >&2 echo "Now copying selected files" >&2 $debug && echo " from the lists in $work_dir... " >&2 if $debug; then tarverbose=v else tarverbose= fi for f in `ls $work_dir/*.*list`; do $debug && echo "Copy files listed in $f" >&2 $debug || $echon "`basename $f .list` " >&2 test -s $f || continue # do not tar if empty sort -u $f >$f.uniq if test "x$TAROPT" = "x"; then (cd $CDDIR && $XARGS sh -c 'tar cf - $* \ | (cd '"$TEXDIR && umask 0 && $TARPROG x${tarverbose}f -)" sh <$f.uniq) else (cd $CDDIR && $TARPROG -c -f - $TAROPT $f.uniq) \ | (cd $TEXDIR && umask 0 && $TARPROG -x $tarverbose -f -) fi done echo echo "Done copying." >&2 test -f $TEXDIR/texmf-dist/tex/plain/config/language.def && cp $TEXDIR/texmf-dist/tex/plain/config/language.def $TEXMFSYSVAR/tex/plain/config test -f $TEXDIR/texmf/xdvi/XDvi && cp $TEXDIR/texmf/xdvi/XDvi $TEXMFSYSVAR/xdvi cp $TEXDIR/texmf/dvips/config/config.ps $TEXMFSYSVAR/dvips/config/config.ps cp $TEXDIR/texmf/dvipdfm/config/config $TEXMFSYSVAR/dvipdfm/config cp $TEXDIR/texmf/web2c/mktex.cnf $TEXMFSYSVAR/web2c cp $CDDIR/texmf-dist/tex/context/config/cont-usr.tex $TEXMFSYSVAR/tex/context/config/cont-usr.tex cp $CDDIR/texmf/tex/generic/config/pdftexconfig.tex $TEXMFSYSVAR/tex/generic/config/pdftexconfig.tex common_end_install } ################################################################ # main() ################################################################ unset TEXCONFIG cd `dirname $0` init menu_main