Update of /cvsroot/fink/scripts/10.4-update
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv14168

Modified Files:
        update.pl 
Log Message:
starting to improve user interaction


Index: update.pl
===================================================================
RCS file: /cvsroot/fink/scripts/10.4-update/update.pl,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- update.pl   14 Jun 2006 16:50:11 -0000      1.3
+++ update.pl   14 Jun 2006 17:19:24 -0000      1.4
@@ -37,7 +37,7 @@
 require Fink::Bootstrap;
 require Fink::Services;
 use Fink::Config;
-
+require Fink::CLI;
 ### restart as root if necessary
 
 if ($> != 0) {
@@ -79,15 +79,25 @@
 #my $distribution = $Config->param("Distribution");
 #print "distribution $distribution\n";
 
+### check if distribution is allowed
+
+die "This script is only for updating 10.3 or 10.4-transitional.\n" unless 
(($distribution eq "10.3") or ($distribution eq "10.4-transitional"));
+
+## check with $basepath/fink.old exists, and ask the user if it's OK to
+## remove
+
+if (-d "$basepath/fink.old") {
+       if (!&Fink::CLI::prompt_boolean("You have a $basepath/fink.old 
directory, which will interfere with the running of this script.  Is it OK if 
the script removes it?")) {
+               die "No? Then please remove or rename it manually, and run the 
script again.\n";
+       }
+}
+
+
 ### update fink and fink-mirrors, unless already done (as signalled by the
 ### FINK-UPDATED environment variable)
 
 
 if (!(exists $ENV{FINK_UPDATED})) {
-       if (($distribution eq "10.3") or ($distribution eq 
"10.4-transitional")) {
-       } else {
-               die "This script is only for updating 10.3 or 
10.4-transitional.\n";
-       }
        &Fink::Services::execute("sudo dpkg -i 
base-$distribution/fink-mirrors_*");
        &Fink::Services::execute("sudo dpkg -i base-$distribution/fink_*");
 
@@ -116,13 +126,6 @@
 &Fink::Services::execute("sudo dpkg -i 
base-10.4/fink_0.24.18-31_darwin-powerpc.deb");
 
 
-## better: remove $basepath/fink.old, but get confirmation from the user
-## that it is OK (if the user refuses, we exit)
-
-if (-d "$basepath/fink.old") {
-       &Fink::Services::execute("sudo mv $basepath/fink.old 
$basepath/fink.oold");
-}
-
 ## clean out stale deb symlinks
 &Fink::Services::execute("rm -f $basepath/fink/debs/*.deb");
 



_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to