#!/bin/sh # $Id: //depot/Master/install-pkg-live.sh#30 $ $Date: 2005/09/20 $ $Author: karl $ # # install-pkg.sh -- install individual packages from live distributions # into running installations. # # Copyright (c) Thomas Esser, Sebastian Rahtz, 1996, 1997, 1998, 1999, # 2002, 2003, 2004, 2005. # # 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. HERE=`cd \`dirname $0\` && /bin/pwd` . $HERE/utils.sh list_files() { this=$1 $verbose && echo " list_files $this" morecols=`grep "^-" $this | sed 's/.//'` packages=`grep "^+" $this | sed 's/.//'` grep "^[a-z]" $this >> tmp for i in $packages; do if echo "$i" | grep '^collection-' >/dev/null; then echo "(ignoring dependency on collection $i)" continue fi list_files $LISTS/$i done # tex4ht's binaries are in bin-tex4htk.. Sigh. # otherwise, binaries are in bin-., whereas bin- # itself has arch-independent files, like pool files. name=`basename $this` for binlist in bin-$name bin-$name.$System bin-${name}k.$System; do if test -f $LISTS/$binlist; then $verbose && echo " found binary $binlist" grep "^[a-z]" $LISTS/$binlist >> tmp fi done for p in $morecols; do echo "(skipping dependency on collection $p)" done } TAROPT="" TARPROG=tar list=false; src=true; doc=true; hash=true; config=false;verbose=false unset col pkg tarfile cddir while test $# -gt 0; do case $1 in -p) if test $# -ge 2; then pkg=$2; shift else fatal "Missing argument for -p" fi;; --collection=*) col=`echo $1 | sed -e 's/.*=//' -e 's/collection-//'`;; --package=*) pkg=`echo $1 | sed 's/.*=//'`;; --nodoc) doc=false;; --nosrc) src=false;; --nohash) hash=false;; --texconfig) config=true;; --listonly) list=true;; --verbose) verbose=true;; --archive=*) tarfile=`echo $1 | sed 's/.*=//'` list=false;; --cddir=*) cddir=`echo $1 | sed 's/.*=//'`;; --listdir=*) listdir=`echo $1 | sed 's/.*=//'`;; *) echo "$0: $1 is not a valid option, goodbye." >&2; exit 1;; esac shift done TARPROG=tar TAROPT="" find_tar thisdir=`pwd` CDDIR=${cddir-${OVERRIDE_CDDIR-$thisdir}} LISTS=${listdir-${OVERRIDE_LISTS-$CDDIR/texmf/lists}} work_dir=${TMP-/tmp}/.tmp.pkginst.$$ trap 'cd /; rm -rf $work_dir; trap 0' 0 1 2 15 { mkdir $work_dir && cd $work_dir; } || exit test -d $LISTS || fatal "$0: $LISTS: no such directory. Are you sure this is the TeX Live CD?" : ${TEXMF=`kpsewhich -expand-var '$TEXMFMAIN'`} : ${TEXMFSYSVAR=`kpsewhich -expand-var '$TEXMFSYSVAR'`} TEXDIR=`echo $TEXMF | sed 's/texmf.*//'` platform_guess cd $work_dir touch files filters="| grep -v '^ *$' " $src || filters="$filters | grep -v texmf-dist/source/" $doc || filters="$filters | grep -v texmf-dist/doc/" System=`echo $Sys | sed 's/_/-/g'` if $verbose; then echo Package [$pkg] / Collection [$col] >&2 echo Install point is $TEXDIR >&2 echo Install binaries for system $System >&2 fi if test -n "$col"; then colfile=$LISTS/collection-$col if test -f $colfile; then :>tmp list_files $LISTS/collection-$col eval sort < tmp $filters | grep -v '^\!' | uniq > files eval grep '\^\!' tmp | tr ' ' '=' > jobs rm tmp else echo "$0: $col: no such collection (missing $colfile)." fi fi if test -n "$pkg"; then pkgfile=$LISTS/$pkg if test -f $pkgfile; then :>tmp list_files $LISTS/$pkg eval sort < tmp $filters | grep -v '^\!' | uniq > files eval grep '\^\!' tmp | tr ' ' '=' > jobs else echo "$0: $pkg: no such package (missing $pkgfile)." >&2 exit 1 fi fi if $list; then cat files exit fi if test -n "$tarfile"; then case $tarfile in /*) : ;; *) tarfile=$thisdir/$tarfile;; esac if test "x$TAROPT" = "x"; then echo "$0: archive option is not supported on this system." >&2 else echo Package [$pkg] / Collection [$col] being tarred up into $tarfile cd $CDDIR; $TARPROG -c -f $tarfile $TAROPT $work_dir/files fi exit fi test -z $pkg$col && exit if $verbose; then echo Files to be copied: >&2 cat files >&2 echo >&2 fi if test "x$TAROPT" = "x"; then ( cd "$CDDIR" TARPROG=$TARPROG TEXDIR=$TEXDIR $XARGS \ sh -c '$TARPROG cf - "$@" | (cd "$TEXDIR"; umask 0; $TARPROG xf -)' sh ) <$work_dir/files else (cd $CDDIR; $TARPROG -c -f - $TAROPT $work_dir/files) | (cd $TEXDIR; umask 0; $TARPROG -x -f -) fi X=`kpsewhich language.dat` if test -n "$X"; then cd `dirname $X` Z=`pwd` if $verbose; then echo Making language.dat in $Z >&2 echo " from your language selections." >&2 fi Y=`kpsewhich language.us` cd `dirname $Y` cat language.us language.*.dat > $Z/language.dat fi for f in `ls $work_dir/jobs` do $verbose && echo " do work items listed in $f" >&2 for j in `sort $f | uniq` do command=`echo $j | sed 's/.\(.*\)=.*/\1/'` parameter=`echo $j | sed 's/.*=\(.*\)/\1/'` $verbose && echo " EXECUTE $command on $parameter" >&2 case $command in addMap) echo "Map $parameter" >> $TEXMFSYSVAR/web2c/updmap.cfg;; addMixedMap) echo "MixedMap $parameter" >> $TEXMFSYSVAR/web2c/updmap.cfg;; addDvipsMap) echo "p +$parameter" >> $TEXMFSYSVAR/dvips/config/config.ps;; addDvipdfmMap) test -f $TEXMFSYSVAR/dvipdfm/config/config && echo "f $parameter" >> $TEXMFSYSVAR/dvipdfm/config/config;; esac done done : ${TEXMFDIST=`kpsewhich -expand-var '$TEXMFDIST'`} $hash && mktexlsr $TEXMF $TEXMFDIST updmap-sys --nohash --cnffile=$TEXMFSYSVAR/web2c/updmap.cfg \ --dvipsoutputdir=$TEXMFSYSVAR/fonts/map/dvips/updmap \ --dvipdfmoutputdir=$TEXMFSYSVAR/fonts/map/dvipdfm/updmap \ --pdftexoutputdir=$TEXMFSYSVAR/fonts/map/pdftex/updmap $config && texconfig-sys init $config || echo "PLEASE RUN texconfig or texconfig-sys to make new formats."