#!/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'}"; if (${II2INSTALLDIR} eq "") { warn "### ${PROGNAME}: ${II2INSTALLDIR} is empty. No TeX Foundation found.\n"; warn "### ${PROGNAME}: I cannot configure a nonexistent TeX. Bailing out gracefully...\n"; exit( 0); } 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); } if (not -d "${II2INSTALLDIR}/tex/latex") { warn "### ${PROGNAME}: No LaTeX found. Configuration cannot proceed.\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "TeX Programs Unavailable" -I "LaTeX is not available in this install location. I cannot proceed to configure. Bailing out gracefully..." -1 "OK"`; exit( 0); } # TeX hash + recreate print "### ${PROGNAME}: Configuring TeX to use new LaTeX. Please wait...\n"; system( "texhash \"$II2INSTALLDIR\" 3) { warn "### ${PROGNAME}. Executing: \"${cmd}\"\n"; } return system( ${cmd}); } sub setConfigUser { if (-e "${II2INSTALLGRANDPA}/bin/${arch}-apple-darwin-current/texconfig-sys") { if ($> == 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.configure 75 2006-10-27 19:45:14Z gctwnl $