merge to top
[dotfiles.git] / scripts / update_cpve.pl
1 #!/usr/bin/perl -w
2
3 use strict;
4
5 use Getopt::Std;
6
7 my %options = ();
8 getopts("n", \%options);
9 print "-n $options{n}\n" if defined $options{n};
10
11 my $ip = (split / /, `ifconfig | grep "inet .*broadcast"`)[1];
12
13 my $cpve_dir = '/Users/peli3/CPVE/cpve_trunk/';
14 my $ecc_dir = '/Users/peli3/JCC/ecc-p2p/';
15
16
17 #### 
18 if($options{n})
19 {
20     print "==== don't build CPVE ======\n";
21 }
22 else 
23 {    
24     ## building CPVE
25     chdir $cpve_dir or die ": $!";
26     !system "scons arch=x86_64 platform=darwin debug=True -j16 osxversion=10.10"    or die "building CPVE failed : $!";
27
28     ## remove old cpve libs and replace in ECC
29     !system "rm -rf $ecc_dir/contrib/cpve/lib/darwin/x86_64/*"     or die "remove libs failed : $!";
30
31     !system "/bin/cp -r $cpve_dir/target/dist/lib/darwin/x86_64/* $ecc_dir/contrib/cpve/lib/darwin/x86_64/"     or die "copy libs failed: $!";
32
33 }
34
35 #### building ecc
36 chdir $ecc_dir or die ": $!";
37 !system "python runSconsBuild.py JabberMac64Bit  -j 16  -t no --early_cpve"     or die " building ECC failed : $!";
38
39 print "copy bin-s bin-c\n";
40 !system "rm -rf bin-s/* bin-c/*" or die "$!";
41 !system "/bin/cp -r $ecc_dir/out/bin/* $ecc_dir/bin-c" or die "$!";
42 !system "/bin/cp -r $ecc_dir/out/bin/* $ecc_dir/bin-s" or die "$!";
43
44 print "copy config files\n";
45 !system "/bin/cp $ecc_dir/sss.txt  $ecc_dir/bin-s/cucm-credentials.txt" or die ": $!";
46 !system "/bin/cp $ecc_dir/ccc.txt  $ecc_dir/bin-c/cucm-credentials.txt" or die ": $!";
47
48 print "add p2p server ip\n";
49 open CONF, ">>", "$ecc_dir/bin-c/cucm-credentials.txt" or  die "error $!";
50 print CONF "P2P_SERVER_IP=" . $ip . "\n";
51 close CONF;
52
53
54 print "####### DONE #######\n";
55
56 #sub get_local_ip{
57 #    my @cc = (split / /, `ifconfig | grep "inet .*broadcast"`)[1];
58 ##    @cc[1]; ## return value
59 ##    return @cc[1];
60 #}
61
62 #print CONF "P2P_SERVER_IP=" . &get_local_ip . "\n";