#!/usr/bin/perl $II2PKGDIR = $ENV{"II2PKGDIR"}; $II2INSTALLDIR = $ENV{"II2INSTALLDIR"}; $II2RESOURCES = $ENV{"II2RESOURCES"}; $II2DOSERVER = $ENV{"II2DOSERVER"}; $II2BUILDSTAMP = $ENV{"II2BUILDSTAMP"}; $II2CALLEDFROM = $ENV{"II2CALLEDFROM"}; if (${II2BUILDSTAMP} < 1223415500) { warn "### You need at least i-Installer 2.94 for this package. Bailing out...\n"; exit 1; } $PROGNAME = `"${II2RESOURCES}/basename" "$0"`; chomp( $PROGNAME); # Load shared stuff if (not -e "$ENV{'II2RESOURCES'}/ii2plfuncs.pm") { my $msg = "i-Installer is damaged. Perl support routines are missing."; warn "### ${PROGNAME}: ${msg}"; if (exists $ENV{'II2DOSERVER'}) { `"$ENV{'II2RESOURCES'}/doalerter" -s "$ENV{'II2DOSERVER'}" -V -t Alert -T "i-Installer isd damaged" -I "${msg}" -1 "Accept"`; } exit 1; } require "$ENV{'II2RESOURCES'}/ii2plfuncs.pm"; print "### ${PROGNAME}: Started...\n"; if (${II2INSTALLDIR} eq "" or not (-d "${II2INSTALLDIR}/bin" or -d "${II2INSTALLDIR}/share/ghostscript")) { print "### ${PROGNAME}: No Ghostscript found.\n"; print "### ${PROGNAME}: I cannot remove a nonexistent Ghostscript. Bailing out gracefully...\n"; `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "Ghostscript Unavailable" -I "It seems there is no Ghostscript in this location so I will not proceed to remove." -1 "OK"`; exit( 0); } if (not -w "${II2INSTALLDIR}") { warn "### ${PROGNAME}: Ghostscript is not writable. Removal cannot proceed. Bailing out...\n"; exit( 1); } print "### ${PROGNAME}: Removing files (please wait) ...\n"; ii2removeaccordingtolistfile(); # We do this because OS X's bug has left stuff there that impairs proper # ghostscript operations. Protected by user choice. if (-d "${II2INSTALLDIR}/share/ghostscript") { my $msgstring = (($II2CALLEDFROM =~ /prepare$/) ? "I have just attemppted to remove a previous ghostscript installation. " : ""); $doresult = `"${II2RESOURCES}/doalerter" -s "${II2DOSERVER}" -V -t Alert -T "Remove shared ghostscript location?" -I "${msgstring}There is still a shared ghostscript location ${II2INSTALLDIR}/share/ghostscript after the attempted removal of a potentially available old ghostscript installation. This should normally not be the case.\nWould you like me to remove it? If you have not added anything there it is safe to do so. It will also remove stuff that may have been created there by i-Installer due to a bug in Mac OS X, hence you are advised to say yes unless you have put some other stuff there yourself and you know what you are doing." -1 "Yes" -3 "No"`; chomp( $doresult); if ($doresult eq "Yes") { print "### ${PROGNAME}: Removing ${II2INSTALLDIR}/share/ghostscript...\n"; system "rm -rf \"${II2INSTALLDIR}\"/share/ghostscript"; } } warn "### ${PROGNAME}: Finished.\n"; print "### ${PROGNAME}: Finished.\n"; exit( 0); # $Id: ghostscript-8.remove 118 2008-10-04 09:51:34Z gctwnl $