Changeset 1190 in ProjectBuilder
- Timestamp:
- Feb 15, 2011, 11:46:55 AM (14 years ago)
- Location:
- devel
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb-modules/etc/pb.conf
r1181 r1190 203 203 204 204 # Command to update the distribution to latest state 205 osupd du = sudo apt-get update; export DEBIAN_FRONTEND="noninteractive";apt-get --quiet -y --force-yes dist-upgrade205 osupd du = sudo /usr/bin/apt-get update; export DEBIAN_FRONTEND="noninteractive"; /usr/bin/apt-get --quiet -y --force-yes dist-upgrade 206 206 osupd gen = sudo emerge --update --deep world; sudo revdep-rebuild 207 207 osupd rpm = sudo /usr/bin/yum clean all; sudo /usr/bin/yum -y update … … 213 213 # Chaining the commands allow to only test for what is able to be installed, 214 214 # not the update of the repo which may well be unaccessible if too old 215 osins du = sudo apt-get update ; sudoapt-get -y install215 osins du = sudo /usr/bin/apt-get update ; sudo /usr/bin/apt-get -y install 216 216 osins gen = sudo emerge 217 217 osins rpm = sudo /usr/bin/yum clean all; sudo /usr/bin/yum -y update ; sudo /usr/bin/yum -y install -
devel/pb/bin/pb
r1189 r1190 2405 2405 my $upddate = strftime("%m%d%H%M%Y", @date); 2406 2406 my $dateline = "sudo /bin/date $upddate"; 2407 return($ntpline,$dateline); 2407 if (defined $ntpline) { 2408 return($ntpline); 2409 } else { 2410 return($dateline); 2411 } 2408 2412 } 2409 2413 … … 2469 2473 } 2470 2474 2471 my ($ntpline,$dateline)= pb_date2v($vtype,$v);2475 my $ntpline = pb_date2v($vtype,$v); 2472 2476 print SCRIPT "# Time sync\n"; 2473 2477 print SCRIPT "echo 'setting up date with '"; 2474 if (defined $ntpline) { 2475 print SCRIPT "echo $ntpline\n"; 2476 print SCRIPT "$ntpline\n"; 2477 } else { 2478 print SCRIPT "echo $dateline\n"; 2479 print SCRIPT "$dateline\n"; 2480 } 2478 print SCRIPT "echo $ntpline\n"; 2479 print SCRIPT "$ntpline\n"; 2481 2480 # Use potential local proxy declaration in case we need it to download repo, pkgs, ... 2482 2481 if (defined $ENV{'http_proxy'}) { … … 2719 2718 2720 2719 # Deal with date sync. 2721 my ($ntpline,$dateline)= pb_date2v($vtype,$v);2720 my $ntpline = pb_date2v($vtype,$v); 2722 2721 2723 2722 # Get distro context … … 2795 2794 } 2796 2795 2797 if ($vtype =~ /(v|r)m/) {2796 if ($vtype =~ /(v|r)m/) { 2798 2797 print SCRIPT << 'EOF'; 2799 2798 # Removes duplicate in .ssh/authorized_keys of our key if needed … … 2817 2816 chmod 0600,\$file1; 2818 2817 2819 # Sync date 2820 EOF 2821 if (defined $ntpline) { 2822 print SCRIPT "pb_system(\"$ntpline\");\n"; 2823 } else { 2824 print SCRIPT "pb_system(\"$dateline\");\n"; 2825 } 2818 EOF 2826 2819 } 2827 2820 print SCRIPT << 'EOF'; … … 2943 2936 while (<PBFILE>) { 2944 2937 EOF 2938 # Skip what will be generated 2945 2939 print SCRIPT << "EOF"; 2946 next if (/^$pbac->{$ENV{'PBPROJ'}} /); 2940 next if (/^$pbac->{$ENV{'PBPROJ'}}\\s+/); 2941 next if (/^Defaults:$pbac->{$ENV{'PBPROJ'}}\\s+/); 2942 next if (/^Defaults:root \!requiretty/); 2947 2943 EOF 2948 2944 print SCRIPT << 'EOF'; … … 2961 2957 # Try to restrict security to what is really needed 2962 2958 if ($vtype =~ /^vm/) { 2963 my @sudocmds = pb_get_sudocmds($pbos);2964 2959 my $hpath = "/sbin"; 2960 # TODO: make that an external variable ! 2965 2961 # Solaris has halt elsewhere 2966 2962 if ($pbos->{'type'} eq "pkg") { 2967 2963 $hpath = "/usr/sbin"; 2968 2964 } 2965 my @sudocmds = pb_get_sudocmds($pbos,$ntpline,"$hpath/halt"); 2969 2966 print SCRIPT << "EOF"; 2970 2967 # This is needed in order to be able on VM to halt the machine from the $pbac->{$ENV{'PBPROJ'}} account at least 2971 2968 # Build account $pbac->{$ENV{'PBPROJ'}} in VM also needs to setup date and install deps. 2972 2969 # Nothing else should be needed 2973 print PBOUT "$pbac->{$ENV{'PBPROJ'}} localhost=NOPASSWD:$hpath/halt\n";2974 2970 EOF 2975 2971 foreach my $c (@sudocmds) { 2976 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost =NOPASSWD:$c\n\";";2972 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost = NOPASSWD: $c\n\";"; 2977 2973 } 2978 2974 } elsif ($vtype =~ /^rm/) { 2979 my @sudocmds = pb_get_sudocmds($pbos );2975 my @sudocmds = pb_get_sudocmds($pbos,$ntpline); 2980 2976 print SCRIPT << "EOF"; 2981 2977 # Build account $pbac->{$ENV{'PBPROJ'}} in RM only needs to setup date and install deps if needed each time 2982 2978 EOF 2983 2979 foreach my $c (@sudocmds) { 2984 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost =NOPASSWD:$c\n\";";2980 print SCRIPT "print PBOUT \"$pbac->{$ENV{'PBPROJ'}} localhost = NOPASSWD: $c\n\";"; 2985 2981 } 2986 2982 } else { … … 2997 2993 EOF 2998 2994 2995 if ($vtype =~ /(v|r)m/) { 2996 # Sync date 2997 # do it after sudoers is setup 2998 print SCRIPT "pb_system(\"$ntpline\");\n"; 2999 } 2999 3000 # We may need a proxy configuration. Get it from the local env 3000 3001 … … 3762 3763 3763 3764 my $pbos = shift; 3764 my @sudocmds; 3765 3766 foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'})) { 3765 my @lines = shift; 3766 my %sudocmds; 3767 3768 foreach my $c (split(/;/,$pbos->{'update'}),split(/;/,$pbos->{'install'}),@lines) { 3767 3769 next if ($c !~ /^sudo/); 3768 $c =~ s/^sudo[ \t]+//; 3769 push @sudocmds,$c; 3770 } 3771 pb_log(2,"pb_get_sudcomds returns ".Dumper(@sudocmds)."\n"); 3772 return(@sudocmds); 3770 $c =~ s/^sudo\s+//; 3771 $c =~ s/^\s+//; 3772 $c =~ s/\s+$//; 3773 $sudocmds{$c} = ""; 3774 } 3775 pb_log(2,"pb_get_sudcomds returns ".Dumper(%sudocmds)."\n"); 3776 return(keys %sudocmds); 3773 3777 } 3774 3778
Note:
See TracChangeset
for help on using the changeset viewer.