A script to automate the installation of TeXLive 2010 on Ubuntu
#******************************************************
2010年 11月 20日 土曜日 19:08:00 CET
– Several improvements thanks to Cédrik Copol
among them, translation in french, function for
test password, etc
– Fixed some problems
– I suggest to use Vim to benefit from folding and
thus to get a clarified file
#*******************************************************
2010年 11月 11日 木曜日 12:52:53 CET
Improvements for several things, passwords are
now hidden.
#*****************************************************
2010年 11月 06日 土曜日 00:00:00 CEST
Script improved thanks to Matthew Mower.
#*****************************************************
several updates, among them :
– choice between opensuse and ubuntu available
– choice between i386 and x64 installation process
– improved some parts
#*****************************************************
#3rd update, 2010/10/16 1:27 pm
#improved choice dialog box, now it is easier
#to select install or update, no need to write
#it. Replaced also if else statement by case.
#improved update process
#*****************************************************
#2nd update, 2010/10/15 08:33pm
#improved the script with just a small “trick”
#(nothing smart at all, just a simple modification)
#to enable the user not to enter the date
#*****************************************************
#*****************************************************
#Updated the post on 2010/10/14, 07:22
#corrected html code to unable correct copy-
#paste in a text editor: code instead of
#blockquote, and added some other
#features to the script to make it easier
#to use
#*****************************************************
Recently I had to install several times TeXLive 2010 on different computers. Also, I have friends who do not feel comfortable with command line and don’t want to install the last version of TeXLive for this reason. Consequently, I have written a small script to automate the task and to allow others to easily install TeXlive 2010 (or at least, I hope it will be more easy with this script).
Also, this script has been written for Ubuntu users, but if you use another operating system, you might be used to command line. So if you use for example Archlinux, replace “apt-get install” by “pacman -S”.
TO USE THIS SCRIPT you have 2 choices :
- download it from here.
- The second way is to copy the script in your text editor, let say gedit. Press Alt+F2, and in the prompt, enter gedit. Then, copy the following :
#=======================================================================
# FILE: install_update_texlive.sh
# USAGE: Run from the terminal
# DESCRIPTION: Automatic install/update of TeXLive 2010
# OPTIONS: —
# REQUIREMENTS: Ubuntu or OpenSuse
# BUGS: —
# NOTES: Website: https://alexkrispin.wordpress.com/
# AUTHORS: Alexandre Krispin, k.m.alexandre@gmail.com, Matthew D. Mower, Cédrick Copol
# COMPANY: —
# CREATED: 2010 Oct 11, 20:25:43 UTC
# REVISION: 2010年 11月 20日 土曜日 19:06:34 CET
#=======================================================================
#! /bin/bashsudo -k
#-------------------------------------------------------------------------------
# Translations
#-------------------------------------------------------------------------------
#{{{
echo $LANG | grep -i fr;
if [ "$?" == "0" ]; then#La langue est le français {{{
SELECT="Sélectionnez"
CHOISE="Choix"IN_UP_TITLE="Installation ou mise à jour"
IN_UP_TEXT="Souhaitez-vous faire une (ré)installation ou une mise à jour ?"
IN_UP_TRUE="Installation"
IN_UP_FALS="Mise à jour"
DISC_TITLE="Espace disque"
DISC_TEXT="Une installation complète nécessite ~2,3GB d'espace libre. Appuyer sur Oui pour continuer ou Non pour quitter."
PASSWD_TITLE="Mot de passe"
PASSWD_TEXT="Votre mot de passe est nécessaire pour continuer."
BAD_PASSWD_TITLE="Mot de passe invalide"
BAD_PASSWD_TEXT="Mot de passe invalide. Veuillez recomposer celui-ci :"
EXIT_BAD_PASSWD="Désolé 3 mauvais mot de passe donné.\n$0 va se fermer."
INFO_TEXT="L'installation va commencer et une fenêtre s'ouvrira. Pour exemple voir\nhttp://www.tug.org/texlive/doc/texlive-common/install-lnx-main.png\n\nVérifiez la taille du papier (A4 en général) puis cliquer sur 'Install TeX Live' pour continuer. (Notez que ce script ne fonctionne correctement qu'avec le dossier d'installation par défaut de TeX Live)"
INFO_TITLE="Dernière notification avant installation"
FILE_TITLE="Fichiers d'installation"
FILE_TEXT="Voulez-vous conserver les fichiers d'installation téléchargés ? (Ils ne sont pas nécessaire au fonctionnement de TeX Live)"
FONT_TITLE="Remarque informative"
FONT_TEXT="Les fontes vont maintenant être installées."
IN_END_TITLE="Installation terminée"
IN_END_TEXT="L'installation est terminée. Vous pouvez périodiquement relancer ce script plus tard afin de mettre à jour votre distribution. Pour appliquer les modifications veuillez fermer votre session puis la réouvrir."
UP_END_TITLE="Mise à jour terminé"
UP_END_TEXT="TeXlive a été mis à jour."
#}}}
else
# Default language is English {{{
SELECT="Select"
CHOISE="Choice"IN_UP_TITLE="Install or update"
IN_UP_TEXT="New install or update?"
IN_UP_TRUE="Install"
IN_UP_FALS="Update"
DISC_TITLE="Disc space"
DISC_TEXT="A full installation requires ~2.3GB of
disc space. Press Yes to preceed or No to halt"
PASSWD_TITLE="Password"
PASSWD_TEXT="Your password is needed to continue:"
BAD_PASSWD_TITLE="Invalid password"
BAD_PASSWD_TEXT="Invalid password. Please re-enter a sudo capable password:"
EXIT_BAD_PASSWD="Sorry 3 incorrect password attempts.\n $0 will be closed"
INFO_TEXT="The installation process will begin and a window will appear. See here for an example:\nhttp://www.tug.org/texlive/doc/texlive-common/install-lnx-main.png\n\nCheck that paper size is correct. Then click 'Install TeX Live' to continue. (Note that this script is hard coded to work only with the default installation directory)"
INFO_TITLE="Last notification before installation"
FILE_TITLE="Install files"
FILE_TEXT="Would you like to keep the downloaded installation files? (They are not necessary to use TeXLive)"
FONT_TITLE="Information notice"
FONT_TEXT="Now fonts will be configured."
IN_END_TITLE="Installation finished"
IN_END_TEXT="Installation finished. You can periodically run this script at later dates to update your distribution. In order for environment variables to be set, you still need to log out and log back in"
UP_END_TITLE="Update finished"
UP_END_TEXT="TeXlive has been updated."
fi
#}}}
#}}}#=== FUNCTION ================================================================
# NAME: ask_passwd
# DESCRIPTION: ask the password, and stop if there is more than 3 errors
# PARAMETERS:
# RETURNS:
#===============================================================================
# {{{
ask_passwd()
{
PASSWORD=`zenity --title='$PASSWD_TITLE' --text="$PASSWD_TEXT" --hide-text --entry`
if [ "$?" -eq "1" ] ; then
exit
fi
# Count of the times you try to enter the password
nb_inputpwd=1
echo $PASSWORD | sudo -S echo -e '\nPassword test.'
while [ "$?" -eq "1" ]; do
# Only 3 errors are authorized
if [ "$nb_inputpwd" -eq "3" ]; then
zenity --title='$BAD_PASSWD_TITLE' --text="$EXIT_BAD_PASSWD" --error
exit
else
PASSWORD=`zenity --title='$BAD_PASSWD_TITLE' --text="$BAD_PASSWD_TEXT" --hide-text --entry`
if [ "$?" -eq "1" ]; then
exit
fi
# Incrementation
nb_inputpwd=$(( nb_inputpwd+1 ))
echo $PASSWORD | sudo -S echo -e '\nPassword test.'
fi
done
}
#}}}#-------------------------------------------------------------------------------
# Select platform automatically, i386 or x64 {{{
#-------------------------------------------------------------------------------
PLATFORM=`uname -m`
case "$PLATFORM" in
i386 | i486 | i586 | i686 | k7) BITTAG="i386-linux";;
x86_64 | EM64T) BITTAG="x86_64-linux";;
*)echo -e "$BAD_PLAT_TEXT" | zenity --title="$BAD_PLAT_TITLE" --text-info --width 500 --height 200;exit;;
esac
#}}}#-------------------------------------------------------------------------------
# Install or Update choice {{{
#-------------------------------------------------------------------------------
INSTALL_OR_UPDATE=$(zenity --title="$IN_UP_TITLE" --text="$IN_UP_TEXT" --list --radiolist --column "$SELECT" --column "$CHOISE" true "$IN_UP_TRUE" false "$IN_UP_FALS")
if [ "$?" -eq "1" ]
then
exit;
fi
#}}}
#-------------------------------------------------------------------------------
# Case Install {{{
#-------------------------------------------------------------------------------
case "$INSTALL_OR_UPDATE" in
"$IN_UP_TRUE")#-------------------------------------------------------------------------------
# Select OS {{{
#-------------------------------------------------------------------------------OS=$(zenity --title="Your OS"\
--text="Choose your OS:"\
--list\
--radiolist\
--column "Select"\
--column "Choice"\
true "Ubuntu"\
false "ArchLinux"\
false "OpenSuse")
if [ "$?" -eq "1" ]
then
exit;
fi
#}}}#-------------------------------------------------------------------------------
# Installing a package for the official install script of TeXLive 2010 {{{
#-------------------------------------------------------------------------------
case "$OS" in
"Ubuntu") PKGMGR_PERL="apt-get install perl-tk";;
"SUSE LINUX") PKGMGR_PERL="zypper perl-Tk";;
"ArchLinux") PKGMGR_PERL="pacman -S perl-tk";;
*) echo -e "$BAD_OS_TEXT" | zenity --title="$BAD_OS_TITLE" --text-info --width 500 --height 200;exit;;
esac
#}}}zenity --question --title="$DISC_TITLE" --text="$DISC_TEXT"
if [ "$?" -eq "1" ]
then
exit;
fiSTARTDIR=$(pwd)
ask_passwd
echo $PASSWORD | sudo -S $PKGMGR_PERL
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xf install-tl-unx.tar.gzecho -e "$INFO_TEXT" | zenity --title="$INFO_TITLE" --text-info --width 550 --height 200
cd $STARTDIR/install-tl-2*
echo $PASSWORD | sudo -S ./install-tl -guicd $STARTDIR
zenity --question --title="$FILE_TITLE" --text="$FILE_TEXT"
if [ "$?" -eq "1" ]
then
rm -rf install-tl*
fiecho -e "\nPATH=/usr/local/texlive/2010/bin/$BITTAG:\$PATH; export PATH\nMANPATH=/usr/local/texlive/2010/texmf/doc/man:\$MANPATH; export MANPATH\nINFOPATH=/usr/local/texlive/2010/texmf/doc/info:\$INFOPATH; export INFOPATH\n" >> ~/.profile
zenity --info --title="$FONT_TITLE" --text="$FONT_TEXT"
echo $PASSWORD | sudo -S cp /usr/local/texlive/2010/texmf-var/fonts/conf/texlive-fontconfig.conf /etc/fonts/conf.d/09-texlive.conf
echo $PASSWORD | sudo -S fc-cache -fsvzenity --info title="$IN_END_TITLE" --text="$IN_END_TEXT"
;;
esac
#}}}#-------------------------------------------------------------------------------
# Case Update {{{
#-------------------------------------------------------------------------------
case "$INSTALL_OR_UPDATE" in
"$IN_UP_FALS")ask_passwd
echo $PASSWORD | sudo -S /usr/local/texlive/2010/bin/$BITTAG/tlmgr update --self
echo $PASSWORD | sudo -S /usr/local/texlive/2010/bin/$BITTAG/tlmgr update --all
zenity --info --title="$UP_END_TITLE" --text="$UP_END_TEXT";;
esac
#}}}exit
#}}}
Save the file in your home directory under the name install_update_tex, and open a terminal (press Ctrl+Alt+t). Then, copy-paste the following in the terminal :
chmod +x install_update_tex
./install_update_tex
Save it in your home directory, and open a terminal (press Ctrl+Alt+t). Then, copy-paste the following in the terminal :
chmod +x install_update_tex
./install_update_tex
And follow the instructions. If you have any problem, let a comment (it has only been tested on my computer at the moment).
If you have any problem, comments are welcome.
UPDATE OF THE POST, 03/05/2011 :
With the update of this post we will see, first, how to overide the installation of TeXlive 2009 for the packages which have TeXlive 2009 as a dependency, and secondly, we will see how to use an external repository to make an update (let say, for example, to have the latest luatex engine) :
- With Ubuntu, to disable unwanted texlive-* packages to be installed, you have to open a Terminal (press Alt+F2, and in the newly opened window, enter gnome-terminal) and then copy-past the following :
sudo apt-get install equivs
mkdir ~/tmp
cd !$
equivs-control texlive-localThen, open the file created in the tmp directory with, let say Gedit (press Alt+F2 and enter gedit in the prompt), and copy in this file the following :
Section: misc
Priority: optional
Standards-Version: 3.6.2Package: texlive-local
Version: 2008-1
Maintainer: MPG
Provides: cm-super, cm-super-minimal, context, latex-beamer,
latex-cjk-all, latex-cjk-chinese, latex-cjk-chinese-arphic-bkai00mp,
latex-cjk-chinese-arphic-bsmi00lp, latex-cjk-chinese-arphic-gbsn00lp,
latex-cjk-chinese-arphic-gkai00mp, latex-cjk-common, latex-cjk-japanese,
latex-cjk-japanese-wadalab, latex-cjk-korean, latex-cjk-thai,
latex-sanskrit, latex-xcolor, lmodern, luatex, musixtex, pgf, prosper,
tex4ht, tex4ht-common, texinfo, texlive-base, texlive-base-bin,
texlive-base-bin-doc, texlive-bibtex-extra, texlive-common,
texlive-doc-base, texlive-doc-bg, texlive-doc-cs+sk, texlive-doc-de,
texlive-doc-el, texlive-doc-en, texlive-doc-es, texlive-doc-fi,
texlive-doc-fr, texlive-doc-it, texlive-doc-ja, texlive-doc-ko,
texlive-doc-mn, texlive-doc-nl, texlive-doc-pl, texlive-doc-pt,
texlive-doc-ru, texlive-doc-th, texlive-doc-tr, texlive-doc-uk,
texlive-doc-vi, texlive-doc-zh, texlive-extra-utils, texlive-font-utils,
texlive-fonts-extra, texlive-fonts-extra-doc, texlive-fonts-recommended,
texlive-fonts-recommended-doc, texlive-formats-extra, texlive-full,
texlive-games, texlive-generic-extra, texlive-generic-recommended,
texlive-humanities, texlive-humanities-doc, texlive-lang-african,
texlive-lang-arab, texlive-lang-armenian, texlive-lang-croatian,
texlive-lang-cyrillic, texlive-lang-czechslovak, texlive-lang-danish,
texlive-lang-dutch, texlive-lang-finnish, texlive-lang-french,
texlive-lang-german, texlive-lang-greek, texlive-lang-hebrew,
texlive-lang-hungarian, texlive-lang-indic, texlive-lang-italian,
texlive-lang-latin, texlive-lang-manju, texlive-lang-mongolian,
texlive-lang-norwegian, texlive-lang-other, texlive-lang-polish,
texlive-lang-portuguese, texlive-lang-spanish, texlive-lang-swedish,
texlive-lang-tibetan, texlive-lang-ukenglish, texlive-lang-vietnamese,
texlive-latex-base, texlive-latex-base-doc, texlive-latex-extra,
texlive-latex-extra-doc, texlive-latex-recommended,
texlive-latex-recommended-doc, texlive-latex3, texlive-math-extra,
texlive-metapost, texlive-metapost-doc, texlive-music, texlive-omega,
texlive-pictures, texlive-pictures-doc, texlive-plain-extra,
texlive-pstricks, texlive-pstricks-doc, texlive-publishers,
texlive-publishers-doc, texlive-science, texlive-science-doc,
texlive-xetex, tipa,
Architecture: all
Description: Installation locale de TeX Live.
Installation locale d’une TeX Live nature complete.After saving the file, copy-paste the following in the terminal :
equivs-build texlive-local
sudo dpkg -i texlive-local_2008-1_all.debFrom now on, you will be able to install any package usually requiring TeXlive 2009 as a dependency without installing TeXlive 2009. This tip is from Manuel Pegourier-gonard, see his post for more details (in french), modified a little to make it work with Ubuntu 10.10 and earlier.
-
To install packages from TLContrib (for more details about it see the corresponding website), you will have to use the terminal (press alt+f2 and in the prompt write gnome-terminal and press enter) :
sudo /usr/local/texlive/2010/bin/i386-linux/tlmgr –gui
If your computer doesn’t use the i386 version of TeXLive, then do as follows :
sudo /usr/local/texlive/2010/bin/x86_64-linux/tlmgr –gui
In the window newly opened, select an other repository :
Then, enter the url :
And then, push the button to start the update :
Finally you will just have to wait until it finishes.
Good Work,very thx.You are best…
Ca marche parfaitement sans rien toucher de plus.
Merci de partager ton savoir