#!/usr/bin/perl $II2BUILDSTAMP = $ENV{"II2BUILDSTAMP"}; $II2PKGDIR = $ENV{"II2PKGDIR"}; $II2INSTALLDIR = $ENV{"II2INSTALLDIR"}; $II2RESOURCES = $ENV{"II2RESOURCES"}; $II2DOSERVER = $ENV{"II2DOSERVER"}; 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; print "### ${PROGNAME}: Started...\n"; # Load shared stuff require "${II2PKGDIR}/texlive.sharedscript.pm"; checkTeXEnvironmentVariables(); migrateifnecessary(); setConfigUser(); 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 -d "${II2INSTALLDIR}") { print "### ${PROGNAME}: No TeX directory found.\n"; print "### ${PROGNAME}: I cannot remove a nonexistent TeX. Bailing out gracefully...\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "TeX Unavailable" -I "It seems there is no TeX in this location so I will not proceed to remove." -1 "OK"`; exit( 0); } if (not -w "${II2INSTALLDIR}") { warn "### ${PROGNAME}: The install location is not writable. Removal cannot proceed. Bailing out...\n"; exit( 1); } if (not &checkinstallocation()) { die "### ${PROGNAME}: Bailing out on nonstandard location \"${II2INSTALLDIR}\"\n" } $choices = "-TeX Programs|-TeX Foundation|-Local Settings|-CLI Activation"; $doresult = `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Select -C "$choices" -T "Select Parts?" -I "Select which part of TeX you want to remove." -1 "Select" -2 "Everything" -3 "Cancel"`; chomp( $doresult); if (($? >> 8) == 0) { @removeset = split( /\|/, $doresult); if ($removeset[0] =~ /^\+/) { $removeprograms = 1; } if ($removeset[1] =~ /^\+/) { $removefoundation = 1; } if ($removeset[2] =~ /^\+/) { $removelocal = 1; } if ($removeset[3] =~ /^\+/) { $removeclisetting = 1; } } elsif (($? >> 8) == 1) { print "### ${PROGNAME}: Not removing TeX.\n"; $removeprograms = 0; $removefoundation = 0; $removelocal = 0; $removeclisetting = 0; } elsif (($? >> 8) == 2) { $removeprograms = 1; $removefoundation = 1; $removelocal = 1; $removeclisetting = 1; } if ($removeclisetting) { # On remove, the actual path given does not matter if (ipkgsystem( "\"${II2PKGDIR}/\"setloginpath foo TeX remove") == 0) { print "### ${PROGNAME}: sucessfully removed the CLI path settings.\n"; } else { warn "### ${PROGNAME}: failed to remove the CLI path settings.\n"; } if (ipkgsystem( "\"${II2PKGDIR}/\"setmanpath foo TeX remove") == 0) { print "### ${PROGNAME}: sucessfully removed the man path settings.\n"; } else { warn "### ${PROGNAME}: failed to remove the man path settings.\n"; } if (ipkgsystem( "\"${II2PKGDIR}/\"setmanpath foo TeXMap remove") == 0) { print "### ${PROGNAME}: sucessfully removed the man path map settings.\n"; } else { warn "### ${PROGNAME}: failed to remove the man path settings.\n"; } } if ($removelocal) { &removetexlocal(); } `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t IncrementProgress -p 10000`; if (not -d "${II2INSTALLDIR}/share/texmf.local") { # Has been removed now or earlier $nolocal = 1; } if ($removeprograms) { &removetexprograms(); `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t UnsetInstalledSelectorSets -P "tl2006-bin-powerpc|tl2006-bin-i386|tl2006-dev-universal"`; } `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t IncrementProgress -p 30000`; if (not -d "${II2INSTALLDIR}/bin") { # Has been removed now or earlier $noprograms = 1; } if ($removefoundation) { &removetexfoundation(); &removegwtexfoundation(); `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t UnsetInstalledSelectorSets -P "tl2006-texmfe|tl2006-gwtex|tl2006-texmfdoc|tl2006-gwtexdoc"`; } `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t IncrementProgress -p 50000`; if (not -d "${II2INSTALLDIR}/texmf.texlive") { # Has been removed now or earlier $nofoundation = 1; } if ($removefoundation and $removeprograms and $removelocal) { print "### ${PROGNAME}: All main TeX parts have been removed. Removing miscellaneous other parts. Please wait...\n"; $removerest = 1; } elsif ($nofoundation and $noprograms and $nolocal) { print "### ${PROGNAME}: No main TeX parts found. Removing any miscellaneous other parts. Please wait...\n"; $removerest = 1; } if ($removerest) { &removetexrest(); } removedistributionlinks(); `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t IncrementProgress -p 10000`; warn "### ${PROGNAME}: Finished.\n"; print "### ${PROGNAME}: Finished.\n"; exit( 0); # $Id: tex.remove 71 2006-10-09 19:46:02Z gctwnl $