Changeset 353 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Apr 5, 2008, 2:36:14 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r352 r353 377 377 # Handles project name if any 378 378 # And get global params 379 if (defined $opts{'p'}) { 380 ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir) 381 = pb_env_init($opts{'p'},$pbinit); 382 } else { 383 ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir) 384 = pb_env_init(undef,$pbinit); 385 } 379 ($filteredfiles, $supfiles, $defpkgdir, $extpkgdir) = pb_env_init($opts{'p'},$pbinit,$action); 386 380 387 381 pb_log(0,"Project: $ENV{'PBPROJ'}\n"); 388 382 pb_log(0,"Action: $action\n"); 389 390 # Keep those project values to store them at the end each time391 my $pbprojtag = $ENV{'PBTAG'};392 my $pbprojver = $ENV{'PBVER'};393 383 394 384 # Act depending on action … … 432 422 pb_launchv("vm",$ENV{'PBV'},1); 433 423 } elsif ($action =~ /^setupve$/) { 434 my $pbscript = pb_setup_v("ve"); 435 # That buil script needs to be run as root 436 $pbaccount = "root"; 437 pb_script2v($pbscript,"ve"); 424 pb_setup_v("ve"); 438 425 } elsif ($action =~ /^setupvm$/) { 439 my $pbscript = pb_setup_v("vm"); 440 # That buil script needs to be run as root 441 $pbaccount = "root"; 442 pb_script2v($pbscript,"vm"); 426 pb_setup_v("vm"); 443 427 } elsif ($action =~ /^newproj$/) { 444 428 # Nothing to do - already done in pb_env_init … … 451 435 sub pb_cms2build { 452 436 453 my $ptr = pb_ get_pkg($defpkgdir,$extpkgdir);437 my $ptr = pb_cms_get_pkg($defpkgdir,$extpkgdir); 454 438 @pkgs = @$ptr; 455 439 … … 460 444 # declare packager for filtering 461 445 my ($tmp) = pb_conf_get("pbpackager"); 462 my $pbpackager= $tmp->{$ENV{'PBPROJ'}};446 $ENV{'PBPACKAGER'} = $tmp->{$ENV{'PBPROJ'}}; 463 447 464 448 foreach my $pbpkg (@pkgs) { 465 449 $ENV{'PBPKG'} = $pbpkg; 466 $ENV{'PBVER'} = $pbprojver;467 $ENV{'PBTAG'} = $pbprojtag;468 450 if ((defined $pkgv) && (defined $pkgv->{$pbpkg})) { 469 451 $pbver = $pkgv->{$pbpkg}; 470 $ENV{'PBVER'} = $pbver;471 452 } else { 472 $pbver = $ENV{'PB VER'};453 $pbver = $ENV{'PBPROJVER'}; 473 454 } 474 455 if ((defined $pkgt) && (defined $pkgt->{$pbpkg})) { 475 456 $pbtag = $pkgt->{$pbpkg}; 476 $ENV{'PBTAG'} = $pbtag;477 457 } else { 478 $pbtag = $ENV{'PB TAG'};458 $pbtag = $ENV{'PBPROJTAG'}; 479 459 } 480 460 … … 567 547 if (defined $ptr) { 568 548 foreach my $f (values %bfiles,values %pkgfiles) { 569 pb_filter_file_pb("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$ pbpackager,$chglog);549 pb_filter_file_pb("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$ENV{'PBPACKAGER'},$chglog); 570 550 } 571 551 } … … 589 569 if (defined $filteredfiles->{$pbpkg}) { 590 570 foreach my $f (split(/,/,$filteredfiles->{$pbpkg})) { 591 pb_filter_file_inplace($ptr,"$dest/$f",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ pbpackager);571 pb_filter_file_inplace($ptr,"$dest/$f",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'}); 592 572 $liste = "$f $liste"; 593 573 } … … 597 577 # Prepare the dest directory for archive 598 578 if (-x "$ENV{'PBROOTDIR'}/$pbpkg/pbinit") { 599 pb_filter_file("$ENV{'PBROOTDIR'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ pbpackager);579 pb_filter_file("$ENV{'PBROOTDIR'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$ENV{'PBPROJ'},$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'}); 600 580 chmod 0755,"$ENV{'PBTMP'}/pbinit"; 601 581 pb_system("cd $dest ; $ENV{'PBTMP'}/pbinit","Executing init script from $ENV{'PBROOTDIR'}/$pbpkg/pbinit"); … … 609 589 610 590 # Keep track of what is generated by default 611 open(LAST,"> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc"; 612 #print LAST "pbroot $pbprojver-$pbprojtag = $ENV{'PBROOTDIR'}\n"; 613 # Why not use pbproj ? 591 # We need to store the dir and info on version-tag 592 # Base our content on the existing .pb file 593 copy("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb","$ENV{'PBDESTDIR'}/pbrc"); 594 open(LAST,">> $ENV{'PBDESTDIR'}/pbrc") || die "Unable to create $ENV{'PBDESTDIR'}/pbrc"; 614 595 print LAST "pbroot $ENV{'PBPROJ'} = $ENV{'PBROOTDIR'}\n"; 596 print LAST "pbprojver $ENV{'PBPROJ'} = $ENV{'PBPROJVER'}\n"; 597 print LAST "pbprojtag $ENV{'PBPROJ'} = $ENV{'PBPROJTAG'}\n"; 598 print LAST "pbpackager $ENV{'PBPROJ'} = $ENV{'PBPACKAGER'}\n"; 615 599 close(LAST); 616 600 617 601 # Keep track of per package version 618 my ($pkg) = pb_conf_read_if("$ENV{'PBDESTDIR'}/$ pbprojver-$pbprojtag.pb","pbpkg");602 my ($pkg) = pb_conf_read_if("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 619 603 $pkg = { } if (not defined $pkg); 620 604 if ((not defined $pkg->{$pbpkg}) || ($pkg->{$pbpkg} ne "$pbver-$pbtag")) { … … 623 607 624 608 pb_log(2,"DEBUG pkg: ".Dumper($pkg)."\n"); 625 open(PKG,"> $ENV{'PBDESTDIR'}/$ pbprojver-$pbprojtag.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb";609 open(PKG,"> $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb") || die "Unable to create $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb"; 626 610 foreach my $p (keys %$pkg) { 627 611 print PKG "pbpkg $p = $pkg->{$p}\n"; … … 635 619 636 620 sub pb_build2pkg { 637 638 # Get list of packages to build639 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);640 @pkgs = @$ptr;641 621 642 622 # Get the running distro to build on … … 644 624 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n"); 645 625 626 # Get list of packages to build 646 627 # Get content saved in cms2build 647 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$pbprojver-$pbprojtag.pb","pbpkg"); 628 my $ptr = pb_get_pkg(); 629 @pkgs = @$ptr; 630 631 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 648 632 $pkg = { } if (not defined $pkg); 649 650 # declare packager (via env var in VM/VE651 my $pbpackager;652 if (not defined $ENV{'PBPACKAGER'}) {653 my ($tmp) = pb_conf_get("pbpackager");654 $pbpackager = $tmp->{$ENV{'PBPROJ'}};655 } else {656 $pbpackager = $ENV{'PBPACKAGER'};657 }658 633 659 634 chdir "$ENV{'PBBUILDDIR'}"; … … 687 662 foreach my $f (@specfile) { 688 663 if ($f =~ /\.spec$/) { 689 pb_system("rpmbuild --define \'packager $ pbpackager\' --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}");664 pb_system("rpmbuild --define \'packager $ENV{'PBPACKAGER'}\' --define \"_topdir $ENV{'PBBUILDDIR'}\" -ba $f","Building package with $f under $ENV{'PBBUILDDIR'}"); 690 665 last; 691 666 } … … 766 741 } 767 742 # Keep track of what is generated so that we can get them back from VMs 768 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ pbprojver-$pbprojtag") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";743 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to create $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 769 744 print KEEP "$made\n"; 770 745 close(KEEP); … … 815 790 my $cmd = ""; 816 791 817 # Get list of packages to build 818 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir); 792 my $ptr = pb_get_pkg(); 819 793 @pkgs = @$ptr; 820 794 … … 827 801 pb_log(2,"DEBUG: distro tuple: ".join(',',($ddir, $dver, $dfam, $dtype, $pbsuf))."\n"); 828 802 803 # Get list of packages to build 829 804 # Get content saved in cms2build 830 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ pbprojver-$pbprojtag.pb","pbpkg");805 my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 831 806 $pkg = { } if (not defined $pkg); 832 807 … … 848 823 } 849 824 if (($cmt eq "vm") || ($cmt eq "ve")) { 850 $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ pbprojver-$pbprojtag.pb $ENV{'PBETC'}";825 $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc"; 851 826 } elsif ($cmt eq "Script") { 852 827 $src="$src $ENV{'PBDESTDIR'}/pbscript"; 853 828 } elsif ($cmt eq "Packages") { 854 829 # Get package list from file made during build2pkg 855 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";830 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 856 831 $src = <KEEP>; 857 832 chomp($src); … … 945 920 if (($cmt eq "vm") || ($cmt eq "ve")) { 946 921 # Get back info on pkg produced, compute their name and get them from the VM 947 pb_system("$cpcmd $cp2target/pbgen-$ pbprojver-$pbprojtag$ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $cp2target");948 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ pbprojver-$pbprojtag") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";922 pb_system("$cpcmd $cp2target/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'} $ENV{'PBBUILDDIR'} 2> /dev/null","Get package names in $cp2target"); 923 open(KEEP,"$ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to read $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 949 924 my $src = <KEEP>; 950 925 chomp($src); … … 954 929 # Change pgben to make the next send2target happy 955 930 my $made = ""; 956 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ pbprojver-$pbprojtag") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$pbprojver-$pbprojtag";931 open(KEEP,"> $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}") || die "Unable to write $ENV{'PBBUILDDIR'}/pbgen-$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}"; 957 932 foreach my $p (split(/ +/,$src)) { 958 933 my $j = basename($p); … … 1126 1101 # Prepare the script to be executed on the VM/VE 1127 1102 # in $ENV{'PBDESTDIR'}/pbscript 1128 my ($ntp) = pb_conf_get($vtype."ntp");1129 my $vntp = $ntp->{$ENV{'PBPROJ'}};1103 #my ($ntp) = pb_conf_get($vtype."ntp"); 1104 #my $vntp = $ntp->{$ENV{'PBPROJ'}}; 1130 1105 1131 1106 open(SCRIPT,"> $ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript"; … … 1142 1117 $date[1]++; 1143 1118 my $upddate = strftime("%m%d%H%M%Y", @date); 1144 print SCRIPT "echo Setting up date on $vntp...\n";1119 #print SCRIPT "echo Setting up date on $vntp...\n"; 1145 1120 # Or use ntpdate if available TBC 1146 1121 print SCRIPT "sudo date $upddate\n"; 1147 # This exports avoids pb_env_init to deal with PBCONF stuff 1148 print SCRIPT "export PBCONF=/tmp\n"; 1149 print SCRIPT "export PBVER=$ENV{'PBVER'}\n"; 1150 print SCRIPT "export PBTAG=$ENV{'PBTAG'}\n"; 1122 # Get list of packages to build and get some ENV vars as well 1123 my $ptr = pb_get_pkg(); 1124 @pkgs = @$ptr; 1125 my $p = join(' ',@pkgs) if (@pkgs); 1126 print SCRIPT "export PBPROJVER=$ENV{'PBPROJVER'}\n"; 1127 print SCRIPT "export PBPROJTAG=$ENV{'PBPROJTAG'}\n"; 1151 1128 print SCRIPT "export PBPACKAGER=\"$ENV{'PBPACKAGER'}\"\n"; 1152 1129 print SCRIPT "# Build\n"; 1153 # Get list of packages to build1154 my $ptr = pb_get_pkg($defpkgdir,$extpkgdir);1155 @pkgs = @$ptr;1156 my $p = join(' ',@pkgs) if (@pkgs);1157 1130 print SCRIPT "echo Building packages on $vtype...\n"; 1158 1131 print SCRIPT "pb -p $ENV{'PBPROJ'} build2pkg $p\n"; … … 1247 1220 my $vtype = shift; 1248 1221 1222 my ($vm,$all) = pb_get_v($vtype); 1223 1249 1224 # Script generated 1250 1225 my $pbscript = "$ENV{'PBDESTDIR'}/setupv"; 1251 1226 1252 # Name of the account to deal with for VM/VE 1253 # Do not use the one passed potentially with -a 1254 my ($pbaccount) = pb_conf_get($vtype."login"); 1255 1256 if ($vtype eq "vm") { 1257 # Prepare the key to be used and transfered remotely 1258 my $keyfile = pb_ssh_get(1); 1227 foreach my $v (@$vm) { 1228 # Name of the account to deal with for VM/VE 1229 # Do not use the one passed potentially with -a 1230 my ($pbac) = pb_conf_get($vtype."login"); 1231 1232 if ($vtype eq "vm") { 1233 # Prepare the key to be used and transfered remotely 1234 my $keyfile = pb_ssh_get(1); 1235 1236 my ($vmhost,$vmport) = pb_conf_get("vmhost","vmport"); 1237 my $nport = $vmport->{$ENV{'PBPROJ'}}; 1238 $nport = "$pbport" if (defined $pbport); 1259 1239 1260 my ($vmhost,$vmport) = pb_conf_get("vmhost","vmport"); 1261 my $nport = $vmport->{$ENV{'PBPROJ'}}; 1262 $nport = "$pbport" if (defined $pbport); 1263 1264 pb_system("cat $keyfile.pub | ssh -q -p $nport -i $keyfile root\@$vmhost->{$ENV{'PBPROJ'}} \"mkdir .ssh ; chmod 700 .ssh ; cat > .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys\"","Copying local keys to $vtype. This will require the root password"); 1265 # once this is done, we can do what we want on the VM remotely 1266 } 1267 1268 # Prepare the script to be executed on the VM/VE 1269 # in $ENV{'PBDESTDIR'}/setupv 1270 1271 open(SCRIPT,"> $pbscript") || die "Unable to create $pbscript"; 1272 print SCRIPT << 'EOF'; 1240 # Launch the VM 1241 my ($vmexist,$vmpid) = pb_launchv($vtype,$v,0); 1242 1243 # Skip that VM if something went wrong 1244 return if (($vmpid == 0) && ($vmexist == 0)); 1245 1246 pb_system("cat $keyfile.pub | ssh -q -p $nport -i $keyfile root\@$vmhost->{$ENV{'PBPROJ'}} \"mkdir -p .ssh ; chmod 700 .ssh ; cat >> .ssh/authorized_keys ; chmod 600 .ssh/authorized_keys\"","Copying local keys to $vtype. This will require the root password"); 1247 # once this is done, we can do what we want on the VM remotely 1248 } 1249 1250 # Prepare the script to be executed on the VM/VE 1251 # in $ENV{'PBDESTDIR'}/setupv 1252 1253 open(SCRIPT,"> $pbscript") || die "Unable to create $pbscript"; 1254 print SCRIPT << 'EOF'; 1273 1255 #!/usr/bin/perl -w 1274 1256 … … 1281 1263 while (<PBFILE>) { 1282 1264 EOF 1283 print SCRIPT << "EOF";1284 \$found = 1 if (/^$pbac count->{$ENV{'PBPROJ'}}:/);1265 print SCRIPT << "EOF"; 1266 \$found = 1 if (/^$pbac->{$ENV{'PBPROJ'}}:/); 1285 1267 EOF 1286 print SCRIPT << 'EOF';1268 print SCRIPT << 'EOF'; 1287 1269 } 1288 1270 close(PBFILE); … … 1293 1275 } 1294 1276 EOF 1295 print SCRIPT << "EOF";1296 system "groupadd $pbac count->{$ENV{'PBPROJ'}}";1297 system "useradd $pbac count->{$ENV{'PBPROJ'}} -g $pbaccount->{$ENV{'PBPROJ'}} -m -d /home/$pbaccount->{$ENV{'PBPROJ'}}";1277 print SCRIPT << "EOF"; 1278 system "groupadd $pbac->{$ENV{'PBPROJ'}}"; 1279 system "useradd $pbac->{$ENV{'PBPROJ'}} -g $pbac->{$ENV{'PBPROJ'}} -m -d /home/$pbac->{$ENV{'PBPROJ'}}"; 1298 1280 1299 1281 # For pb 1300 chdir "/home/$pbac count->{$ENV{'PBPROJ'}}";1282 chdir "/home/$pbac->{$ENV{'PBPROJ'}}"; 1301 1283 mkdir ".ssh",0700; 1302 1284 # Allow those accessing root to access the build account 1303 1285 copy("\$ENV{'HOME'}/.ssh/authorized_keys",".ssh/authorized_keys"); 1304 1286 chmod 0600,".ssh/authorized_keys"; 1305 system 'chown -R $pbac count->{$ENV{'PBPROJ'}}:$pbaccount->{$ENV{'PBPROJ'}} .ssh';1287 system 'chown -R $pbac->{$ENV{'PBPROJ'}}:$pbac->{$ENV{'PBPROJ'}} .ssh'; 1306 1288 1307 1289 EOF 1308 print SCRIPT << 'EOF';1290 print SCRIPT << 'EOF'; 1309 1291 } 1310 1292 … … 1315 1297 while (<PBFILE>) { 1316 1298 EOF 1317 print SCRIPT << "EOF";1318 s/^$pbac count->{$ENV{'PBPROJ'}}:\!\!:/$pbaccount->{$ENV{'PBPROJ'}}:*:/;1319 s/^$pbac count->{$ENV{'PBPROJ'}}:\!:/$pbaccount->{$ENV{'PBPROJ'}}:*:/; #SLES 9 e.g.1299 print SCRIPT << "EOF"; 1300 s/^$pbac->{$ENV{'PBPROJ'}}:\!\!:/$pbac->{$ENV{'PBPROJ'}}:*:/; 1301 s/^$pbac->{$ENV{'PBPROJ'}}:\!:/$pbac->{$ENV{'PBPROJ'}}:*:/; #SLES 9 e.g. 1320 1302 EOF 1321 print SCRIPT << 'EOF';1303 print SCRIPT << 'EOF'; 1322 1304 print PBOUT $_; 1323 1305 } … … 1335 1317 while (<PBFILE>) { 1336 1318 EOF 1337 print SCRIPT << "EOF";1338 next if (/^$pbac count->{$ENV{'PBPROJ'}} /);1319 print SCRIPT << "EOF"; 1320 next if (/^$pbac->{$ENV{'PBPROJ'}} /); 1339 1321 EOF 1340 print SCRIPT << 'EOF';1322 print SCRIPT << 'EOF'; 1341 1323 s/Defaults[ \t]+requiretty//; 1342 1324 print PBOUT $_; … … 1344 1326 close(PBFILE); 1345 1327 EOF 1346 print SCRIPT << "EOF";1347 # This is needed in order to be able to halt the machine from the $pbac count->{$ENV{'PBPROJ'}} account at least1348 print PBOUT "$pbac count->{$ENV{'PBPROJ'}} ALL=(ALL) NOPASSWD:ALL\n";1328 print SCRIPT << "EOF"; 1329 # This is needed in order to be able to halt the machine from the $pbac->{$ENV{'PBPROJ'}} account at least 1330 print PBOUT "$pbac->{$ENV{'PBPROJ'}} ALL=(ALL) NOPASSWD:ALL\n"; 1349 1331 EOF 1350 print SCRIPT << 'EOF';1332 print SCRIPT << 'EOF'; 1351 1333 close(PBOUT); 1352 1334 rename("$file.new",$file); … … 1354 1336 1355 1337 EOF 1356 1357 my $SCRIPT = \*SCRIPT;1358 1359 pb_install_deps($SCRIPT);1360 1361 print SCRIPT << 'EOF';1338 1339 my $SCRIPT = \*SCRIPT; 1340 1341 pb_install_deps($SCRIPT); 1342 1343 print SCRIPT << 'EOF'; 1362 1344 # Suse wants sudoers as 640 1363 1345 if (($ddir eq "sles") || (($ddir eq "suse")) && ($dver ne "10.3")) { … … 1366 1348 1367 1349 # Sync date 1368 system "/usr/sbin/ntpdate ntp.pool.org";1350 #system "/usr/sbin/ntpdate ntp.pool.org"; 1369 1351 1370 1352 system "rm -rf project-builder-* ; wget --passive-ftp ftp://ftp.mondorescue.org/src/project-builder-latest.tar.gz ; tar xvfz project-builder-latest.tar.gz ; cd project-builder-* ; perl Makefile.PL ; make ; make install ; cd .. ; rm -rf project-builder-*"; 1371 1353 EOF 1372 1373 # Adds pb_distro_init from ProjectBuilder::Distribution 1374 foreach my $d (@INC) { 1375 my $f = "$d/ProjectBuilder/Distribution.pm"; 1376 if (-f "$f") { 1377 open(PBD,"$f") || die "Unable to open $f"; 1378 while (<PBD>) { 1379 next if (/^package/); 1380 next if (/^use Exporter/); 1381 next if (/^\@our /); 1382 print SCRIPT $_; 1383 } 1384 close(PBD); 1385 last; 1386 } 1387 } 1388 close(SCRIPT); 1389 chmod 0755,"$pbscript"; 1390 return($pbscript); 1354 1355 # Adds pb_distro_init from ProjectBuilder::Distribution 1356 foreach my $d (@INC) { 1357 my $f = "$d/ProjectBuilder/Distribution.pm"; 1358 if (-f "$f") { 1359 open(PBD,"$f") || die "Unable to open $f"; 1360 while (<PBD>) { 1361 next if (/^package/); 1362 next if (/^use Exporter/); 1363 next if (/^\@our /); 1364 print SCRIPT $_; 1365 } 1366 close(PBD); 1367 last; 1368 } 1369 } 1370 close(SCRIPT); 1371 chmod 0755,"$pbscript"; 1372 1373 # That build script needs to be run as root 1374 $pbaccount = "root"; 1375 pb_script2v($pbscript,$vtype); 1376 } 1377 return; 1391 1378 } 1392 1379 … … 1412 1399 } 1413 1400 1414 system "yum -y $opt install rpm-build wget patch ntp sudo perl-DateManip perl- ExtUtils-MakeMaker";1401 system "yum -y $opt install rpm-build wget patch ntp sudo perl-DateManip perl-File-MimeInfo perl-ExtUtils-MakeMaker"; 1415 1402 } elsif (( $dfam eq "rh" ) || ($ddir eq "sles") || (($ddir eq "suse") && (($dver eq "10.1") || ($dver eq "10.0"))) || (($ddir eq "mandrake") && ($dver eq "10.1")) || ($ddir eq "slackware")) { 1416 1403 # Suppose pkg are installed already … … 1426 1413 system "export TERM=linux ; liste=\"\" ; for i in make wget patch sudo perl-DateManip perl-File-HomeDir xntp; do rpm -q \$i 1> /dev/null 2> /dev/null ; if [ \$\? != 0 ]; then liste=\"\$liste \$i\"; fi; done; echo \"Liste: \$liste\" ; if [ \"\$liste\" != \"\" ]; then yast2 -i \$liste ; fi"; 1427 1414 } elsif ( $dfam eq "md" ) { 1428 system "urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl- DateManip";1415 system "urpmi.update -a ; urpmi --auto rpm-build wget sudo patch ntp-client perl-File-MimeInfo perl-DateManip"; 1429 1416 } elsif ( $dfam eq "du" ) { 1430 1417 if (( $dver eq "3.1" ) && ($ddir eq "debian")) { 1431 1418 #system "apt-get update"; 1432 system "apt-get -y install wget patch ssh sudo debian-builder dh-make fakeroot ntpdate lib date-manip-perl";1419 system "apt-get -y install wget patch ssh sudo debian-builder dh-make fakeroot ntpdate libfile-mimeinfo-perl libdate-manip-perl"; 1433 1420 } else { 1434 system "apt-get update; apt-get -y install wget patch openssh-server dpkg-dev sudo debian-builder dh-make fakeroot ntpdate rses5-dev lib date-manip-perl";1421 system "apt-get update; apt-get -y install wget patch openssh-server dpkg-dev sudo debian-builder dh-make fakeroot ntpdate rses5-dev libfile-mimeinfo-perl libdate-manip-perl"; 1435 1422 } 1436 1423 } elsif ( $dfam eq "gen" ) {
Note:
See TracChangeset
for help on using the changeset viewer.