summaryrefslogtreecommitdiff
path: root/Master/tl-portable.sh
blob: c9402d42e0042541760d4c4b2f865d39ad9c582d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#! /bin/sh

#calculate TeXLive root
#it appears that dirname isn't always available
TEXDIR=$0
TEXDIR=${TEXDIR%/*}

dirsave=`pwd`
cd $TEXDIR
TEXDIR=`pwd`
export TEXDIR
cd $dirsave

# test whether the TeXLive directory is writable.

if test -w $TEXDIR; then
  tlwrite=$TEXDIR
else
  tlwrite=$HOME/.texlive2008
fi

# Use $TEXMFHOME for private data,
# $TEXMFLOCAL for department- or workgroup data.
# It is allright if $TEXMFLOCAL does not exist.

TEXMFSYSVAR=$tlwrite/texmf-var
if test -d $TEXDIR/texmf-var; then
  TEXMFSYSVAR=$TEXDIR/texmf-var
fi
export TEXMFSYSVAR
TEXMFSYSCONFIG=$tlwrite/texmf-config
if test -f $TEXDIR/texmf-config; then
  TEXMFSYSCONFIG=$TEXDIR/texmf-config
fi
export TEXMFSYSCONFIG
TEXMFMAIN=$TEXDIR/texmf
export TEXMFMAIN
TEXMFDIST=$TEXDIR/texmf-dist
export TEXMFDISTMAIN
TEXMFLOCAL=$TEXDIR/texmf-local
export TEXMFLOCAL
TEXMFHOME=$tlwrite/texmf-home
export TEXMFHOME
TEXMFVAR=$tlwrite/texmf-var
export TEXMFVAR
TEXMFCONFIG=$tlwrite/texmf-config
export TEXMFCONFIG

platform=`$TEXDIR/install-try.pl --print-arch`

if test "$platform" = ""; then
  echo 'Platform unsupported'
  exit 1
elif test ! -d $TEXDIR/bin/$platform; then
  echo 'Platform unsupported'
  exit 1
fi

$TEXDIR/install-try.pl --portable

#; try to block initialization scripts and
# set custom prompt for secondary shell
# but I know of no good way to do this for the C shell.

if test "$SHELL" = /bin/bash; then
  TLARGS=--norc
  PS1='TL $PWD\$ '
elif test "$SHELL" = /bin/zsh; then
  TLARGS=-f
  PS1='TL %d%% '
elif test "$SHELL" = /bin/csh; then
  TLARGS=-f
elif test "$SHELL" = /bin/tcsh; then
  TLARGS=-f
else
  TLARGS=""
  PS1='TL $PWD\$ '
fi
ENV=/dev/null
export ENV

PATH=$TEXDIR/bin/$platform:$PATH \
TEXMFSYSVAR=$TEXMFSYSVAR \
TEXMFSYSCONFIG=$TEXMFSYSCONFIG \
TEXMFMAIN=$TEXMFMAIN \
TEXMFDIST=$TEXMFDIST \
TEXMFLOCAL=$TEXMFLOCAL \
TEXMFHOME=$TEXMFHOME \
TEXMFVAR=$TEXMFVAR \
TEXMFCONFIG=$TEXMFCONFIG \
ENV=$ENV \
PS1=$PS1 \
$SHELL $TLARGS -i