Changeset 1667 in ProjectBuilder


Ignore:
Timestamp:
Oct 27, 2012, 10:16:23 PM (11 years ago)
Author:
Bruno Cornec
Message:
  • Simplify Makefile by removing .pm modules in it
  • Adds a new SSH.pm module to share between cb and cbusterize the Net:SSH2 initialization and closing phases
  • cb now uses SSH.pm
Location:
projects/casparbuster/devel
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • projects/casparbuster/devel/Makefile.PL

    r1485 r1667  
    2222            'bin/cb' => '$(INST_MAN1DIR)/cb.$(MAN1EXT)',
    2323    },
    24     MAN3PODS      => { 
    25             'lib/CasparBuster/Env.pm' => '$(INST_MAN3DIR)/CasparBuster::Env.$(MAN3EXT)',
    26             'lib/CasparBuster/Version.pm' => '$(INST_MAN3DIR)/CasparBuster::Version.$(MAN3EXT)',
    27                     },
     24    #MAN3PODS      => {
     25    #'lib/CasparBuster/Env.pm' => '$(INST_MAN3DIR)/CasparBuster::Env.$(MAN3EXT)',
     26    #'lib/CasparBuster/Version.pm' => '$(INST_MAN3DIR)/CasparBuster::Version.$(MAN3EXT)',
     27    #},
    2828);
    2929
  • projects/casparbuster/devel/bin/cb

    r1664 r1667  
    8484use CasparBuster::Env;
    8585use CasparBuster::Plugin;
     86use CasparBuster::SSH;
    8687#use Cwd 'realpath';
    8788use Carp qw/confess cluck/;
     
    377378my $chan;
    378379
    379 # deal with content first
    380 # Create remote connection and copy tar file there
    381 $ssh2 = Net::SSH2->new();
    382 $ssh2->debug(1) if ($debug > 2);
    383 
    384380my $mach = $machine;
    385381if ((defined $cb->{'commondir'}) && (defined $cb->{'commondir'}->{$machine})) {
     
    387383    $mach = $cb->{'websrv'}->{$machine};
    388384}
    389 $ssh2->connect($mach);
    390 my $hdir = (getpwnam(getpwuid($<)))[7];
    391 if ($ssh2->auth_publickey($remote,"$hdir/.ssh/id_dsa.pub","$hdir/.ssh/id_dsa")) {
    392     $chan = $ssh2->channel();
    393     $chan->exec("mkdir -p $ENV{'PBTMP'}");
    394     $chan->close;
    395 
    396     $ssh2->scp_put($tarfile,$tarfile);
    397     pb_log(0,"INFO: Created $ENV{'PBTMP'} on $remote\@$mach and copying content\n");
    398 } else {
    399     pb_log(0,"ERROR: Unable to authenticate to $remote\@$mach\n");
    400     return;
    401 }
     385
     386$ssh2 = cb_ssh_init($remote,$machine,$debug);
     387
     388$ssh2->scp_put($tarfile,$tarfile);
     389pb_log(0,"INFO: Copying content under $ENV{'PBTMP'} on $remote\@$mach\n");
    402390
    403391my $path = "/";
     
    408396}
    409397$chan = $ssh2->channel();
    410 $chan->shell();
     398confess "Unable to launch remote shell through Net:SSH2 ($remote\@$mach)" if (not $chan->shell());
     399
    411400if (not $debug) {
    412401    print $chan "sudo tar -C $path -x -f $tarfile $tbextract\n";
     
    453442}
    454443$chan->close();
    455 $ssh2->disconnect();
     444
     445cb_ssh_close($ssh2);
    456446
    457447chdir("/");
Note: See TracChangeset for help on using the changeset viewer.