wok view get-texlive/stuff/get-texlive @ rev 1713

get-*: add ROOT support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Mon Nov 17 08:50:02 2008 +0000 (2008-11-17)
parents 1a142d2dd64e
children
line source
1 #!/bin/sh
2 # download, pack and install a minimal texlive scheme.
4 PACKAGE="texlive"
5 VERSION="2008"
6 CATEGORY="office"
7 SHORT_DESC="latex text processor"
8 MAINTAINER="sygne@ombres.eu"
9 DEPENDS="wget perl openssl"
10 SOURCE="install-tl"
11 TARBALL="$SOURCE-unx.tar.gz"
12 WEB_SITE="http://www.tug.org/$PACKAGE/"
13 WGET_URL="http://mirror.ctan.org/systems/$PACKAGE/tlnet/$VERSION/$TARBALL"
14 ROOT="$1"
16 # Check if we are root
17 if test $(id -u) != 0 ; then
18 echo -e "\nYou must be root to run `basename $0`."
19 echo -e "Please use 'su' and root password to become super-user.\n"
20 exit 0
21 fi
23 # Avoid reinstall
24 if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
25 echo -e "\n$PKG package is already installed.\n"
26 exit 0
27 fi
29 # We need softwares.
30 for pkg in $DEPENDS
31 do
32 if [ ! -d /var/lib/tazpkg/installed/$pkg ]; then
33 tazpkg get-install $pkg
34 fi
35 done
38 # Make working directory
39 TMP=/tmp/$(basename $0)$$
40 mkdir -p $TMP
41 TOP=$PWD
42 cd $TMP
44 # Get files
45 echo -e "\033[1;33m Getting $PACKAGE install script\033[0m"
46 wget $WGET_URL
47 tar -xzf $TARBALL
50 # launch texlive install script
51 echo -e "\033[1;33m Launching $PACKAGE install script\033[0m"
52 cd $SOURCE
53 PREFIX="$PACKAGE-$VERSION/fs/usr/local/$PACKAGE"
54 mkdir -p $PREFIX
56 cat > slitaz.profile <<EOT
57 # slitaz profile for texlive
58 # we only want the minimum
60 selected_scheme scheme-minimal
61 TEXDIR $PACKAGE-$VERSION/fs/usr/local/texlive/$VERSION
62 TEXDIRW $PACKAGE-$VERSION/fs/usr/local/texlive/$VERSION
63 TEXMFHOME ~/.texmf
64 TEXMFLOCAL $PACKAGE-$VERSION/fs/usr/local/texlive/texmf-local
65 TEXMFSYSCONFIG $PACKAGE-$VERSION/fs/usr/local/texlive/$VERSION/texmf-config
66 TEXMFSYSVAR $PACKAGE-$VERSION/fs/usr/local/texlive/$VERSION/texmf-var
67 collection-basic 1
68 option_doc 0
69 option_fmt 1
70 option_letter 0
71 option_src 0
72 option_symlinks 0
73 EOT
75 # some mirrors are too slow, if so, add this option:
76 # -location ftp://ftp.inria.fr/pub/TeX/CTAN/systems/texlive/tlnet/2008/
77 ./install-tl -profile slitaz.profile
80 # Creat receipt
81 cat > $PACKAGE-$VERSION/receipt <<EOT
82 # SliTaz package receipt.
84 PACKAGE="$PACKAGE"
85 VERSION="$VERSION"
86 CATEGORY="$CATEGORY"
87 SHORT_DESC="$SHORT_DESC"
88 DEPENDS="$DEPENDS"
89 WEB_SITE="$WEB_SITE"
91 post_install()
92 {
93 # add texlive dir to PATH.
94 if ! grep -q "/usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/" /etc/profile
95 then
96 echo "adding /usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/ to PATH"
97 cp /etc/profile /etc/profile.old
98 sed "/^PATH=\"/ aPATH=\"/usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/:\\\$PATH\"" \
99 /etc/profile >> profile
100 mv profile /etc/profile
101 fi
103 echo -e "
105 \033[1;33m - A texlive minimal scheme is now installed - \033[0m
107 Verify that \033[1mPATH\033[0m is well formatted in /etc/profile,
108 and contain \033[1m/usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/\033[0m
110 To improve texlive, run \033[1mtlmgr\033[0m as root.
111 If you prefer graphicals interfaces, install perl-tk,
112 and run\033[1m tlmgr gui\033[0m.
114 The tlmgr man page can be found here:
115 http://tug.org/texlive/doc/tlmgr.html
116 "
117 }
118 EOT
121 # Pack
122 tazpkg pack $PACKAGE-$VERSION
125 CONFIRM="y"
126 if [ -z "$ROOT" ]; then
127 echo -n "\nPlease confirm installation of $PACKAGE-$VERSION (y/N): "
128 read CONFIRM
129 fi
130 if [ $CONFIRM = "y" ]
131 then
132 # Install pseudo package
133 tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
134 fi
136 # Clean
137 cd $TOP
138 rm -rf $TMP
140 exit 0