Change 18196 by pudge@pudge-mobile on 2002/11/28 03:39:14
Make installme more robust
Affected files ...
.... //depot/maint-5.6/macperl/macos/macperl/Droplets/installme.plx#3 edit
Differences ...
==== //depot/maint-5.6/macperl/macos/macperl/Droplets/installme.plx#3 (text) ====
Index: macperl/macos/macperl/Droplets/installme.plx
--- macperl/macos/macperl/Droplets/installme.plx#2~16470~ Tue May 7 20:49:32 2002
+++ macperl/macos/macperl/Droplets/installme.plx Wed Nov 27 19:39:14 2002
@@ -26,34 +26,48 @@
my $archive = my $dir = $ARGV[0];
if ($archive =~ /$re/) {
- my $switch = MacPerl::Answer(
- 'Convert all text and MacBinary files?', 'Yes', 'No');
- my $conv = Mac::Conversions->new(Remove=>1);
-
- my $tar = Archive::Tar->new($archive, 1) or die $!;
- chdir(dirname($archive)) or die "Can't chdir: $!";
-
- my @files = $tar->list_files;
-
- foreach my $file (@files) {
- $file .= "/" unless $file =~ /\//;
- my $dir = ':' . dirname(Archive::Tar::_munge_file($file));
- die "$dir already exists, will not overwrite\n"
- if -e $dir;
- }
-
- print "Unpacking archive ...\n";
- $tar->extract(@files);
-
- print "Converting files ...\n";
- Mac::BuildTools::convert_files(\@files, $verbose) if $switch;
-
- $dir =~ s/$re//;
+ my $switch = MacPerl::Answer(
+ 'Convert all text and MacBinary files?', 'Yes', 'No');
+ my $conv = Mac::Conversions->new(Remove=>1);
+
+ my $tar = Archive::Tar->new($archive, 1) or die $!;
+ chdir(dirname($archive)) or die "Can't chdir: $!";
+
+ my @files = $tar->list_files;
+
+ foreach my $file (@files) {
+ $file .= "/" unless $file =~ /\//;
+ my $dir = ':' . dirname(Archive::Tar::_munge_file($file));
+ die "$dir already exists, will not overwrite"
+ if -e $dir;
+ }
+
+ print "Unpacking archive ...\n";
+ $tar->extract(@files);
+
+ print "Converting files ...\n";
+ Mac::BuildTools::convert_files(\@files, $verbose) if $switch;
+
+ $dir =~ s/$re//;
+
+ if (-d $dir) {
+ chdir $dir or die "Can't chdir $dir: $!";
+ Mac::BuildTools::make({});
+ Mac::BuildTools::make_install({});
+ } else {
+ print <<EOT;
+Problems accessing archive '$archive':
+ archive directory '$dir' does not exist
+EOT
+ exit(1);
+ }
+} else {
+ print <<EOT;
+Cannot recognize archive format (should match '/$re/')
+Please verify the archive, and perhaps try to rename it.
+EOT
}
-chdir $dir or die "Can't chdir $dir: $!\n";
-Mac::BuildTools::make({});
-Mac::BuildTools::make_install({});
print "Done.\n";
End of Patch.