#!/usr/bin/perl $II2PKGDIR = $ENV{"II2PKGDIR"}; $II2INSTALLDIR = $ENV{"II2INSTALLDIR"}; $II2RESOURCES = $ENV{"II2RESOURCES"}; $II2DOSERVER = $ENV{"II2DOSERVER"}; $II2BUILDSTAMP = $ENV{"II2BUILDSTAMP"}; if (${II2BUILDSTAMP} < 1167840304) { warn "### You need at least i-Installer 2.87 for this package. Bailing out...\n"; exit 1; } $PROGNAME = `"${II2RESOURCES}/basename" "$0"`; chomp( $PROGNAME); print "### ${PROGNAME}: Started...\n"; my $arch = `uname -p`; chomp $arch; $II2INSTALLGRANDPA = "$II2INSTALLDIR"; $II2INSTALLGRANDPA = `/usr/bin/dirname "$II2INSTALLGRANDPA"`; chomp( $II2INSTALLGRANDPA); $II2INSTALLGRANDPA = `/usr/bin/dirname "$II2INSTALLGRANDPA"`; chomp( $II2INSTALLGRANDPA); setConfigUser(); $ENV{"PATH"} = "${II2INSTALLGRANDPA}/bin/${arch}-apple-darwin-current:$ENV{'PATH'}"; $vartexmf=`${kpsewhichcmd} --expand-var=\'\$VARTEXMF\'`; chomp( $vartexmf); # teTeX-3.0 has these and we provide a mapping to make texconfig and friend # behave like texconfig-sys and friends so existing stuff in these # scripts keeps working: my $TEXMFVAR = "${vartexmf}"; $ENV{"TEXMFVAR"} = "${vartexmf}"; my $TEXMFCONFIG = "${vartexmf}"; $ENV{"TEXMFCONFIG"} = "${vartexmf}"; if (${II2INSTALLDIR} eq "" or not (-d "${II2INSTALLDIR}/tex/latex")) { print "### ${PROGNAME}: No LaTeX found.\n"; print "### ${PROGNAME}: I cannot remove a nonexistent LaTeX. Bailing out gracefully...\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "LaTeX Unavailable" -I "It seems there is no LaTeX in this location so I will not proceed to remove." -1 "OK"`; exit( 0); } if (not -w "${II2INSTALLDIR}") { warn "### ${PROGNAME}: LaTeX is not writable. Removal cannot proceed. Bailing out...\n"; exit( 1); } if (not -l "${II2INSTALLGRANDPA}/bin/${arch}-apple-darwin-current") { warn "### ${PROGNAME}: No TeX Programs found. Configuration cannot proceed.\n"; warn "### ${PROGNAME}: LaTeX update will be possible when both TeX Programs and TeX Foundation are available. Bailing out gracefully...\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "TeX Programs Unavailable" -I "LaTeX cannot be updated because the TeX Programs have not been installed yet. Only when both foundation and programs have been installed (in either order) will the configuration script proceeed." -1 "OK"`; exit( 0); } print "### ${PROGNAME}: Removing LaTeX from this location. Please wait...\n"; system( "/bin/rm -f \"${vartexmf}\"/web2c/latex.*fmt"); system( "/bin/rm -f \"${vartexmf}\"/web2c/pdflatex.*fmt"); system( "/bin/rm -rf \"${II2INSTALLDIR}/tex/latex/base\""); system( "/bin/rm -rf \"${II2INSTALLDIR}/tex/latex/graphics\""); system( "/bin/rm -rf \"${II2INSTALLDIR}/tex/latex/cyrillic\""); system( "/bin/rm -rf \"${II2INSTALLDIR}/tex/latex/tools\""); system( "/bin/rm -rf \"${II2INSTALLDIR}/doc/latex/base\""); system( "texhash \"${II2INSTALLDIR}\" == 0) { print "### ${PROGNAME}: System wide configuration, TL2005-style.\n"; ${configforuser} = 'root'; ${sudocmd} = "sudo -H -u ${configforuser}"; ${texconfigcmd} = "${sudocmd} texconfig-sys"; ${fmtutilcmd} = "${sudocmd} fmtutil-sys"; ${updmapcmd} = "${sudocmd} updmap-sys"; ${kpsewhichcmd} = "${sudocmd} kpsewhich"; } else { print "### ${PROGNAME}: Configuring system-wide for user $ENV{'II2USER'}, TL2005-style.\n"; ${configforuser} = $ENV{'II2USER'}; ${sudocmd} = "sudo -H -u ${configforuser}"; ${texconfigcmd} = "${sudocmd} texconfig-sys"; ${fmtutilcmd} = "${sudocmd} fmtutil-sys"; ${updmapcmd} = "${sudocmd} updmap-sys"; ${kpsewhichcmd} = "${sudocmd} kpsewhich"; } } else { if ($> == 0) { print "### ${PROGNAME}: System wide configuration, pre-TL2005-style.\n"; ${configforuser} = 'root'; ${sudocmd} = "sudo -H -u ${configforuser}"; ${texconfigcmd} = "${sudocmd} texconfig"; ${fmtutilcmd} = "${sudocmd} fmtutil"; ${updmapcmd} = "${sudocmd} updmap"; ${kpsewhichcmd} = "${sudocmd} kpsewhich"; } else { print "### ${PROGNAME}: Configuring system-wide for user $ENV{'II2USER'}, pre-TL2005-style.\n"; ${configforuser} = $ENV{'II2USER'}; ${sudocmd} = "sudo -H -u ${configforuser}"; ${texconfigcmd} = "${sudocmd} texconfig"; ${fmtutilcmd} = "${sudocmd} fmtutil"; ${updmapcmd} = "${sudocmd} updmap"; ${kpsewhichcmd} = "${sudocmd} kpsewhich"; } } } exit( 0); # $Id: latex-update.remove 75 2006-10-27 19:45:14Z gctwnl $