#!/bin/sh # TeX Live installation script # (c) Thomas Esser, Sebastian Rahtz, 1996, 1997 # # Permission to use and distribute, but no warranty. # 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. # Example: # sh ./install.sh while test $# -gt 0; do case $1 in --cddir=*) cddir=`echo $1 | sed 's/.*=//'`;; *) break;; esac shift done # set this for debugging... debug=${OVERRIDE_DEBUG-false} ################################################################ # Basic IO: ################################################################ ################################################################ # read: called with the name of a variable and (optionally) a # different message text. Keeps the old value of the # variable, if the empty string in entered. ################################################################ gets() { gets_var=$1; gets_text=${2-$gets_var} eval old=\$$gets_var eval $echon \""New value for $gets_text [$old]: "\" read $gets_var eval test -z \"\$$gets_var\" && eval $gets_var=\'$old\' } ################################################################ # getopt: get a menu choice. # $1: string with valid characters # $2: message for prompting ################################################################ getopt() { chars=$1; msg=$2 while true; do #$echon "$msg ([$chars]): " $echon "$msg: " >&2 read ans ans=`echo $ans | tr '[a-z]' '[A-Z]'` case "$ans" in [$chars]) echo "$ans" return esac done } ################################################################ # toolge: given the name of a variable, toogle switches between # the values ' ' and X. ################################################################ toggle() { if eval test \"\$$1\" = X; then eval $1=\' \' else eval $1=X fi } ################################################################ # This tricky function displays the value of a variable that can # contain newline characters. Variables will be expanded, too. # Arguments: # 1: the name of the variable ################################################################ textvar_show() { OLDIFS=$IFS; IFS=''; eval echo \"`eval echo \\$${1}`\" IFS=$OLDIFS } readln() { $echon 'Press return to continue... ' read foo } helpme() { var=$1 cls textvar_show $var 2>&1 | $PAGER echo readln } ################################################################ # Use the yesno functions to ask the user a simple yes/no # question. # Arguments: # $1: test to display for the question (" (Y/N)? " will # automatically be appended). ################################################################ yesno() { while true; do $echon "$1 (Y/N)? " read ans case $ans in y|Y) return 0;; n|N) return 1;; esac done } ################################################################ # A set of functions the might do an echo without linefeed in # the end. Function find_echo sets the variable "echon" to a # suitable function. ################################################################ echo_a() { echo -n "$@"; } echo_b() { echo "$@\c"; } echo_c() { echo -e "$@\c"; } echo_d() { /bin/echo -n "$@"; } echo_e() { /bin/echo "$@\c"; } echo_f() { /bin/echo -e "$@\c"; } ################################################################ # Test which of the above functions does the trick. We set # the variable "echon" to the first function that works # correctly. ################################################################ find_echo() { for i in a b c d e f; do test "`echo_$i c``echo_$i a`" = ca && echon=echo_$i && return done echon=echo } ################################################################ # a replacement for xargs (for systems that dont have it) ################################################################ mxargs() { ( COUNT=25 COUNTP=26 TEMP=${TMP-/tmp} TMPA=$TEMP/.tmp_xargs_a.$$ TMPB=$TEMP/.tmp_xargs_b.$$ trap "rm -f $TMPA $TMPB; trap '' 0; exit 0" 0 1 2 15 cat > $TMPA while test -s $TMPA; do args=`sed -n "1,${COUNT}p" <$TMPA` "$@" $args mv $TMPA $TMPB sed -n "${COUNTP},\$p" <$TMPB >$TMPA done ) } ################################################################ # search for a binary in PATH, find all occurences ################################################################ find_in_path() { fip_testbin=$1 fip_result="" case "$fip_testbin" in /*) test -x "$fip_testbin" && test -f "$fip_testbin" && fip_result="$fip_result $fip_testbin";; *) OLDIFS=$IFS; IFS=:; eval set $PATH; IFS=$OLDIFS for fip_this_dir do test -x "$fip_this_dir/$fip_testbin" && test -f "$fip_this_dir/$fip_testbin" && fip_result="$fip_result $fip_this_dir/$fip_testbin" done esac echo $fip_result } ################################################################ # search for a tar that either understands -I or -T ################################################################ test_tar() { testtar_tmp=${TMP-/tmp}/.testtar.$$ TARS="`find_in_path gtar` `find_in_path tar`" test -z "$TARS" && return ( exec 3>&1 1>/dev/null 2>&1 trap "cd /; rm -rf $testtar_tmp; trap '' 0; exit 0" 0 1 2 15 mkdir $testtar_tmp; cd $testtar_tmp mkdir a b tar cf test.tar a b rmdir a b echo a > list for TAR in $TARS; do $TAR -x -f test.tar -T list >/dev/null 2>&1 if test -d a && test ! -d b; then echo "$TAR -T" >&3 break fi rmdir a b >/dev/null 2>&1 $TAR -x -f test.tar -I list >/dev/null 2>&1 if test -d a && test ! -d b; then echo "$TAR -I" >&3 break fi done ) } ################################################################ # if we find a good tar: use it. Else use xargs (or even mxargs) ################################################################ find_tar() { set x `test_tar`; shift if test -n "$1"; then GOODTAR=true TARPROG=$1; TAROPT=$2 else GOODTAR=false TARPROG=tar; TAROPT="" XARGS=`find_in_path xargs | sed 's/ .*//'` test -x "$XARGS" || XARGS=mxargs fi } series_select_level() { p=$1; l=$2 case $l in 0) eval p_${p}1_s=false eval p_${p}2_s=false eval p_${p}3_s=false eval p_${p}_level=\'' [nothing]'\' eval p_${p}_dus=0;; 1) eval p_${p}1_s=true eval p_${p}2_s=false eval p_${p}3_s=false eval p_${p}_level=\'' [basic]'\' eval p_${p}_dus=\$p_${p}1_du;; 2) eval p_${p}1_s=true eval p_${p}2_s=true eval p_${p}3_s=false eval p_${p}_level=\''[recommended]'\' eval p_${p}_dus=\`expr \$p_${p}1_du + \$p_${p}2_du\`;; 3) eval p_${p}1_s=true eval p_${p}2_s=true eval p_${p}3_s=true eval p_${p}_level=\'' [all]'\' eval size=\`expr \$p_${p}1_du + \$p_${p}2_du\` eval p_${p}_dus=\`expr \$p_${p}3_du + \$size\`;; esac setlength p_${p}_dus 6 } system_selectall() { size=0 for s in $all_systems; do eval size=\`expr $size + \$p_${s}_du\` eval p_${s}_s=true done all_systems_dus=$size all_systems_ns=$all_systems_anz setlength all_systems_dus 6 setlength all_systems_ns 2 } system_deselectall() { for s in $all_systems; do eval p_${s}_s=false done all_systems_dus=0 all_systems_ns=0 setlength all_systems_dus 6 setlength all_systems_ns 2 } series_allnone() { for s in $all_series; do series_select_level $s 0 done nobinstat; total_stat } series_allbase() { for s in $all_series; do series_select_level $s 1 done nobinstat; total_stat } series_allrec() { for s in $all_series; do series_select_level $s 2 done nobinstat; total_stat } series_allall() { for s in $all_series; do series_select_level $s 3 done nobinstat; total_stat } setvars() { p_ams_h='American Mathematical Society macro packages and fonts' p_bibtex_h='BiBTeX bibliography processor style files and bibliographies' p_doc_h='General documentation for TeX_related software' p_dvips_h='Support material for dvi to PostScript driver' p_metapost_h='Support material for MetaPost' p_fonts_h='Fonts, including metrics, virtual fonts and sources' p_formats_h='Large macro packages (text1, latex209, psizzl etc)' p_generic_h='Style files and macros useable with any TeX format' p_graphics_h='Macro packages and fonts for drawing pictures' p_lang_h='Non_english language support, including hyphenation' p_latex_h='Style files and document classes for LaTeX2e' p_plain_h=' Style files and macros for plain TeX' p_systems_h='Program binaries for supported Unix systems' p_texlive_h='Support material and configuration for TeXLive' p_ams_n='AMS packages' p_bibtex_n='BiBTeX support' p_doc_n='General Documentation' p_dvips_n='DVIPS Support' p_metapost_n='MetaPost Support' p_fonts_n='Fonts' p_formats_n='Extra formats' p_generic_n='Generic styles' p_graphics_n='Picture macros' p_lang_n='Language support' p_latex_n='LaTeX styles' p_plain_n='Plain TeX styles' p_systems_n='System binaries' p_texlive_n='TeX Live' p_alpha_linux_du='5980' p_alpha_osf32_du='12666' p_amiweb2c_du='6348' p_i386_linux_du='7946' p_mab_nextstep3_du='29900' p_mips_irix405_du='5376' p_mips_irix53_du='6307' p_mips_irix63_du='5908' p_mips_ultrix44_du='8099' p_rs6000_aix325_du='4618' p_rs6000_aix411_du='5591' p_sparc_solaris25_du='7065' p_hppa11_hpux1020_du='4229' p_hppa11_hpux905_du='4321' p_i586_freebsd22_du='3082' p_i686_linux_du='3102' p_sparc_linux_du='4280' p_sparc_solaris24_du='3901' p_sparc_sunos413_du='4638' p_win32_du='5488' p_alpha_linux_n='Alpha Linux' p_alpha_osf20_n='DEC Alpha OS 2.0' p_alpha_osf32_n='DEC Alpha OS 3.2' p_amiweb2c_n='Amiga' p_hppa11_hpux905_n='HP9000 HPUX 9.05' p_hppa11_hpux1020_n='HP9000 HPUX 10.20' p_i386_linux_n='Intel PC with Linux (ELF)' p_i586_freebsd22_n='Intel PC with Free BSD' p_i686_linux_n='Intel Pentium Pro with Linux (ELF)' p_mab_nextstep3_n='NextStep 3' p_mips_irix405_n='SGI IRIX 4.0.5' p_mips_irix52_n='SGI IRIX 5.2' p_mips_irix53_n='SGI IRIX 5.3' p_mips_irix63_n='SGI IRIX 6.3' p_mips_irix64_n='SGI IRIX 6.4' p_mips_ultrix44_n='DECstation Ultrix 4.4' p_rs6000_aix32_n='IBM RS 6000 AIX 3.2' p_rs6000_aix325_n='IBM RS 6000 AIX 3.2.5' p_rs6000_aix411_n='IBM RS 6000 AIX 4.1.1' p_sparc_sunos413_n='Sun Sparc Sunos 4.1.3' p_sparc_solaris25_n='Sun Sparc Solaris 2.5' p_sparc_solaris24_n='Sun Sparc Solaris 2.4' p_sparc_linux_n='Sun Sparc with Linux' p_win32_n='Windows 95 or NT' p_ams2_du='6359' p_bibtex1_du='92' p_bibtex2_du='6492' p_doc1_du='348' p_doc2_du='26183' p_doc3_du='12513' p_dvips1_du='563' p_dvips3_du='1187' p_fonts1_du='2007' p_fonts2_du='19855' p_fonts3_du='12441' p_formats2_du='1003' p_formats3_du='11970' p_generic1_du='51' p_generic2_du='450' p_generic3_du='8212' p_graphics2_du='10373' p_graphics3_du='10373' p_lang2_du='3287' p_lang3_du='1822' p_latex1_du='19312' p_latex2_du='9021' p_latex3_du='33361' p_metapost1_du='1280' p_plain1_du='634' p_plain2_du='122' p_plain3_du='3624' p_systems1_du='110673' p_texlive1_du='8570' p_texlive2_du='47953' } series_init() { thisdir=`pwd` CDDIR=${cddir-${OVERRIDE_CDDIR-$thisdir}} LISTS=${OVERRIDE_LISTS-$CDDIR/share/texmf/lists} test -d $LISTS || fatal "$0: $LISTS: no such directory. Are you sure, this is the TUG TeX CD?" $echon "Initializing collections... " setvars all_packages=`(cd $LISTS; find * -type f -print | grep -v TRANS.TBL | grep -v '^system' | sed 's@/.*@@' | sort | uniq)` systems=`(cd $LISTS; find system* -type f -print | grep -v TRANS.TBL | sed 's@.*/@@' | sort | uniq)` mandatory=`(cd $LISTS; find *1 -type f -print | grep -v TRANS.TBL | grep -v '^system' | sed 's@/.*@@' | sort | uniq)` recommended=`(cd $LISTS; find *1 *2 -type f -print | grep -v TRANS.TBL | grep -v '^system' | sed 's@/.*@@' | sort | uniq)` all_series='ams bibtex doc dvips metapost fonts formats generic graphics lang latex plain texlive' for s in $all_series; do eval help=\$p_${p}_h eval p_${p}1_n=\"\$p_${p}_n \(basic\)\" eval p_${p}2_n=\"\$p_${p}_n \(recommended\)\" eval p_${p}3_n=\"\$p_${p}_n \(other\)\" eval p_${p}1_h=\$help eval p_${p}2_h=\$help eval p_${p}3_h=\$help eval : \$\{p_${s}1_du=0\} eval : \$\{p_${s}2_du=0\} eval : \$\{p_${s}3_du=0\} series_select_level $s 2 done echo "Done." all_series_anz=`echo $all_packages | awk '{print NF}'` nobinstat $echon "Initializing system packages... " all_systems= anz=0 for s in $systems; do anz=`expr $anz + 1` t=`echo $s | sed 's@-@_@g; s@\.@@g'` all_systems="$all_systems $t" eval p_${t}_fn=$s eval p_${t}_s=false done echo "Done." all_systems_anz=$anz all_systems_dus=0 this_system=`platform_guess` if test -n "$this_system"; then eval p_${this_system}_s=true eval all_systems_dus=\$p_${this_system}_du eval this_platform_n=\$p_${this_system}_n eval this_platform_fn=\$p_${this_system}_fn all_systems_ns=1 fi setlength all_systems_dus 6 setlength all_systems_anz 2 setlength all_systems_ns 2 total_stat } select_platforms() { changed=false cls echo "Possible answers: es, o, eturn to main menu, uit." for p in $all_systems; do eval name=\"\$p_${p}_n\" case `getopt YNRQ "Install binaries for system [$p] $name"` in Y) eval p_${p}_s=true; changed=true;; N) eval p_${p}_s=false; changed=true;; R) break;; Q) exit_on_confirm;; esac done $changed && { system_stat; total_stat; } } system_stat() { $echon "Counting selected system packages... " anz=0 for i in $all_systems; do eval \$p_${i}_s && anz=`expr $anz + 1` done all_systems_ns=$anz setlength all_systems_ns 2 echo "Done." $echon "Calculating disk space requirements for systems..." size=0 for i in $all_systems; do eval \$p_${i}_s || continue eval size=\`expr $size + \$p_${i}_du\` done all_systems_dus=$size setlength all_systems_dus 6 echo "Done." } nobinstat() { $echon "Counting selected collections... " anz=0 for i in $all_packages; do eval \$p_${i}_s && anz=`expr $anz + 1` done all_series_ns=$anz setlength all_series_ns 2 echo "Done." $echon "Calculating disk space requirements for collections..." size=0 for i in $all_series; do eval size=\`expr $size + \$p_${i}_dus\` done all_series_dus=$size setlength all_series_dus 6 echo "Done." } total_stat() { total_dus=`expr $all_series_dus + $all_systems_dus` setlength total_dus 6 } this_platform_set() { for s in all_systems; do : done } ################################################################ # utility functions: ################################################################ bad_sh() { /bin/sh -c 'exit 1' retval=$? if test "$retval" != 1; then echo echo 'Your /bin/sh is completely broken. A simple program like' echo echo " /bin/sh -c 'exit 1'; echo \$?" echo echo "gives a wrong result." echo echo 'Your shell is likely to break some scripts of TeX Live. Please' echo 'update your /bin/sh first and try to install TeX Live later.' echo 'GNU bash 1.14.5 will do, whereas bash 1.14.3 is known to have' echo 'problems.' echo exit 1 fi } warning() { echo "$@" } cls() { test "$debug" = true || clear } check_for_binary() { testbin=$1 case "$testbin" in /*) test -x "$testbin" && test -f "$testbin"; return;; *) OLDIFS=$IFS; IFS=:; eval set $PATH; IFS=$OLDIFS for this_dir do test -x "$this_dir/$testbin" && test -f "$this_dir/$testbin" && return 0 done return 1;; esac } require_binaries() { for this_bin do check_for_binary $this_bin || fatal "program '$this_bin' not found in PATH" done } TEXMFCNF__fix_texmf() { # test "$TEXDIR/share/texmf" = "$TEXMF" && return test -w "$TEXMFCNF_DIR/texmf.cnf" || return $echon "Unsetting VARTEXMF in $TEXMFCNF_DIR/texmf.cnf... " >&2 cd $work_dir sed 's@VARTEXMF@%VARTEXMF@' $TEXMFCNF_DIR/texmf.cnf > .sed_tmp.$$ cat .sed_tmp.$$ > $TEXMFCNF_DIR/texmf.cnf rm .sed_tmp.$$ echo Done. >&2 } # NEW PLATFORM: add a 'case' platform_guess() { system=`(cd ${TMP-/tmp}; sh ${OVERRIDE_GUESS-$CDDIR}/config.guess | sed 's/-.*-/-/')` case $system in alpha-osf2.0) echo alpha_osf20;; alpha-osf*) echo alpha_osf32;; hppa1.1-hpux*) echo hppa11_hpux1020;; *86-bsdi2.0) echo i386_bsdi20;; *86-freebsd2.0.5) echo i386_freebsd205;; *86-freebsd2*) echo i386_freebsd210;; *86-netbsd1.0) echo i386_netbsd10;; *86-netbsd1.*) echo i386_netbsd11;; *86-linux) echo i386_linux;; m68k-linux) echo m68k_linux;; m68k-linuxoldld) echo m68k_linuxoldld;; m68k-nextstep3) echo m68k_nextstep3;; i386-nextstep3) echo mab_nextstep3;; mips-irix5.2) echo mips_irix52;; mips-irix5.*) echo mips_irix53;; mips-irix6.*) echo mips_irix64;; mips-ultrix4.4) echo mips_ultrix44;; rs6000-aix3.2) echo rs6000_aix32;; rs6000-aix4.*) echo rs6000_aix411;; sparc-solaris2.5) echo sparc_solaris25;; sparc-solaris2.*) echo sparc_solaris24;; sparc-sunos4.*) echo sparc_sunos413;; alpha-linux) echo alpha_linux;; sparc-linux) echo sparc_linux;; ami-web2c) echo ami_web;; esac } unset_vars() { for var in $envvars; do unset $var done } mkdirhier() { case $1 in /*) cd /;; esac OLDIFS=$IFS; IFS=/; eval set $1; IFS=$OLDIFS for i do test -d $i || mkdir $i || break cd $i || break done } # fill a string with blanks: setlength() { var=$1 length=$2 eval value=\"\$$var\" l=`expr "$value" : '.*'` test $l -lt $length || return d=`expr $length - $l` OLDIFS=$IFS; IFS='' substr=`awk 'END {print substr(" ", 1, ANZ)}' ANZ=$d > $msg <<" echo case `getopt TRQ 'What shall we do now: ry again, econfigure, uit'` in T) return;; R) menu_main;; Q) exit 1;; esac } warn() { msg=$1 cls echo "Oops, I am in trouble here! The problem was:" >&2 echo ">> $msg <<" >&2 echo >&2 case `getopt CQ 'What shall we do now: continue, uit'` in C) return;; Q) exit 1;; esac } fatal() { echo; echo echo "ERROR: $@." echo "This was a fatal error, my friend. Installation aborted." $debug && read foo exit 1 } show_error() { test $? = 0 && return cls echo 'WARNING: the last command returned an error.' if yesno 'Do you want to see the errorlog'; then cat $ERRLOG | $PAGER readln fi cls } locate_binaries() { require_binaries touch sed awk gzip ln rm ls tar tr mkdir cat `echo $PAGER | sed 's@ .*@@'` pwd } man_fix_texmf() { file=$TEXDIR/man/man1/bibtex.1 test -f "$file" || return man_texmf_old=`grep texmf/bibtex/bst $file 2>/dev/null | sed 's@.*:@@; s@/bibtex/bst@@'` test -z "$man_texmf_old" && man_texmf_old=/usr/local/texmf man_TEXDIR_old=`dirname "$man_texmf_old"` test -z "$man_TEXDIR_old" && man_TEXDIR_old=/usr/local if test "$TEXMF" != "$man_texmf_old" || test "$man_TEXDIR_old" != "$TEXDIR"; then $echon "Fixing pathnames in the manualpages... " for mpage in $TEXDIR/man/*/*[0-9]; do sed s@$man_texmf_old@$TEXMF@g\;s@$man_TEXDIR_old@$TEXDIR@g \ $mpage > $work_dir/man.tmp.$$ test -s $work_dir/man.tmp.$$ && mv $work_dir/man.tmp.$$ $mpage done echo "Done." fi touch $TEXDIR/man/cat*/* 2>/dev/null } prepare_dirs() { $echon "Preparing destination directories... " >&2 test -d "$CDDIR" || fatal "$CDDDIR does not seem to be the TeX Live CD-ROM." work_dir=${TMP-/tmp}/.tmp_inst.$$ ERRLOG=$work_dir/.errlog.$$ trap 'cd /; rm -rf $work_dir $TEXDIR/share/texmf/.tmp_testfile.$$;trap '' 0; exit 0' 0 1 2 15 alldirs="$TMPDIR $TEXDIR $TEXMF $work_dir $opt_symlinks_bin $opt_symlinks_info" test -z "$opt_symlinks_man" || alldirs="$alldirs $opt_symlinks_man/man1 $opt_symlinks_man/man5 $opt_symlinks_man/cat1 $opt_symlinks_man/cat5" test -z "$opt_varfonts_dir" || alldirs="$alldirs $opt_varfonts_dir/pk $opt_varfonts_dir/tfm" 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 "$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" touch $TEXMF/.tmp_testfile.$$ if test -f $TEXDIR/share/texmf/.tmp_testfile.$$; then NEED_TEXMF_FIX=false else mkdir $TEXDIR/share ln -s $TEXMF $TEXDIR/share/texmf test -f $TEXDIR/share/texmf/.tmp_testfile.$$ || fatal "$0: invalid combination of TEXDIR / TEXMF." NEED_TEXMF_FIX=true fi echo "Done." >&2 if test $all_systems_ns = 1; then cls textvar_show screen_6 echo # if yesno 'Do you want to omit the extra subdirectory'; then # platform_subdir_strip=true # mkdir $TEXDIR/bin # for p in $all_systems; do # if eval \$p_${p}_s; then # eval platform_subdir_strip_d=\$p_${p}_fn # break # fi # done # test -n "$platform_subdir_strip_d" && ln -s . $TEXDIR/bin/$platform_subdir_strip_d # fi fi } list_files() { arg=$1 if test -d $LISTS/$arg; then cat $LISTS/$arg/[a-z]* return fi if test -f $LISTS/systems*/$arg; then cat $LISTS/systems*/$arg return fi warn "Dont know how to install $arg!" } maketex_setopt() { mtsite=$TEXMFCNF_DIR/MakeTeX.cnf test -w "$mtsite" || return show_error test -w "$TEXMFCNF_DIR/texmf.cnf" || return test "$opt_varfonts" = X || return $echon "Setting VARFONTS in texmf.cnf... " >&2 ed "$TEXMFCNF_DIR/texmf.cnf" >$ERRLOG 2>&1 <&2 $echon "Adding varfonts feature in $mtsite... " >&2 ed "$mtsite" >$ERRLOG 2>&1 <<'eof' /^: \${MT_FEATURES=/ s/}/:varfonts}/ w q eof show_error echo "Done." >&2 } install_now() { prepare_dirs skip_systemstuff=false TEXMFCNF_DIR=$TEXDIR/share/texmf/web2c test -f $TEXMFCNF_DIR/texmf.cnf && skip_systemstuff=true ( echo "Preparing list of files to be copied." >&2 echo "For selected collections:" >&2 for p in $all_packages; do eval \$p_${p}_s || continue eval name=\"\$p_${p}_n\" echo $name >&2 list_files $p done echo "For selected systems:" >&2 for p in $all_systems; do eval \$p_${p}_s || continue eval name=\"\$p_${p}_n\" echo $name >&2 eval list_files \$p_${p}_fn done ) | grep -v TRANS.TBL | sort | uniq > $work_dir/files echo >&2 $echon "Now copying selected files... " >&2 test -s $work_dir/files || warn "$0: no files to install?" if test "x$TAROPT" = "x"; then (cd $CDDIR; $XARGS sh -c 'tar cf - $* | (cd '"$TEXDIR"'; umask 0; tar xf -)' sh <$work_dir/files) else (cd $CDDIR; $TARPROG -c -f - $TAROPT $work_dir/files) | (cd $TEXDIR; umask 0; $TARPROG -x -f -) fi echo "Done." >&2 test -n "$platform_subdir_strip_d" && rm -f $TEXDIR/bin/$platform_subdir_strip_d 2>/dev/null if test "x$TEXMF" != "x$TEXDIR/share/texmf"; then $echon "Fixing permissions in $TEXMF... " >&2 chmod -R a+r,u+w,go-w $TEXMF 2>/dev/null rm -f $TEXDIR/share/texmf echo "Done." >&2 fi $echon "Fixing permissions in $TEXDIR... " >&2 chmod -R a+r,u+w,go-w $TEXDIR 2>/dev/null echo "Done." >&2 if test "$opt_varfonts" = X; then rm -f $TEXMF/ls-R touch $opt_varfonts_dir/ls-R; chmod 666 $opt_varfonts_dir/ls-R ln -s $opt_varfonts_dir/ls-R $TEXMF/ls-R else $echon "Setting up directories for automatic font creation... " >&2 find "$TEXMF/fonts/pk" "$TEXMF/fonts/tfm" "$TEXMF/fonts/source/jknappen" -type d \ -print 2>/dev/null | $XARGS chmod 1777 2>/dev/null touch $TEXMF/ls-R; chmod 666 $TEXMF/ls-R fi find "$TEXMF/fonts/source/jknappen" -type d -print 2>/dev/null | $XARGS chmod 1777 2>/dev/null echo "Done." >&2 $echon "Updating filename database... " >&2 echo '% ls-R -- maintained by MakeTeXls-R; do not change this line.' > $TEXMF/ls-R (cd $TEXMF; ls -LAR ./ /dev/null 2>/dev/null) | sed 's@\.//@./@' >> $TEXMF/ls-R echo "Done." >&2 $skip_systemstuff || man_fix_texmf $skip_systemstuff || maketex_setopt $skip_systemstuff || TEXMFCNF__fix_texmf pd=$this_platform_fn bindir= if test -x $TEXDIR/bin/$pd/tex; then PATH=$TEXDIR/bin/$pd:$PATH #texconfig init bindir=$TEXDIR/bin/$pd else test -x $TEXDIR/bin/tex && PATH=$TEXDIR/bin:$PATH #texconfig init bindir=$TEXDIR/bin fi if test -n "$bindir"; then test -f $bindir/latex || ln -s tex $bindir/latex test -f $bindir/tex || ln -s tex $bindir/tex test -f $bindir/mf || ln -s mf $bindir/mf fi $skip_systemstuff || opt_do_symlinks $skip_systemstuff && echo "System updated successfully." $skip_systemstuff || greetings exit } greetings() { cls cat <<'eof' Welcome to the TeX Live system! The TUG Web site (http://www.tug.org/tex-live.html) will contain any updates and corrections to this system. eof } opt_do_symlinks() { test "$opt_symlinks" = X || return $echon 'Creating symbolic links... ' if test -d $TEXDIR/man/man1 && test -w $opt_symlinks_man/man1; then cd $opt_symlinks_man/man1 rm -f `ls $TEXDIR/man/man1`; ln -s $TEXDIR/man/man1/* . fi if test -d $TEXDIR/man/man5 && test -w $opt_symlinks_man/man5; then cd $opt_symlinks_man/man5 rm -f `ls $TEXDIR/man/man5`; ln -s $TEXDIR/man/man5/* . fi if test -d $TEXDIR/man/cat1 && test -w $opt_symlinks_man/cat1; then cd $opt_symlinks_man/cat1 rm -f `ls $TEXDIR/man/cat1`; ln -s $TEXDIR/man/cat1/* . fi if test -d $TEXDIR/man/cat5 && test -w $opt_symlinks_man/cat5; then cd $opt_symlinks_man/cat5 rm -f `ls $TEXDIR/man/cat5`; ln -s $TEXDIR/man/cat5/* . fi if test -d $TEXDIR/info && test -w "$opt_symlinks_info"; then cd $opt_symlinks_info rm -f `ls $TEXDIR/info`; ln -s $TEXDIR/info/*info* . fi if test "$opt_symlinks" = X; then this_platform_bin= if test -x $TEXDIR/bin/tex; then this_platform_bin=$TEXDIR/bin else test -x $TEXDIR/bin/$this_platform_fn/tex && this_platform_bin=$TEXDIR/bin/$this_platform_fn fi if test -n "$this_platform_bin"; then cd $opt_symlinks_bin rm -f `ls $this_platform_bin`; ln -s $this_platform_bin/* . fi echo 'Done.' fi } ################################################################ # menus: ################################################################ menu_main() { while true; do cls opt_savespace_man=X textvar_show screen_1; echo case `getopt CSDOIHQ 'Enter command'` in P) menu_this_platform;; S) select_platforms;; C) menu_series_customize;; D) menu_directories;; O) menu_options;; I) install_now;; H) helpme help_1;; Q) exit_on_confirm;; esac done } series_customize() { p=$1 eval name=\"\$p_${p}_n\" eval help=\"\$p_${p}_h\" eval size1=\"\$p_${p}1_du\" eval size2=\"\$p_${p}2_du\" size2=`expr $size2 + $size1` eval size3=\"\$p_${p}3_du\" size3=`expr $size3 + $size2` setlength size1 6 setlength size2 6 setlength size3 6 cls textvar_show one_collection; echo case `getopt NBEARQ 'Enter command'` in N) series_select_level $p 0; nobinstat; total_stat;; B) series_select_level $p 1; nobinstat; total_stat;; E) series_select_level $p 2; nobinstat; total_stat;; A) series_select_level $p 3; nobinstat; total_stat;; R) : ;; Q) exit_on_confirm;; esac } # NEW PLATFORM: change getopt call and add a new case. menu_this_platform() { while true; do cls textvar_show screen_5; echo case `getopt N123456789ABCDEFGHIJKLMNOPRQST 'Select the platform you are currently on'` in N) this_platform_set '';; 1) this_platform_set alpha_linux;; 2) this_platform_set alpha_osf20;; 3) this_platform_set alpha_osf32;; 4) this_platform_set amiweb;; 5) this_platform_set hppa11_hpux905;; 6) this_platform_set hppa11_hpux1020;; 7) this_platform_set hppa11_hpux1020;; 8) this_platform_set hppa11_hpux1020;; 9) this_platform_set i386_linux;; A) this_platform_set i586_freebsd22;; B) this_platform_set i686_linux;; C) this_platform_set mab_nextstep3;; D) this_platform_set mips_irix405;; E) this_platform_set mips_irix52;; F) this_platform_set mips_irix53;; G) this_platform_set mips_irix63;; H) this_platform_set mips_irix64;; I) this_platform_set mips_ultrix44;; J) this_platform_set rs6000_aix32;; K) this_platform_set rs6000_aix325;; L) this_platform_set rs6000_aix411;; M) this_platform_set sunos4.1.3;; T) this_platform_set sparc_solaris25;; O) this_platform_set sparc_solaris24;; P) this_platform_set sparc_linux;; S) this_platform_set win32;; R) total_stat; return;; Q) exit_on_confirm;; esac done } menu_systems_LINUX() { while true; do cls textvar_show screen_LINUX; echo case `getopt N1234RQ 'Select the platform you are currently on'` in N) this_platform_set '';; 1) this_platform_set i386_linux;; 3) this_platform_set m68k_linux;; 4) this_platform_set m68k_linuxoldld;; R) return;; Q) exit_on_confirm;; esac done } menu_system_screen() { while true; do cls textvar_show system_screen; echo case `getopt 12345RQ 'Select the platform you are currently on'` in 1) this_platform_set $platform_BSD_1;; 2) this_platform_set $platform_BSD_2;; 3) this_platform_set $platform_BSD_3;; 4) this_platform_set $platform_BSD_4;; 5) this_platform_set $platform_BSD_5;; R) return;; Q) exit_on_confirm;; esac done } menu_systems_BSD() { while true; do cls textvar_show screen_BSD; echo case `getopt N12345RQ 'Select the platform you are currently on'` in N) this_platform_set '';; 1) this_platform_set $platform_BSD_1;; 2) this_platform_set $platform_BSD_2;; 3) this_platform_set $platform_BSD_3;; 4) this_platform_set $platform_BSD_4;; 5) this_platform_set $platform_BSD_5;; R) return;; Q) exit_on_confirm;; esac done } menu_series_customize() { while true; do cls textvar_show screen_customize; echo case `getopt 123456789NBEAXYWZRQ 'Enter command to modify current selection'` in 1) series_customize ams;; 2) series_customize bibtex;; 3) series_customize doc;; 4) series_customize dvips;; 5) series_customize fonts;; 6) series_customize formats;; 7) series_customize generic;; 8) series_customize graphics;; 9) series_customize lang;; X) series_customize latex;; Y) series_customize plain;; W) series_customize metapost;; Z) series_customize texlive;; N) series_allnone;; B) series_allbase;; E) series_allrec;; A) series_allall;; R) return;; Q) exit_on_confirm;; esac done } menu_directories() { while true; do cls textvar_show screen_2; echo case `getopt 1RQ 'Enter command'` in 1) gets TEXDIR; TEXDIR=`dirname "$TEXDIR/x" | sed 's@//*@/@g'` TEXMF=`echo $TEXDIR/share/texmf | sed 's@//*@/@g'`;; R) return;; Q) exit_on_confirm;; esac done } menu_options() { while true; do cls textvar_show screen_3; echo case `getopt ASRQ 'Enter command'` in A) toggle opt_varfonts if test "$opt_varfonts" = X; then cls; textvar_show screen_3; echo opt_varfonts_dir=$opt_varfonts_dir_last test -z "$opt_varfonts_dir" && opt_varfonts_dir=/var/tmp/texfonts gets opt_varfonts_dir 'alternate directory' else opt_varfonts_dir_last=$opt_varfonts_dir opt_varfonts_dir='' fi ;; S) toggle opt_symlinks if test "$opt_symlinks" = X; then cls; textvar_show screen_3; echo opt_symlinks_bin=$opt_symlinks_bin_last test -z "$opt_symlinks_bin" && opt_symlinks_bin=/usr/local/bin gets opt_symlinks_bin 'binary directory' opt_symlinks_man=$opt_symlinks_man_last test -z "$opt_symlinks_man" && opt_symlinks_man=`dirname $opt_symlinks_bin`/man gets opt_symlinks_man 'man directory ' opt_symlinks_info=$opt_symlinks_info_last test -z "$opt_symlinks_info" && opt_symlinks_info=`dirname $opt_symlinks_bin`/info gets opt_symlinks_info 'info directory ' else opt_symlinks_bin_last=$opt_symlinks_bin opt_symlinks_man_last=$opt_symlinks_man opt_symlinks_info_last=$opt_symlinks_info opt_symlinks_bin=''; opt_symlinks_man=''; opt_symlinks_info='' fi ;; R) return;; Q) exit_on_confirm;; esac done } exit_on_confirm() { cls yesno 'Really quit' && exit } ################################################################ # global variables ################################################################ VERSION=2.0 # prefix in the archives: TEXDIR=${OVERRIDE_TEXDIR-/usr/local} TEXMF=$TEXDIR/share/texmf : ${PAGER=more} envvars=' BIBINPUTS BSTINPUTS DVIPSHEADERS GFFONTS GLYPHFONTS MFBASES MFINPUTS MFPOOL PKFONTS TEXCONFIG TEXFONTS TEXFORMATS TEXINPUTS TEXMFCNF TEXPICTS TEXPKS TEXPOOL TFMFONTS VFFONTS DVIPSFONTS XDVIVFS XDVIFONTS DVILJFONTS ' opt_varfonts=' ' opt_varfonts_dir='' opt_varfonts_dir_last='' opt_symlinks=' ' opt_symlinks_bin='' opt_symlinks_man='' opt_symlinks_info='' opt_symlinks_bin_last='' opt_symlinks_man_last='' opt_symlinks_info_last='' this_platform= ################################################################ # screens: ################################################################ screen_1=' ===================> TeX Live installation procedure <================== ===> Note: Letters/digits in brackets indicate menu items <=== ===> for commands or configurable options <=== Detected system: $this_platform_n collections: $all_series_ns out of $all_series_anz, disk space required: $all_series_dus kB systems: $all_systems_ns out of $all_systems_anz, disk space required: $all_systems_dus kB total disk space required: $total_dus kB directories: TEXDIR = $TEXDIR options: [$opt_varfonts] alternate directory for automatically generated fonts [$opt_symlinks] create symlinks in standard directories Other commands: start installation, help, quit ' screen_2='Current directories setup: ============================================================================== <1> TEXDIR: $TEXDIR support tree: $TEXMF Other options: ============================================================================== return to main menu quit ' screen_3='Current options setup: ============================================================================== alternate directory for automatically generated fonts: [$opt_varfonts] directory name: $opt_varfonts_dir create symlinks in standard directories: [$opt_symlinks] binaries to: $opt_symlinks_bin manpages to: $opt_symlinks_man info to: $opt_symlinks_info Other options: ============================================================================== return to main menu quit ' # NEW PLATFORM: change the screen: screen_5='Current platform: $this_platform_n ============================================================================== none of the entries below <1> $p_alpha_osf20_n <2> $p_alpha_osf32_n <3> $p_hppa11_hpux905_n <4> NetBDS/FreeBSD/BSDI ... <5> Linux (Intel, 68k) ... <6> NEXTstep 3 (68k) <7> $p_mips_irix52_n <8> $p_mips_irix53_n <9> $p_mips_ultrix44_n $p_rs6000_aix32_n $p_rs6000_aix411_n $p_sparc_solaris24_n $p_sparc_solaris25_n $p_sparc_sunos413_n ============================================================================== return to main menu quit ' screen_LINUX='Current platform: $this_platform_n ============================================================================== none of the entries below <1> $p_i386_linux_n <2> $p_m68k_linux_n ============================================================================== return to platform menu quit ' screen_BSD='Current platform: $this_platform_n ============================================================================== none of the entries below <1> $p_i386_bsdi20_n <2> $p_i386_netbsd10_n <3> $p_i386_netbsd11_n <4> $p_i386_freebsd205_n <5> $p_i386_freebsd210_n ============================================================================== return to platform menu quit ' one_collection='Collection: $name ============================================================================== $help ============================================================================== no packages basic packages [$size1 kB] basic + recommended packages [$size2 kB] all packages [$size3 kB] ============================================================================== return to collection menu quit ' screen_6='TeX Live can be used on multiple systems as a separate subdirectory is used for each installed binary package in $TEXDIR/bin.' screen_customize='Current collections setup: total size (including systems): $total_dus kB ============================================================================== name selection size <1> ams $p_ams_level ${p_ams_dus} kB <2> bibtex $p_bibtex_level ${p_bibtex_dus} kB <3> doc $p_doc_level ${p_doc_dus} kB <4> dvips $p_dvips_level ${p_dvips_dus} kB <5> fonts $p_fonts_level ${p_fonts_dus} kB <6> formats $p_formats_level ${p_formats_dus} kB <7> generic $p_generic_level ${p_generic_dus} kB <8> graphics $p_graphics_level ${p_graphics_dus} kB <9> lang $p_lang_level ${p_lang_dus} kB metapost $p_metapost_level ${p_metapost_dus} kB latex $p_latex_level ${p_latex_dus} kB plain $p_plain_level ${p_plain_dus} kB texlive $p_texlive_level ${p_texlive_dus} kB SUM: ${all_series_dus} kB ============================================================================== global commands: select one / asic / rcommended / ll for all collections return to platform menu quit ' system_screen='System setup section ============================================================================== Current selection: $all_systems_ns out of $all_systems_anz, disk space required: $all_systems_dus kB ============================================================================== return to platform menu quit ' help_1=' This is the installation program of the TeX Live CD distribution. The installation procedure is really simple: just go through the menus and select "start installation" if all options are set up all right. To select a menu item (a letter or a number marked with brackets) just enter the corresponding letter or number and press return (the letters are case insensitive). Right now, each menu item is explained in detail: ====================================================================== The collections menu () ====================================================================== The collections menu allows you to select and deselect collections. Each collection consists of several packages. The packages of each collection are tagged basic, recommended or other. ====================================================================== The directories menu () ====================================================================== The TeX Live distribution will be installed in a single directory tree (TEXDIR). You may choose any directory you like since there are no absolute paths compiled into the binaries. Instead, the Kpathsea library selfdir feature ensures that all paths are relative to the location of the binaries. The platform independent files are stored in a directory tree in TEXDIR/share/texmf ====================================================================== The options menu () ====================================================================== The options are optionals part of the installation, as they are not always applicable or useful. "alternate directory": ====================== If you choose an alternate directory for automatically generated fonts, you can mount your TEXMF tree read-only (as long as you do not want to perform administrative tasks: change configuration, install new inputs and the like). There are two good reasons to do this: - TEXMF is in your /usr partition and you want to mount it read-only (or in another partition that you mount read-only) - TEXMF will be accessable via NFS and you do not want to give write permissions to your NFS clients If the second case applies to you, please note that the filename database (ls-R) and the automatically generated fonts will be installed in the alternate directory you choose. If this directory is local to each client, you need to run texhash on each machine to build the filename database there. Another disadvantage is that new fonts are not shared in that case. "symlinks in standard directories" ================================== To make your binaries, manpages and infopages available to your system, there are two common ways: 1) install them in "standard places" that are searched for these files 2) change your search paths to include the new directories If you select the "symlinks" option, symbolic links will be installed in the directories you choose. Note that if you share the TeX Live installation accross several machines via NFS and if the chosen "standard places" are not shared, you need to create the symbolic links on each client, too (or use method 2 on your clients). If you do not use the "symlinks" option, you propably need to set up your search paths (PATH, MANPATH, INFOPATH). ====================================================================== Other commands (, and ====================================================================== Well, this is easy to explain: starts the installation after you are confident with the setup displays this help quits the installation program ' init() { $debug && set -x locate_binaries bad_sh find_echo find_tar series_init } ################################################################ # main() ################################################################ init menu_main