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

Modified Files:
        ChangeLog update.pl 
Log Message:
edit sources.list, updating a todai entry if it is present, or giving the user
the option to add one (if using the unstable tree and installed in /sw)


Index: update.pl
===================================================================
RCS file: /cvsroot/fink/scripts/10.4-update/update.pl,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- update.pl   17 Jun 2006 20:47:08 -0000      1.13
+++ update.pl   17 Jun 2006 21:57:43 -0000      1.14
@@ -80,7 +80,10 @@
 ### check if this distribution is allowed
 
 if ($distribution eq "10.4") {
-       die "In that case, I will exit now.  Goodbye.\n" unless 
&Fink::CLI::prompt_boolean("You are already using the 10.4 distribution.  You 
should only run this script again if it somehow failed the first time.  Is that 
what you are trying to do?", default => 0);
+## verify if running for the first time
+       if (!(exists $ENV{FINK_UPDATED})) {
+               die "In that case, I will exit now.  Goodbye.\n" unless 
&Fink::CLI::prompt_boolean("You are already using the 10.4 distribution.  You 
should only run this script again if it somehow failed the first time.  Is that 
what you are trying to do?", default => 0);
+       }
 } else {
        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"));
 }
@@ -157,6 +160,47 @@
 &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");
 
+## edit sources.list
+my $path="$basepath/etc/apt/sources.list";
+my $has_todai = 0;
+my $todai_fixed = 1;
+if (-f $path) {
+       open(OUT,">$path.tmp") or die "can't open $path.tmp: $!";
+       open(IN,"$path") or die "can't open sources.list: $!";
+       while (<IN>) {
+               chomp;
+               if 
(s|http://fink.sodan.ecc.u-tokyo.ac.jp/apt/10.3|http://fink.sodan.ecc.u-tokyo.ac.jp/apt/10.4|)
 {
+                       print OUT "$_\n";
+                       $has_todai=1;
+               } elsif (/fink.sodan.ecc.u-tokyo.ac.jp/) {
+                       print OUT "$_\n";
+                       $has_todai=1;
+                       $todai_fixed=0;
+               } else {
+                       print OUT "$_\n";
+               }
+       }
+       close(IN);
+       if ($has_todai) {
+               if ($todai_fixed) {
+                       &Fink::CLI::print_breaking("The lines in your 
sources.list file which refer to the unofficial \"Todai\" binary distribution 
of Fink packages have been updated to 10.4.\n");
+               } else {
+                       &Fink::CLI::prompt_boolean("\nYour 
$basepath/etc/apt/sources.list file appears to refer to the unofficial 
\"Todai\" binary distribution of Fink packages, but I was unable to update 
this.  Will you remember to examine $basepath/etc/apt/sources.list after this 
script has finished, verifying that it is correct?");
+               }
+       } else {
+               if (($property_hash->{"trees"} =~ /unstable/) and ($basepath eq 
"/sw")) {
+                       if (&Fink::CLI::prompt_boolean("Your Trees line in 
$basepath/etc/fink.conf is set up to enable the \"unstable\" tree.  Do you also 
with to use the unofficial \"Todai\" binary distribution of Fink packages from 
that tree?", default=>0)) {
+                               &Fink::CLI::print_breaking("OK, please remember 
that this binary distribution is not supported by the Fink project, so if 
things go awry, you are on your own!\n");
+                               print OUT "deb 
http://fink.sodan.ecc.u-tokyo.ac.jp/apt/10.4 ecc main crypto\n";
+                               print OUT "deb 
http://fink.sodan.ecc.u-tokyo.ac.jp/apt/10.4 unstable main crypto\n";
+                       }
+               }
+       }
+       close(OUT);
+       unlink $path;
+       rename "$path.tmp", $path;
+}
+
 ## update everything
 
 &Fink::Services::execute("fink scanpackages");

Index: ChangeLog
===================================================================
RCS file: /cvsroot/fink/scripts/10.4-update/ChangeLog,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- ChangeLog   17 Jun 2006 16:41:25 -0000      1.11
+++ ChangeLog   17 Jun 2006 21:57:43 -0000      1.12
@@ -1,5 +1,11 @@
 2006-06-17  Dave Morrison  <[EMAIL PROTECTED]>
 
+       * update.pl: edit sources.list, updating a todai entry if it is
+       present, or giving the user the option to add one (if using the
+       unstable tree and installed in /sw)
+
+2006-06-17  Dave Morrison  <[EMAIL PROTECTED]>
+
        * update.pl: check for correct version of XCode; allow a user to re-run
        the script on a 10.4 distribution (after confirmation)
        * README: mention required XCode version



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

Reply via email to