Changeset 1651 in ProjectBuilder for devel/pb


Ignore:
Timestamp:
Oct 7, 2012, 6:07:09 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • Avoid to emit msgs when sed -i doesn't work (as on RedHat 6.2)
  • Factorize the proxy usages in pb_apply_conf_proxy and make it public (was partly done only)
  • debug level is now passed to the vescrip improving debug capabilities in that script
  • /dev/null shouldn't be touched on RedHat 6.2 as recreating it doesn't seem to work
  • Allow usage of mayfailverbose in pb_system when both features are needed to help debuging
  • Imrpove again RedHat 6.2 support up to setupve now (however needs a manual install of perl 5.6.2 to work as the minimum version for pb)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1649 r1651  
    23422342    # For VE we need to change the owner manually
    23432343    if ($cmt =~ /^VE/) {
    2344         my $res = pb_system("$shcmdroot sed -i '/requiretty/d' /etc/sudoers","Removing potential requiretty in sudoers");
     2344        my $res = pb_system("$shcmdroot sed -i '/requiretty/d' /etc/sudoers","Removing potential requiretty in sudoers","quiet");
    23452345        pb_system("$shcmdroot sed '/requiretty/d' /etc/sudoers > /tmp/sudoers.new ; mv /tmp/sudoers.new $tpdir/tmp/sudoers.new ; $shcmdroot mv /tmp/sudoers.new /etc/sudoers","Removing again potential requiretty in sudoers as sed -i failed") if (($res ne 0) && (-f "$tpdir/etc/sudoers"));
    23462346        pb_system("$shcmd \"sudo $chowncommand -R $mac $tdir\"","Adapt owner in $tdir to $mac");
     
    25282528    my $pbos = pb_distro_get_context($v);
    25292529   
    2530     my $ftp_proxy = pb_distro_get_param($pbos,pb_conf_get_if("ftp_proxy"));
    2531     my $http_proxy = pb_distro_get_param($pbos,pb_conf_get_if("http_proxy"));
    2532 
    2533     $ENV{ftp_proxy} ||= $ftp_proxy if ((defined $ftp_proxy) && ($ftp_proxy ne ""));
    2534     $ENV{http_proxy} ||= $http_proxy if ((defined $http_proxy) && ($http_proxy ne ""));
     2530    pb_apply_conf_proxy($pbos);
    25352531
    25362532    # Launch the VMs/VEs
     
    30843080EOF
    30853081    my $ppref = "our";
    3086     $ppref = "my" if (($pbos->{'name'} =~ /redhat/) && ($pbos->{'version'} =~ /^6/));
     3082    $ppref = "my" if (($pbos->{'name'} =~ /^redhat/) && ($pbos->{'version'} =~ /^6/));
    30873083    print SCRIPT << "EOF";
    3088 $ppref \$pbdebug;
     3084$ppref \$pbdebug = $pbdebug;
    30893085$ppref \$pbLOG;
    30903086$ppref \$pbsynmsg = "pbscript";
     
    31323128    } elsif ($vtype eq "ve") {
    31333129        print SCRIPT << "EOF";
    3134 # For VE we need a good null dev
    3135 pb_system("rm -f /dev/null; mknod /dev/null c 1 3; chmod 777 /dev/null");
    3136 
    31373130# For VE we first need to mount some FS
    31383131pb_system("mount -t proc /proc /proc") unless (-d "/proc/$$");
    31393132
     3133# For VE we need a good null dev
     3134# Except for RedHat 6.2 where it's good and doesnt like being recreated
    31403135EOF
     3136        print SCRIPT "pb_system('rm -f /dev/null; mknod /dev/null c 1 3; chmod 777 /dev/null')\n" unless (($pbos->{'name'} =~ /^redhat/) && ($pbos->{'version'} =~ /^6/));
    31413137    } else {
    31423138        die "Unknown virtual type $vtype";
     
    33453341        print SCRIPT "pb_system(\"$ntpline\",\"Updating time with $ntpline\",\"mayfail\");\n";
    33463342    }
    3347     # We may need a proxy configuration. Get it from the local env
    3348     my $ftp_proxy = pb_distro_get_param($pbos,pb_conf_get_if("ftp_proxy"));
    3349     my $http_proxy = pb_distro_get_param($pbos,pb_conf_get_if("http_proxy"));
    3350 
    3351     $ENV{'ftp_proxy'} ||= $ftp_proxy if ((defined $ftp_proxy) && ($ftp_proxy ne ""));
    3352     $ENV{'http_proxy'} ||= $http_proxy if ((defined $http_proxy) && ($http_proxy ne ""));
    3353 
    3354     if (defined $ENV{'http_proxy'}) {
    3355         print SCRIPT "\$ENV\{'http_proxy'\}=\"$ENV{'http_proxy'}\";\n";
    3356     }
    3357 
    3358     if (defined $ENV{'ftp_proxy'}) {
    3359         print SCRIPT "\$ENV\{'ftp_proxy'\}=\"$ENV{'ftp_proxy'}\";\n";
    3360     }
    33613343
    33623344    print SCRIPT << 'EOF';
    33633345   
     3346# We may need a proxy configuration. Get it from the local env
     3347pb_apply_conf_proxy($pbos);
     3348
    33643349# Suse wants sudoers as 640
    33653350if ((($pbos->{'name'} eq "sles") && (($pbos->{'version'} =~ /10/) || ($pbos->{'version'} =~ /9/))) || (($pbos->{'name'} eq "opensuse") && ($pbos->{'version'} =~ /10.[012]/))) {
     
    34153400   
    34163401my $perldep = pb_distro_get_param($pbos,$osperldep);
     3402my $bashopt = "";
     3403$bashopt = "-x" if ($pbdebug ge 1);
     3404my $verbopt = "mayfail";
     3405$verbopt = "mayfailverbose" if ($pbdebug ge 1);
    34173406foreach my $m (split(/,/,$perldep)) {
    34183407    # Skip empty deps
     
    34203409    my $dir = $m;
    34213410    $dir =~ s/-.*//;
    3422     pb_system("echo \"rm -rf $m* ; wget http://search.cpan.org/CPAN/modules/by-module/$dir/$m-$osperlver->{$m}.tar.gz ; gzip -cd $m-$osperlver->{$m}.tar.gz | tar xf - ; cd $m* ; if [ -f Build.PL ]; then perl Build.PL; ./Build ; ./Build install ; else perl Makefile.PL; make ; make install ; fi; cd .. ; rm -rf $m*\" | bash -e" ,"Installing perl module $m-$osperlver->{$m}","mayfail");
     3411    pb_system("echo \"rm -rf $m* ; wget http://search.cpan.org/CPAN/modules/by-module/$dir/$m-$osperlver->{$m}.tar.gz ; gzip -cd $m-$osperlver->{$m}.tar.gz | tar xf - ; cd $m* ; if [ -f Build.PL ]; then perl Build.PL; ./Build ; ./Build install ; else perl Makefile.PL; make ; make install ; fi; cd .. ; rm -rf $m*\" | bash -e $bashopt" ,"Installing perl module $m-$osperlver->{$m}",$verbopt);
    34233412}
    34243413EOF
Note: See TracChangeset for help on using the changeset viewer.