#!/usr/bin/perl $II2BUILDSTAMP = $ENV{"II2BUILDSTAMP"}; $II2PKGDIR = $ENV{"II2PKGDIR"}; $II2INSTALLDIR = $ENV{"II2INSTALLDIR"}; $II2RESOURCES = $ENV{"II2RESOURCES"}; $II2DOSERVER = $ENV{"II2DOSERVER"}; # TL2005+ variables my $TEXMFVAR; my $TEXMFCONFIG; 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); my $arch = `uname -p`; chomp $arch; # warn $arch; print "### ${PROGNAME}: Started...\n"; # Load shared stuff require "${II2PKGDIR}/texlive.sharedscript.pm"; checkTeXEnvironmentVariables(); if (${II2INSTALLDIR} eq "") { ipkgwarn( "Your environment is damaged, your Mac OS X installation or your user account is probably damaged. Try running a disk repair program or install from another user's account. Bailing out...\n"); exit( 1); } if (not &checkinstallocation()) { die "### ${PROGNAME}: Bailing out on nonstandard location \"${II2INSTALLDIR}\"\n" } `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t IncrementProgress -p 50000`; my %set; my $displayString; $dosimpleinstall = 0; $dofullinstall = 0; $doresult = `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "Install type?" -I "You can choose to do a basic install, a full install or an expert install.\n\nThe expert install will give you a bit of choice in what to install (e.g. hyphenation patterns) and how to configure.\n\nThe full install will install everything. The basic install will install a basic set. Basic and full will make most configuration choices for you, if possible based on the configuration of your operating system and preferences." -1 "Basic" -2 "Expert" -3 "Full"`; chomp( $doresult); if (($? >> 8) == 0) { print "### ${PROGNAME}: Selected simple install.\n"; $dosimpleinstall = 1; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Environment -E "TEXIPKGSIMPLE=YES"`; } elsif (($? >> 8) == 2) { print "### ${PROGNAME}: Selected expert install.\n"; $dosimpleinstall = 0; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Environment -E "TEXIPKGSIMPLE=NO"`; } else { print "### ${PROGNAME}: Selected full install.\n"; $dosimpleinstall = 1; $dofullinstall = 1; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Environment -E "TEXIPKGSIMPLE=YES"`; } $tlversion = "tl2006"; # Currently only one version $expversion = ""; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Environment -E "TEXIPKGTEXLIVE=2006"`; # We provide a mapping to make texconfig and friend # behave like texconfig-sys and friends so existing old stuff in these # scripts keeps working: $TEXMFVAR = "${II2INSTALLDIR}/texmf.local"; $ENV{"TEXMFVAR"} = "${II2INSTALLDIR}/texmf.local"; $TEXMFCONFIG = "${II2INSTALLDIR}/texmf.local"; $ENV{"TEXMFCONFIG"} = "${II2INSTALLDIR}/texmf.local"; # Set that contains the set selected during any previous selector phase. # This is received from i-Installer: REDOSETSELECTION: $displayString = ""; %set = getSetInfo(); # sets %set foreach my $knownsetid (sort keys %set) { # warn "*** Checking $knownsetid\n"; if ($tlversion eq 'tl2006') { # GW 2006: this is in for future reference. Currently only 2006 is # available if ($knownsetid =~ /(tl200[789])/) { if ($set{$knownsetid}{'selected'} eq 'YES') { $set{"$knownsetid"}{'selected'} = 'NO'; my $newsetid = $knownsetid; $newsetid =~ s/tl200[789]/tl2006/; $set{"$newsetid"}{'selected'} = 'YES'; print "### ${PROGNAME}: Installing TL2006, enabling $newsetid and disabling $knownsetid.\n"; } next; } } } $displayString = ""; foreach my $knownsetid (sort keys %set) { next if ($tlversion eq 'tl2006' and $knownsetid =~ /tl200[789]/); if ($set{$knownsetid}{'available'} eq 'YES') { $displayString .= ($set{$knownsetid}{'selected'} eq 'YES' ? '+' : '-'); $displayString .= "$set{$knownsetid}{'name'}|"; } } chop( $displayString) if $displayString =~ /\|$/; # warn "* $displayString\n"; if ($displayString eq '') { ipkgwarn( "No set is complete for install. Please copy the package to a writable location, unlock it and turn network access on in i-Installer Preferences. Bailing out...\n"); exit 1; } $selectedSetString = ""; if ($dosimpleinstall) { if ($dofullinstall) { $selectedSetString = "${tlversion}-bin-powerpc|${tlversion}-bin-i386|${tlversion}-maninfo|${tlversion}-dev-universal|${tlversion}-texmfe|${tlversion}-texmfdoc|${tlversion}-gwtex|${tlversion}-gwtexdoc"; } else { $selectedSetString = "${tlversion}-bin-${arch}|${tlversion}-maninfo|${tlversion}-texmfe|${tlversion}-gwtex"; } chop( $selectedSetString) if $selectedSetString =~ /\|$/; print "### ${PROGNAME}: selected: $selectedSetString\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t SetSelectorSets -P "$selectedSetString"`; } else { $doresult = `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Select -T "Select Package Parts" -C "$displayString" -I "Please select which parts of the package you want to install. Clicking Cancel will make this stage fail and abort the install procedure." -1 "Select" -2 "All" -3 "Cancel"`; chomp( $doresult); if (($? >> 8) == 0) { $selectedSetString = ""; @chosensets = split( /\|/, $doresult); foreach my $chosenset (@chosensets) { if (not $chosenset =~ /^-/) { # Selected set foreach my $knownsetid (sort keys %set) { # warn "### ${PROGNAME}: checking \"$chosenset\" against \"$set{$knownsetid}{'name'}\"\n"; if ("+$set{$knownsetid}{'name'}" eq $chosenset) { $selectedSetString .= "$knownsetid|"; } } } } chop( $selectedSetString) if $selectedSetString =~ /\|$/; print "### ${PROGNAME}: selected: $selectedSetString\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t SetSelectorSets -P "$selectedSetString"`; } elsif (($? >> 8) == 1) { # Cancel. print "### ${PROGNAME}: none selected. Bailing out...\n"; exit( 1); } elsif (($? >> 8) == 2) { # All, do nothing. print "### ${PROGNAME}: all selected\n"; $selectedSetString = "${tlversion}-bin-powerpc|${tlversion}-bin-i386|${tlversion}-maninfo|${tlversion}-dev-universal|${tlversion}-texmfe|${tlversion}-texmfdoc|${tlversion}-gwtex|${tlversion}-gwtexdoc"; chop( $selectedSetString) if $selectedSetString =~ /\|$/; print "### ${PROGNAME}: selected: $selectedSetString\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t SetSelectorSets -P "$selectedSetString"`; } } %set = getSetInfo(); # refresh %set # For readability, use vars my $proginstalled = 'none'; $proginstalled = 'tl2006-powerpc' if $set{'tl2006-bin-powerpc'}{'installed'} eq 'YES'; $proginstalled = 'tl2006-i386' if $set{'tl2006-bin-i386'}{'installed'} eq 'YES'; $proginstalled = 'tl2006-universal' if $set{'tl2006-bin-i386'}{'installed'} eq 'YES' and $set{'tl2006-bin-powerpc'}{'installed'} eq 'YES'; my $libinstalled = 'none'; $libinstalled = 'tl2006-universal' if $set{'tl2006-lib-universal'}{'installed'} eq 'YES'; my $texmfinstalled = 'none'; $texmfinstalled = 'tl2006' if $set{'tl2006-texmfe'}{'installed'} eq 'YES'; my $texmfdocinstalled = 'none'; $texmfdocinstalled = 'tl2006' if $set{'tl2006-texmfdoc'}{'installed'} eq 'YES'; my $progselected = 'none'; $progselected = 'tl2006-powerpc' if $set{'tl2006-bin-powerpc'}{'selected'} eq 'YES'; $progselected = 'tl2006-i386' if $set{'tl2006-bin-i386'}{'selected'} eq 'YES'; $progselected = 'tl2006-universal' if $set{'tl2006-bin-i386'}{'selected'} eq 'YES' and $set{'tl2006-bin-powerpc'}{'selected'} eq 'YES'; # warn $progselected; my $libselected = 'none'; $libselected = 'tl2006-universal' if $set{'tl2006-lib-universal'}{'selected'} eq 'YES'; # warn $libselected; my $texmfselected = 'none'; $texmfselected = 'tl2006' if $set{'tl2006-texmfe'}{'selected'} eq 'YES'; # warn $texmfselected; my $texmfdocselected = 'none'; $texmfdocselected = 'tl2006' if $set{'tl2006-texmfdoc'}{'selected'} eq 'YES'; # warn $texmfdocselected; my $installedprogwillbe = 'none'; $installedprogwillbe = $progselected; $installedprogwillbe = $proginstalled if $progselected eq 'none'; # warn $installedprogwillbe; my $installedlibwillbe = 'none'; $installedlibwillbe = $libselected; $installedlibwillbe = $libinstalled if $libselected eq 'none'; # warn $installedlibwillbe; my $installedtexmfwillbe = 'none'; $installedtexmfwillbe = $texmfselected; $installedtexmfwillbe = $texmfinstalled if $texmfselected eq 'none'; # warn $installedtexmfwillbe; my $installedtexmfdocwillbe = 'none'; $installedtexmfdocwillbe = $texmfdocselected; $installedtexmfdocwillbe = $texmfdocinstalled if $texmfdocselected eq 'none'; # warn $installedtexmfdocwillbe; if ((!($installedprogwillbe =~ /universal/) and !($installedprogwillbe =~ /${arch}$/)) or $installedtexmfwillbe eq 'none') { # warn "XX ${installedprogwillbe} ${arch} ${installedtexmfwillbe}"; my $msg = "Your selection results in a non-working installation as there will be no working programs or no foundation installed as a result.\n\nAlso, the working of this i-Package is not guaranteed."; $doresult = `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "Selection problem." -I "${msg}" -1 "Go back" -2 "Continue"`; chomp( $doresult); if (($? >> 8) == 0) { $dosimpleinstall = 0; warn "### ${PROGNAME}: REDO SELECTION +++++++++++++++++++++++++++++++++++++++++++++++++\n"; goto REDOSETSELECTION; } } if ($installedprogwillbe =~ /tl2006/ and $installedtexmfwillbe =~ /tl200[789]/) { my $msg = "Your selection creates a combination of TeX Live 2006 programs and a non-TL2006 tree. This combination is not guaranteed to work.\n\nDo you want to change your selection or go ahead and see what happens?"; $doresult = `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "Combination unstable!" -I "${msg}" -1 "Go back" -2 "Continue"`; chomp( $doresult); if (($? >> 8) == 0) { $dosimpleinstall = 0; warn "### ${PROGNAME}: REDO SELECTION +++++++++++++++++++++++++++++++++++++++++++++++++\n"; goto REDOSETSELECTION; } } my $synchronized = 1; if (not ($installedlibwillbe eq 'none' or ($installedprogwillbe =~ /tl2006/ and $installedlibwillbe =~ /tl2006/))) { warn "\"$installedprogwillbe\" \"$installedlibwillbe\"\n"; warn "\"$libinstalled\" \"$libselected\"\n"; ipkgwarn( "Programs will be out of sync with program developer extras (libs, include).\n"); $synchronized = 0; } if ($installedtexmfdocwillbe ne 'none' and $installedtexmfwillbe ne $installedtexmfdocwillbe) { ipkgwarn( "Foundation will be out of sync with its documentation.\n"); $synchronized = 0; } if (not $synchronized) { my $msg = "Your selection creates some secondary inconsistencies, like newer programs and older program documentation or a newer foundation and older foundation documentation. This is generally not harmful.\n\nDo you want to have the secondary parts (like documentation) follow the main parts (like TeX itself)?\n\nIf you do, you will get the selection screen again so you can see what the result of your choice is."; $doresult = `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "Repair inconsistencies?" -I "${msg}" -1 "Yes" -2 "No"`; chomp( $doresult); if (($? >> 8) == 0) { # Modify the string to have i-Installer change the set if ($installedprogwillbe =~ /tl2006/ and $installedlibwillbe =~ /tl200[789]/) { $selectedSetString =~ s/tl200[789]-lib-[^|]*(\||$)//g; $selectedSetString .= "|tl2006-lib-universal|"; } if ($installedtexmfwillbe =~ /tl2006/ and $installedtexmfdocwillbe =~ /tl200[789]/) { $selectedSetString =~ s/tl200[789]-texmfdoc(\||$)//; $selectedSetString .= "|tl2006-texmfdoc|"; } $selectedSetString =~ s/\|\|/|/g; chop( $selectedSetString) if $selectedSetString =~ /\|$/; print "### ${PROGNAME}: selected: $selectedSetString\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t SetSelectorSets -P "$selectedSetString"`; $dosimpleinstall = 0; $dofullinstall = 0; warn "### ${PROGNAME}: REDO SELECTION +++++++++++++++++++++++++++++++++++++++++++++++++\n"; goto REDOSETSELECTION; } } `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t IncrementProgress -p 50000`; warn "### ${PROGNAME}: Finished...\n"; print "### ${PROGNAME}: Finished...\n";