Changeset f8fa72b for fedkit/federate.pl
- Timestamp:
- Mar 5, 2010 3:26:09 AM (14 years ago)
- Branches:
- axis_example, compt_changes, info-ops, master, version-3.01, version-3.02
- Children:
- 444790d
- Parents:
- c119839
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
fedkit/federate.pl
rc119839 rf8fa72b 3 3 4 4 use strict; 5 6 use Getopt::Long; 5 7 6 8 use IO::File; … … 29 31 my $exp; 30 32 my $proj; 33 my $install_smb; 31 34 chomp (my $uname = `uname`); 32 35 my $smbmount = "smbmount.$uname.pl"; 36 37 GetOptions("install_samba" => \$install_smb); 33 38 34 39 # find perl … … 41 46 $perl = "perl" unless $perl; 42 47 48 if ($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 } 43 62 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(); 63 if (!-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(); 53 73 54 mkdir($local_config_dir);74 mkdir($local_config_dir); 55 75 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 } 59 80 } 60 81 … … 72 93 my $hosts = new IO::File("/etc/hosts") || die "Can't open /etc/hosts:$!\n"; 73 94 my $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";95 my $config_hosts = new IO::File("$local_config_dir/hosts") || 96 die "Can't open $local_config_dir/hosts: $!\n"; 76 97 my $has_control = 0; 77 98 … … 112 133 113 134 if ($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"; 117 139 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(); 121 146 } 122 $tmcc_p->close();123 $old_accounts->close();124 147 print("Updating accounts"); 125 148 system("/usr/local/federation/bin/rc.fedaccounts");
Note: See TracChangeset
for help on using the changeset viewer.