Changeset 1541 in ProjectBuilder


Ignore:
Timestamp:
May 14, 2012, 2:41:55 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • pb: Update to make the port and login optional config entries. Add more places where we use pb_path_expand so that $ENV{HOME} is properly expanded. Add more documentation to pb_setup2v. Error out on an unknown vtype. Fix code so that the http_proxy/ftp_proxy are kept for the root user as well as the build user. Apply new {ftp,http}_proxy options. (Eric Anderson)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1540 r1541  
    17941794    pb_log(0,"Sources handled ($cmt): $src\n");
    17951795    pb_log(2,"values: ".Dumper(($host,$login,$dir,$port,$tmout,$path,$conf))."\n");
    1796     my ($sshhost,$sshlogin,$sshdir,$sshport) = pb_conf_get($host,$login,$dir,$port);
     1796    my ($sshhost,$sshdir) = pb_conf_get($host,$dir);
    17971797    # Not mandatory...
    17981798    $delivery->{$ENV{'PBPROJ'}} = "" if (not defined $delivery->{$ENV{'PBPROJ'}});
     1799    my ($sshlogin,$sshport) = pb_conf_get_if($login,$port);
     1800    $sshport->{$ENV{PBPROJ}} = 22 unless (defined $sshport->{$ENV{PBPROJ}});
     1801    $sshlogin->{$ENV{PBPROJ}} = getpwuid($UID) unless (defined $sshlogin->{$ENV{PBPROJ}});
    17991802    my ($vtmout,$vepath);
    18001803    # ...Except those in virtual context
     
    20592062    my ($shcmd,$cpcmd,$cptarget,$cp2target);
    20602063    if ($cmt =~ /^VE/) {
    2061         my $tp = $vepath->{$ENV{'PBPROJ'}};
    2062         my $tpdir = "$tp/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}";
     2064        my $tp = pb_path_expand($vepath->{$ENV{'PBPROJ'}});
     2065        my $tpdir = pb_path_expand("$tp/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}");
    20632066        my ($ptr) = pb_conf_get("vetype");
    20642067        my $vetype = $ptr->{$ENV{'PBPROJ'}};
     
    20702073        $cpcmd = "sudo /bin/cp -r ";
    20712074        # We need to get the home dir of the target account to deliver in the right place
    2072         open(PASS,"$tpdir/etc/passwd") || die "Unable to open $tpdir/etc/passwd";
     2075        open(PASS,"$tpdir/etc/passwd") || die "Unable to open $tpdir/etc/passwd: $!";
    20732076        my $homedir = "";
    20742077        while (<PASS>) {
     
    27702773}
    27712774
     2775# This function creates a giant script to configure a particular VM/VE/RM, it then copies the
     2776# script to the target.
     2777
    27722778# Function to create a potentialy missing pb account on the VM/VE/RM, and adds it to sudo
    27732779# Needs to use root account to connect to the VM/VE/RM
     
    28742880# For VE we need a good null dev
    28752881pb_system("rm -f /dev/null; mknod /dev/null c 1 3; chmod 777 /dev/null");
    2876 EOF
    2877         print SCRIPT << "EOF";
     2882
    28782883# For VE we first need to mount some FS
    28792884pb_system("mount -t proc /proc /proc");
    28802885
    28812886EOF
     2887    } else {
     2888        die "Unknown virtual type $vtype";
    28822889    }
    28832890
     
    30303037    next if (/^Defaults:$pbac->{$ENV{'PBPROJ'}}\\s+/);
    30313038    next if (/^Defaults:root \!requiretty/);
     3039    next if (/^Defaults:root env_keep/);
    30323040EOF
    30333041    print SCRIPT << 'EOF';
     
    30433051# Keep proxy configuration while using sudo
    30443052print PBOUT "Defaults:$pbac->{$ENV{'PBPROJ'}}    env_keep += \\\"http_proxy ftp_proxy\\\"\n";
     3053print PBOUT "Defaults:root    env_keep += \\\"http_proxy ftp_proxy\\\"\n";
    30453054EOF
    30463055    # Try to restrict security to what is really needed
     
    30833092    }
    30843093    # We may need a proxy configuration. Get it from the local env
     3094
     3095    # TODO: make this apply to the bootstrapping also.
     3096    my ($ftp_proxy_map, $http_proxy_map) = pb_conf_get_if('ftp_proxy', 'http_proxy');
     3097    my $ftp_proxy = pb_distro_get_param($pbos, $ftp_proxy_map);
     3098    my $http_proxy = pb_distro_get_param($pbos, $http_proxy_map);
     3099
     3100    $ENV{'ftp_proxy'} = $ftp_proxy if ((defined $ftp_proxy) && ($ftp_proxy ne ''));
     3101    $ENV{'http_proxy'} = $http_proxy if ((defined $http_proxy) && ($http_proxy ne ''));
    30853102
    30863103    if (defined $ENV{'http_proxy'}) {
Note: See TracChangeset for help on using the changeset viewer.