Update of /cvsroot/fink/scripts/10.4-update
In directory sc8-pr-cvs5.sourceforge.net:/tmp/cvs-serv17753
Modified Files:
ChangeLog update.pl
Log Message:
detect $basepath and $distribution automatically; better interaction with user
Index: update.pl
===================================================================
RCS file: /cvsroot/fink/scripts/10.4-update/update.pl,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- update.pl 14 Jun 2006 17:19:24 -0000 1.4
+++ update.pl 14 Jun 2006 18:28:48 -0000 1.5
@@ -27,21 +27,15 @@
use 5.008_001; # perl 5.8.1 or newer required
use strict;
-### NOTE: RIGHT NOW THIS TAKES TWO ARGUMENTS, $basepath and $distribution,
-### BUT BEFORE RELEASE IT MUST BE TAUGHT TO FIGURE THOSE OUT ON ITS OWN
-
-#use FindBin;
-#my $homebase = $FindBin::RealBin;
-#chdir $homebase;
+### Note: this script takes an optional argument specifying $basepath
require Fink::Bootstrap;
require Fink::Services;
-use Fink::Config;
require Fink::CLI;
+
### restart as root if necessary
if ($> != 0) {
- print "not root yet\n";
my ($cmd, $arg);
$cmd = "sudo ./update.pl";
foreach $arg (@ARGV) {
@@ -59,31 +53,26 @@
### which distribution are we running?
-#temporary
-
-my ($basepath,$distribution) = ($ARGV[0],$ARGV[1]);
+my ($notlocated, $basepath) = &Fink::Bootstrap::locate_Fink($ARGV[0]);
+die "I am unable to determine the location of your fink installation (such as
/sw). Please start the script again, giving the location as a parameter on the
command line.\n" if ($notlocated);
+## only confirm the choice with the user the first time through (i.e., before
+## setting the FINK_UPDATED environment variable
+if (!(exists $ENV{FINK_UPDATED})) {
+ die "In that case, please start the script again, giving the correct
location as a parameter on the command line.\n" unless
&Fink::CLI::prompt_boolean("I have located your fink installation in $basepath.
Is this the one which you wish to update?");
+}
-#my ($notlocated, $basepath) = &Fink::Bootstrap::locate_Fink($ARGV[0]);
-#print "basepath $basepath\n";
-#my $Config;
-#my $configpath = "$basepath/etc/fink.conf";
-#if (-f $configpath) {
-# $Config = &Fink::Services::read_config($configpath,
-# { Basepath => "$basepath" }
-#
);
-# } else {
-# print "ERROR: Configuration file \"$configpath\" not found.\n";
-# exit 1;
-# }
-##my $distribution = Fink::Config::config->param("Distribution");
-#my $distribution = $Config->param("Distribution");
-#print "distribution $distribution\n";
+my $property_hash =
&Fink::Services::read_properties("$basepath/etc/fink.conf") or die "Cannot read
$basepath/etc/fink.conf .\n";
+my $distribution = $property_hash->{"distribution"} or die "no distribution\n";
+## print our results the first time through
+if (!(exists $ENV{FINK_UPDATED})) {
+ print "\nbasepath $basepath; distribution $distribution\n\n";
+}
-### check if distribution is allowed
+### check if this 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"));
+die "This script is only for updating 10.3 or 10.4-transitional
distributions.\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
+## check whether $basepath/fink.old exists, and ask the user if it's OK to
## remove
if (-d "$basepath/fink.old") {
@@ -92,11 +81,9 @@
}
}
-
### update fink and fink-mirrors, unless already done (as signalled by the
### FINK-UPDATED environment variable)
-
if (!(exists $ENV{FINK_UPDATED})) {
&Fink::Services::execute("sudo dpkg -i
base-$distribution/fink-mirrors_*");
&Fink::Services::execute("sudo dpkg -i base-$distribution/fink_*");
@@ -125,7 +112,6 @@
&Fink::Services::execute("/usr/bin/perl -pi -e \"s|Distribution:
10.4-transitional|Distribution: 10.4|\" $basepath/etc/fink.conf");
&Fink::Services::execute("sudo dpkg -i
base-10.4/fink_0.24.18-31_darwin-powerpc.deb");
-
## clean out stale deb symlinks
&Fink::Services::execute("rm -f $basepath/fink/debs/*.deb");
@@ -133,8 +119,6 @@
&Fink::Services::execute("mkdir -p
$basepath/fink/10.4/stable/main/binary-darwin-powerpc/base");
&Fink::Services::execute("cp base-10.4/*.deb
$basepath/fink/10.4/stable/main/binary-darwin-powerpc/base");
-
-
## update everything
&Fink::Services::execute("fink scanpackages");
Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/scripts/10.4-update/ChangeLog,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- ChangeLog 14 Jun 2006 16:50:11 -0000 1.3
+++ ChangeLog 14 Jun 2006 18:28:48 -0000 1.4
@@ -1,7 +1,8 @@
2006-06-14 Dave Morrison <[EMAIL PROTECTED]>
* update.pl: don't use 'fink cleanup', but make sure that stale deb
- symlinks are removed
+ symlinks are removed; detect $basepath and $distribution automatically;
+ better interaction with user
2006-06-13 Dave Morrison <[EMAIL PROTECTED]>
_______________________________________________
Fink-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fink-commits