Changeset 639 in ProjectBuilder for devel/pb/bin
- Timestamp:
- Dec 11, 2008, 12:30:24 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r632 r639 1380 1380 $ENV{'PBVMOPT'} = ""; 1381 1381 } 1382 # Save the current status for later restoration 1383 $ENV{'PBOLDVMOPT'} = $ENV{'PBVMOPT'}; 1382 1384 # Set a default timeout of 2 minutes 1383 1385 if (not defined $ENV{'PBVMTMOUT'}) { … … 1429 1431 die "VM of type $vmtype not supported. Report to the dev team"; 1430 1432 } 1433 # Restore the ENV VAR Value 1434 $ENV{'PBMOPT'} = $ENV{'PBOLDVMOPT'}; 1435 1431 1436 my ($tmpcmd,$void) = split(/ +/,$cmd); 1432 1437 my $vmexist = pb_check_ps($tmpcmd,$vmm); … … 1492 1497 } 1493 1498 1499 # Return string for date synchro 1500 sub pb_date_v { 1501 1502 my $vtype = shift; 1503 1504 my ($ntp) = pb_conf_get($vtype."ntp"); 1505 my $vntp = $ntp->{$ENV{'PBPROJ'}}; 1506 my $ntpline; 1507 1508 if (defined $vntp) { 1509 $ntpline = "sudo /usr/sbin/ntpdate $vntp"; 1510 } else { 1511 $ntpline = undef; 1512 } 1513 # Force new date to be in the future compared to the date 1514 # of the host by adding 1 minute 1515 my @date=pb_get_date(); 1516 $date[1]++; 1517 my $upddate = strftime("%m%d%H%M%Y", @date); 1518 my $dateline = "sudo date $upddate"; 1519 return($ntpline,$dateline); 1520 } 1521 1494 1522 sub pb_build2v { 1495 1523 … … 1498 1526 # Prepare the script to be executed on the VM/VE 1499 1527 # in $ENV{'PBDESTDIR'}/pbscript 1500 #my ($ntp) = pb_conf_get($vtype."ntp"); 1501 #my $vntp = $ntp->{$ENV{'PBPROJ'}}; 1502 1528 my ($ntpline,$dateline) = pb_date_v($vtype); 1503 1529 open(SCRIPT,"> $ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript"; 1504 1530 print SCRIPT "#!/bin/bash\n"; … … 1510 1536 print SCRIPT "mv .pbrc \$HOME\n"; 1511 1537 print SCRIPT "cd ..\n"; 1512 # Force new date to be in the future compared to the date of the tar file by adding 1 minute 1513 my @date=pb_get_date(); 1514 $date[1]++; 1515 my $upddate = strftime("%m%d%H%M%Y", @date); 1516 #print SCRIPT "echo Setting up date on $vntp...\n"; 1517 # Or use ntpdate if available TBC 1518 print SCRIPT "sudo date $upddate\n"; 1538 print SCRIPT "# Time sync\n"; 1539 if (defined $ntpline) { 1540 print SCRIPT "if [ -x /usr/sbin/ntpdate ]; then\n"; 1541 print SCRIPT " $ntpline\n"; 1542 print SCRIPT "else\n"; 1543 } 1544 print SCRIPT " $dateline\n"; 1545 if (defined $ntpline) { 1546 print SCRIPT "fi\n"; 1547 } 1548 1519 1549 # Get list of packages to build and get some ENV vars as well 1520 1550 my $ptr = pb_get_pkg(); … … 1698 1728 my $pbscript = "$ENV{'PBDESTDIR'}/setupv"; 1699 1729 1730 # Deal with date sync. 1731 my ($ntpline,$dateline) = pb_date_v($vtype); 1732 1700 1733 foreach my $v (@$vm) { 1701 1734 # Name of the account to deal with for VM/VE … … 1703 1736 my ($pbac) = pb_conf_get($vtype."login"); 1704 1737 my ($key,$zero0,$zero1,$zero2); 1705 my ($vmexist,$vmpid ,$ntps);1738 my ($vmexist,$vmpid); 1706 1739 1707 1740 if ($vtype eq "vm") { … … 1711 1744 my ($vmhost,$vmport,$vmntp) = pb_conf_get("vmhost","vmport","vmntp"); 1712 1745 my $nport = $vmport->{$ENV{'PBPROJ'}}; 1713 $ntps = $vmntp->{$ENV{'PBPROJ'}};1714 1746 $nport = "$pbport" if (defined $pbport); 1715 1747 … … 1777 1809 1778 1810 # Sync date 1779 pb_system("/usr/sbin/ntpdate $ntps","Syncing date to $ntps"); 1780 1781 EOF 1811 EOF 1812 if (defined $ntpline) { 1813 print SCRIPT "if ( -x /usr/sbin/ntpdate ) {\n"; 1814 print SCRIPT " system(\"$ntpline\")\n"; 1815 print SCRIPT "} else {\n"; 1816 } 1817 print SCRIPT " system(\"$dateline\")\n"; 1818 if (defined $ntpline) { 1819 print SCRIPT "}\n"; 1820 } 1782 1821 } 1783 1822 print SCRIPT << 'EOF';
Note:
See TracChangeset
for help on using the changeset viewer.