wok diff get-texlive/stuff/get-texlive @ rev 2829

add get-texlive
author Pierre-Jean Fichet <sygne@ombres.eu>
date Thu Apr 30 10:06:33 2009 +0000 (2009-04-30)
parents
children aaea09f5ebb3
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/get-texlive/stuff/get-texlive	Thu Apr 30 10:06:33 2009 +0000
     1.3 @@ -0,0 +1,141 @@
     1.4 +#!/bin/sh
     1.5 +# download, pack and install a minimal texlive scheme.
     1.6 +
     1.7 +PACKAGE="texlive"
     1.8 +VERSION="2008"
     1.9 +CATEGORY="office"
    1.10 +SHORT_DESC="latex text processor"
    1.11 +MAINTAINER="sygne@ombres.eu"
    1.12 +DEPENDS="wget perl openssl"
    1.13 +SOURCE="install-tl"
    1.14 +TARBALL="$SOURCE-unx.tar.gz"
    1.15 +WEB_SITE="http://www.tug.org/$PACKAGE/"
    1.16 +WGET_URL="http://mirror.ctan.org/systems/$PACKAGE/tlnet/$VERSION/$TARBALL"
    1.17 +ROOT="$1"
    1.18 +
    1.19 + Check if we are root
    1.20 +if test $(id -u) != 0 ; then
    1.21 +        echo -e "\nYou must be root to run `basename $0`."
    1.22 +	echo -e "Please use 'su' and root password to become super-user.\n"
    1.23 +	exit 0
    1.24 +fi
    1.25 +
    1.26 + Avoid reinstall
    1.27 +if [ -d $ROOT/var/lib/tazpkg/installed/$PACKAGE ]; then
    1.28 +	echo -e "\n$PKG package is already installed.\n"
    1.29 +	exit 0
    1.30 +fi
    1.31 +
    1.32 +# We need softwares.
    1.33 +for pkg in $DEPENDS
    1.34 +do
    1.35 +        if [ ! -d /var/lib/tazpkg/installed/$pkg ]; then
    1.36 +		tazpkg get-install $pkg
    1.37 +	fi
    1.38 +done
    1.39 +
    1.40 +
    1.41 +# Make working directory
    1.42 +TMP=/tmp/$(basename $0)$$
    1.43 +mkdir -p $TMP
    1.44 +TOP=$PWD
    1.45 +cd $TMP
    1.46 +
    1.47 +# Get files
    1.48 +echo -e "\033[1;33m Getting $PACKAGE install script\033[0m"
    1.49 +wget $WGET_URL
    1.50 +tar -xzf $TARBALL
    1.51 +
    1.52 +
    1.53 +# launch texlive install script
    1.54 +echo -e "\033[1;33m Launching $PACKAGE install script\033[0m" 
    1.55 +cd $SOURCE
    1.56 +PREFIX="$TMP/$SOURCE/$PACKAGE-$VERSION/fs/usr/local/$PACKAGE"
    1.57 +mkdir -p $PREFIX
    1.58 +
    1.59 +cat > slitaz.profile <<EOT
    1.60 +# slitaz profile for texlive
    1.61 +# we only want the minimum
    1.62 +
    1.63 +selected_scheme scheme-minimal
    1.64 +TEXDIR $PREFIX/$VERSION
    1.65 +TEXDIRW $PREFIX/$VERSION
    1.66 +TEXMFHOME ~/.texmf
    1.67 +TEXMFLOCAL $PREFIX/texmf-local
    1.68 +TEXMFSYSCONFIG $PREFIX/$VERSION/texmf-config
    1.69 +TEXMFSYSVAR $PREFIX/$VERSION/texmf-var
    1.70 +collection-basic 1
    1.71 +option_doc 0
    1.72 +option_fmt 1
    1.73 +option_letter 0
    1.74 +option_src 0
    1.75 +option_symlinks 0
    1.76 +EOT
    1.77 +
    1.78 +# some mirrors are too slow, if so, add this option:
    1.79 +# 	-location ftp://ftp.inria.fr/pub/TeX/CTAN/systems/texlive/tlnet/2008/
    1.80 +./install-tl -profile slitaz.profile
    1.81 +
    1.82 +
    1.83 +# Creat receipt
    1.84 +cat > $PACKAGE-$VERSION/receipt <<EOT
    1.85 +# SliTaz package receipt.
    1.86 +
    1.87 +PACKAGE="$PACKAGE"
    1.88 +VERSION="$VERSION"
    1.89 +CATEGORY="$CATEGORY"
    1.90 +SHORT_DESC="$SHORT_DESC"
    1.91 +DEPENDS="$DEPENDS"
    1.92 +WEB_SITE="$WEB_SITE"
    1.93 +
    1.94 +post_install()
    1.95 +{
    1.96 +	# add texlive dir to PATH.
    1.97 +	if ! grep -q "/usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/" /etc/profile
    1.98 +		then
    1.99 +		echo "adding /usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/ to PATH"
   1.100 +		cp /etc/profile /etc/profile.old
   1.101 +		sed "/^PATH=\"/ aPATH=\"/usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/:\\\$PATH\"" \
   1.102 +/etc/profile >> profile
   1.103 +		mv profile /etc/profile
   1.104 +	fi
   1.105 +
   1.106 +	echo -e "
   1.107 +
   1.108 +\033[1;33m - A texlive minimal scheme is now installed - \033[0m
   1.109 +
   1.110 +Verify that \033[1mPATH\033[0m is well formatted in /etc/profile,
   1.111 +and contain \033[1m/usr/local/\$PACKAGE/\$VERSION/bin/i386-linux/\033[0m
   1.112 +
   1.113 +To improve texlive, run \033[1mtlmgr\033[0m as root.
   1.114 +If you prefer graphicals interfaces, install perl-tk,
   1.115 +and run\033[1m tlmgr gui\033[0m.
   1.116 +
   1.117 +The tlmgr man page can be found here:
   1.118 +http://tug.org/texlive/doc/tlmgr.html
   1.119 +"
   1.120 +}
   1.121 +EOT
   1.122 +
   1.123 +
   1.124 +# Pack
   1.125 +tazpkg pack $PACKAGE-$VERSION
   1.126 +
   1.127 +
   1.128 +CONFIRM="y"
   1.129 +if [ -z "$ROOT" ]; then
   1.130 +	echo "Unpacked size: 34M"
   1.131 +	echo -e -n "\nPlease confirm installation of $PACKAGE-$VERSION (y/N): "
   1.132 +	read CONFIRM
   1.133 +fi
   1.134 +if [ $CONFIRM = "y" ]
   1.135 +	then
   1.136 +	# Install pseudo package
   1.137 +	tazpkg install $PACKAGE-$VERSION.tazpkg --root=$ROOT
   1.138 +fi
   1.139 +
   1.140 +# Clean
   1.141 +cd $TOP
   1.142 +rm -rf $TMP
   1.143 +
   1.144 +exit 0