Changeset f8fa72b for fedkit/federate.pl


Ignore:
Timestamp:
Mar 5, 2010 3:26:09 AM (14 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
Children:
444790d
Parents:
c119839
Message:

More ProtoGENI accomodation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/federate.pl

    rc119839 rf8fa72b  
    33
    44use strict;
     5
     6use Getopt::Long;
    57
    68use IO::File;
     
    2931my $exp;
    3032my $proj;
     33my $install_smb;
    3134chomp (my $uname = `uname`);
    3235my $smbmount = "smbmount.$uname.pl";
     36
     37GetOptions("install_samba" => \$install_smb);
    3338
    3439# find perl
     
    4146$perl = "perl" unless $perl;
    4247
     48if ($install_smb) {
     49    # fix yum.conf
     50    copy("/etc/yum.conf", "/etc/yum.conf.bak");
     51    my $from = new IO::File("/etc/yum.conf.bak");
     52    my $to = new IO::File(">/etc/yum.conf");
     53    while (<$from>) {
     54        s/download.fedoralegacy.org/fedoralegacy.lsu.edu/g;
     55        print $to $_;
     56    }
     57    $from->close();
     58    $to->close();
     59    # Now, bridging
     60    system('/usr/bin/yum -y install samba-client');
     61}
    4362
    44 $tmcc_p->reader("$TMCC -b status");
    45 while (<$tmcc_p>) {
    46     /ALLOCATED=([^\/]+)\/(\S+)/ && do {
    47         ($proj, $exp) = ($1, $2);
    48         $shared_config_dir = "/proj/$proj/exp/$exp/tmp";
    49         last;
    50     };
    51 }
    52 $tmcc_p->close();
     63if (!-e "$local_config_dir/client.conf" ) {
     64    $tmcc_p->reader("$TMCC -b status");
     65    while (<$tmcc_p>) {
     66        /ALLOCATED=([^\/]+)\/(\S+)/ && do {
     67            ($proj, $exp) = ($1, $2);
     68            $shared_config_dir = "/proj/$proj/exp/$exp/tmp";
     69            last;
     70        };
     71    }
     72    $tmcc_p->close();
    5373
    54 mkdir($local_config_dir);
     74    mkdir($local_config_dir);
    5575
    56 foreach my $fn ("seer.conf", "client.conf", "userconf") {
    57     copy("$shared_config_dir/$fn", $local_config_dir )
    58         if -e "$shared_config_dir/$fn";
     76    foreach my $fn ("seer.conf", "client.conf", "userconf", "hosts") {
     77        copy("$shared_config_dir/$fn", $local_config_dir )
     78            if -e "$shared_config_dir/$fn";
     79    }
    5980}
    6081
     
    7293my $hosts = new IO::File("/etc/hosts") || die "Can't open /etc/hosts:$!\n";
    7394my $new_hosts = new IO::File(">/tmp/hosts") || die "Can't open /tmp/hosts:$!\n";
    74 my $config_hosts = new IO::File("$shared_config_dir/hosts") ||
    75     die "Can't open $shared_config_dir/hosts: $!\n";
     95my $config_hosts = new IO::File("$local_config_dir/hosts") ||
     96    die "Can't open $local_config_dir/hosts: $!\n";
    7697my $has_control = 0;
    7798
     
    112133
    113134if ($services{'userconfig'}) {
    114     $tmcc_p = new IO::Pipe() || die "Can't open pipe for accounts:$!\n";
    115     my $old_accounts = new IO::File(">$local_config_dir/old_accts") ||
    116         die "Can't open $local_config_dir/old_accts: $!\n";
     135    if (!-e "$local_config_dir/old_accts") {
     136        $tmcc_p = new IO::Pipe() || die "Can't open pipe for accounts:$!\n";
     137        my $old_accounts = new IO::File(">$local_config_dir/old_accts") ||
     138            die "Can't open $local_config_dir/old_accts: $!\n";
    117139
    118     $tmcc_p->reader("$TMCC -b accounts");
    119     while (<$tmcc_p>) {
    120         print $old_accounts $_;
     140        $tmcc_p->reader("$TMCC -b accounts");
     141        while (<$tmcc_p>) {
     142            print $old_accounts $_;
     143        }
     144        $tmcc_p->close();
     145        $old_accounts->close();
    121146    }
    122     $tmcc_p->close();
    123     $old_accounts->close();
    124147    print("Updating accounts");
    125148    system("/usr/local/federation/bin/rc.fedaccounts");
Note: See TracChangeset for help on using the changeset viewer.