Changeset 1527 in ProjectBuilder


Ignore:
Timestamp:
May 12, 2012, 2:54:10 AM (12 years ago)
Author:
Bruno Cornec
Message:
  • VE.pm: Verify that the proxy variables are passed through if we are using sudo. (Eric Anderson)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/VE.pm

    r1519 r1527  
    9292    # If we are already root (from pbmkbm e.g.) don't use sudo, just call the command
    9393    my $sudocmd="";
    94     $sudocmd ="sudo " if ($EFFECTIVE_USER_ID != 0);
     94    if ($EFFECTIVE_USER_ID != 0) {
     95        $sudocmd ="sudo ";
     96        foreach my $proxy (qw/http_proxy ftp_proxy/) {
     97            if (defined $ENV{$proxy}) {
     98                open(<CMD>,"sudo sh -c 'echo \$$proxy' |") or die "can't run sudo sh?: $!";
     99                $_ = <CMD>;
     100                chomp();
     101                die "sudo not passing through env var $proxy; '$ENV{$proxy}' != '$_'\nAdd line Defaults:`whoami` env_keep += \"$proxy\" to sudoers file?" unless $_ eq $ENV{$proxy};
     102            }
     103        }
    95104    # Handle cross arch on Intel based platforms
    96105    $sudocmd = "setarch i386 $sudocmd" if (($pbos->{arch} =~ /i?86/) && ($arch eq 'x86_64'));
Note: See TracChangeset for help on using the changeset viewer.