summaryrefslogtreecommitdiff
path: root/Master/tl-portable.sh
diff options
context:
space:
mode:
authorSiep Kroonenberg <siepo@cybercomm.nl>2008-03-20 09:31:09 +0000
committerSiep Kroonenberg <siepo@cybercomm.nl>2008-03-20 09:31:09 +0000
commitc261f817156842528b8326c5dbaeae8796786e27 (patch)
tree55f9e81e3bf664807c3deb03d259b3753a89ee91 /Master/tl-portable.sh
parent8d261289f336139d8cc257e9d4e6b2a3349abdf1 (diff)
Portable shell script, also affects install-tl.pl.
git-svn-id: svn://tug.org/texlive/trunk@7041 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/tl-portable.sh')
-rwxr-xr-xMaster/tl-portable.sh93
1 files changed, 93 insertions, 0 deletions
diff --git a/Master/tl-portable.sh b/Master/tl-portable.sh
new file mode 100755
index 00000000000..c9402d42e00
--- /dev/null
+++ b/Master/tl-portable.sh
@@ -0,0 +1,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