Changeset 2043 in ProjectBuilder


Ignore:
Timestamp:
Feb 19, 2016, 2:45:06 AM (8 years ago)
Author:
Bruno Cornec
Message:
  • Split again the perl script apart in a file befor passing it through ssh to the VM to sort duplicated ssh keys
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 0.13.2/pb/bin/pb

    r2042 r2043  
    49354935close(FILE);
    49364936my $key = "\Q$zero1";
    4937 
    4938 pb_system("ssh -q -o UserKnownHostsFile=/dev/null -p $nport -i $keyfile root\@$vmhost->{$ENV{'PBPROJ'}} ".'perl -e \'my $file1="$ENV{\'HOME\'}/.ssh/authorized_keys"; open(PBFILE,$file1) || die "Unable to open $file1"; open(PBOUT,"> $file1.new") || die "Unable to open $file1.new"; my $count = 0; while (<PBFILE>) { '."if (/ $key /) { \$count++; } print PBOUT \$_ if ((\$count <= 1) || (\$_ !~ / $key /)); };".'close(PBFILE); close(PBOUT); rename("$file1.new",$file1); chmod 0600,$file1;\'',"","quiet");
     4937my $perls = "$ENV{'PBTMP'}/perls.$$";
     4938       
     4939open(FILE,"> $perls") || die "Unable to open $perls";
     4940print FILE << 'EOF';
     4941my $file1="$ENV{'HOME'}/.ssh/authorized_keys";
     4942open(PBFILE,$file1) || die "Unable to open $file1";
     4943open(PBOUT,"> $file1.new") || die "Unable to open $file1.new";
     4944my $count = 0;
     4945while (<PBFILE>) {
     4946EOF
     4947print FILE << "EOF";
     4948    if (/ $key /) {
     4949        \$count++;
     4950    }
     4951    print PBOUT \$_ if ((\$count <= 1) || (\$_ !~ / $key /));
     4952}
     4953close(PBFILE);
     4954close(PBOUT);
     4955rename("\$file1.new",\$file1);
     4956chmod 0600,\$file1;
     4957EOF
     4958close(FILE);
     4959pb_system("cat $perls | ssh -q -o UserKnownHostsFile=/dev/null -p $nport -i $keyfile root\@$vmhost->{$ENV{'PBPROJ'}} perl","","quiet");
    49394960return;
    49404961}
Note: See TracChangeset for help on using the changeset viewer.