Changeset 1198


Ignore:
Timestamp:
Feb 17, 2011, 1:20:36 AM (9 years ago)
Author:
Bruno Cornec
Message:
  • Fix sudoers format fr env_keep (at least on gentoo)
  • Fix pb_get_sudocmds to deal correctly with additional params, and handle correctly spaces before sudo
  • Add full path names on sudo commands for gentoo
Location:
devel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/etc/pb.conf

    r1192 r1198  
    204204# Command to update the distribution to latest state
    205205osupd du = sudo /usr/bin/apt-get update; export DEBIAN_FRONTEND="noninteractive"; sudo /usr/bin/apt-get --quiet -y --force-yes dist-upgrade
    206 osupd gen = sudo emerge --update --deep world; sudo revdep-rebuild
     206osupd gen = sudo /usr/bin/emerge --update --deep world; sudo /usr/bin/revdep-rebuild
    207207osupd rpm = sudo /usr/bin/yum clean all; sudo /usr/bin/yum -y update
    208208osupd md = sudo /usr/bin/urpmi.update -a ; sudo /usr/sbin/urpmi --auto --auto-select
     
    214214# not the update of the repo which may well be unaccessible if too old
    215215osins du = sudo /usr/bin/apt-get update ; sudo /usr/bin/apt-get -y install
    216 osins gen = sudo emerge
     216osins gen = sudo /usr/bin/emerge
    217217osins rpm = sudo /usr/bin/yum clean all; sudo /usr/bin/yum -y update ; sudo /usr/bin/yum -y install
    218218osins rhel-2.1 = sudo up2date -y
     
    387387osperldep rhel-3 = Module-Build,File-MimeInfo,File-BaseDir
    388388# Tested
    389 osperldep rhel-6 = File-MimeInfo,File-BaseDir,Mail-Sendmail
     389osperldep rhel-6 = File-MimeInfo,File-BaseDir
    390390ospkgdep rhel-6 = wget,make,ntpdate,patch,perl-Date-Manip,rpm-build,diffutils,perl-Module-Build
    391391#
    392 osperldep rhel-3 = Module-Build,File-MimeInfo,File-BaseDir,Mail-Sendmail
     392osperldep rhel-3 = Module-Build,File-MimeInfo,File-BaseDir
    393393ospkgdep rhel-3 = wget,make,ntp,patch,perl-DateManip,diffutils
    394394osperldep centos-3 = Module-Build,File-MimeInfo,File-BaseDir
     
    428428# HP-UX
    429429# TBC
    430 osperldep sd =
     430osperldep sd = Pod2man,Date-Manip,File-MimeInfo
    431431
    432432# Version of the perl module as found on CPAN
  • devel/pb/bin/pb

    r1197 r1198  
    29612961print PBOUT "Defaults:root !requiretty\n";
    29622962# Keep proxy configuration while using sudo
    2963 print PBOUT "Defaults:$pbac->{$ENV{'PBPROJ'}} env_keep += \\\"http_proxy ftp_proxy\\\"\n";
     2963print PBOUT "Defaults:$pbac->{$ENV{'PBPROJ'}}    env_keep += \\\"http_proxy ftp_proxy\\\"\n";
    29642964EOF
    29652965    # Try to restrict security to what is really needed
    29662966    if ($vtype =~ /^vm/) {
    29672967        my $hpath = pb_distro_get_param($pbos,pb_conf_get("ospathcmd-halt"));
    2968         my @sudocmds = pb_get_sudocmds($pbos,$ntpline,$hpath);
     2968        my @sudocmds = pb_get_sudocmds($pbos,$ntpline,"sudo $hpath");
    29692969        print SCRIPT << "EOF";
    29702970# This is needed in order to be able on VM to halt the machine from the $pbac->{$ENV{'PBPROJ'}} account at least
     
    37663766       
    37673767my $pbos = shift;
    3768 my @lines = shift;
    37693768my %sudocmds;
    37703769
    3771 foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'}),@lines) {
    3772     next if ($c !~ /^sudo/);
    3773     # remove sudo
    3774     $c =~ s/^sudo\s+//;
    3775     # remove leading spaces
    3776     $c =~ s/^\s+//;
    3777     # remove ending spaces
    3778     $c =~ s/\s+$//;
     3770pb_log(2,"pb_get_sudocmds entering with lines:".Dumper(@_)."\n");
     3771foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'}),@_) {
     3772    pb_log(2,"pb_get_sudocmds analyses $c\n");
     3773    next if ($c !~ /^\s*sudo/);
     3774    # remove sudo and leading spaces
     3775    $c =~ s/^\s*sudo\s+//;
    37793776    # keep only the command, not the params
    37803777    $c =~ s/([^\s]+)\s.*$/$1/;
    37813778    $sudocmds{$c} = "";
    37823779}
    3783 pb_log(2,"pb_get_sudcomds returns ".Dumper(%sudocmds)."\n");
     3780pb_log(2,"pb_get_sudocmds returns ".Dumper(keys %sudocmds)."\n");
    37843781return(keys %sudocmds);
    37853782}
Note: See TracChangeset for help on using the changeset viewer.