Changeset 1900 in ProjectBuilder for devel/pb/bin/pb
- Timestamp:
- Sep 30, 2014, 10:08:03 AM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1886 r1900 62 62 my $pbport; # Port to use to connect to the VM/RM 63 63 my $newver; # New version to create 64 my $iso = undef; # ISO image for the VM to create 64 my $pbimage = undef; # ISO image for the VM to create or docker image for the VE 65 my $vetype = undef; # Type of Virtual environment to deal with 65 66 66 67 my @date = pb_get_date(); … … 85 86 =head1 SYNOPSIS 86 87 87 pb [-vhSq][-r pbroot][-p project][[-s script -a account -P port][- t [os-ver-arch]][-m os-ver-arch[,...]]][-g][-i iso] <action> [<pkg1> ...]88 89 pb [--verbose][--help][--man][--quiet][--snapshot][--revision pbroot][--project project][[--script script --account account --port port][- -target [os-ver-arch]][--machine os-ver-arch[,...]]][--nographic][--iso iso][--rebuild] <action> [<pkg1> ...]88 pb [-vhSq][-r pbroot][-p project][[-s script -a account -P port][-T VEtype][-t [os-ver-arch]][-m os-ver-arch[,...]]][-g][-i image] <action> [<pkg1> ...] 89 90 pb [--verbose][--help][--man][--quiet][--snapshot][--revision pbroot][--project project][[--script script --account account --port port][-T VEtype][--target [os-ver-arch]][--machine os-ver-arch[,...]]][--nographic][--image image][--rebuild] <action> [<pkg1> ...] 90 91 91 92 =head1 OPTIONS … … 124 125 All if none precised (or use the env variable PBV). 125 126 127 =item B<-T|--vetype VEtype]> 128 129 Type of Virtual Environments (VE) 130 Can be chroot or docker. 131 126 132 =item B<-s|--script script> 127 133 … … 132 138 Do not launch VMs in graphical mode. 133 139 134 =item B<-i|--iso iso_image> 135 136 Name of the ISO image of the distribution you want to install on the related VMs. 140 =item B<-i|--image image> 141 142 It could be either: 143 - The name of the ISO image of the distribution you want to install on the related VMs 144 - The name of the docker image of the distribution you want to install on the related VEs 145 137 146 138 147 =item B<-a|--account account> … … 670 679 671 680 GetOptions("help|?|h+" => \$opts{'h'}, 681 "account|a=s" => \$opts{'a'}, 682 "force|f" => \$opts{'f'}, 683 "nographic|g" => \$opts{'g'}, 684 "image|i=s" => \$opts{'i'}, 685 "log-files|l=s" => \$opts{'l'}, 686 "machines|mock|m=s" => \$opts{'m'}, 672 687 "man" => \$opts{'man'}, 673 "verbose|v+" => \$opts{'v'},674 "snapshot|S" => \$opts{'S'},675 "quiet|q" => \$opts{'q'},676 "log-files|l=s" => \$opts{'l'},677 "force|f" => \$opts{'f'},678 "account|a=s" => \$opts{'a'},679 "revision|r=s" => \$opts{'r'},680 "script|s=s" => \$opts{'s'},681 "machines|mock|m=s" => \$opts{'m'},682 "target|t:s" => \$opts{'t'},683 "nographic|g" => \$opts{'g'},684 688 "port|P=i" => \$opts{'P'}, 685 689 "project|p=s" => \$opts{'p'}, 690 "quiet|q" => \$opts{'q'}, 691 "revision|r=s" => \$opts{'r'}, 686 692 "rebuild" => \$opts{'rebuild'}, 687 "iso|i=s" => \$opts{'i'}, 693 "snapshot|S" => \$opts{'S'}, 694 "script|s=s" => \$opts{'s'}, 695 "type|T:s" => \$opts{'T'}, 696 "target|t:s" => \$opts{'t'}, 688 697 "version|V=s" => \$opts{'V'}, 698 "verbose|v+" => \$opts{'v'}, 689 699 "keep|k" => \$opts{'k'}, 690 700 "stop-on-error!" => \$Global::pb_stop_on_error, … … 743 753 } 744 754 if (defined $opts{'i'}) { 745 $ iso= $opts{'i'};755 $pbimage = $opts{'i'}; 746 756 } 747 757 if (defined $opts{'t'}) { 748 758 $pbtarget = $opts{'t'}; 759 } 760 if (defined $opts{'T'}) { 761 $vetype = $opts{'T'}; 749 762 } 750 763 … … 2353 2366 my ($shcmd,$shcmdroot,$cpcmd,$cptarget,$cp2target); 2354 2367 my $tpdir; 2368 my $tp; 2355 2369 if ($cmt =~ /^VE/) { 2356 my$tp = pb_path_expand($vepath->{$ENV{'PBPROJ'}});2370 $tp = pb_path_expand($vepath->{$ENV{'PBPROJ'}}); 2357 2371 $tpdir = pb_path_expand("$tp/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}"); 2358 my ($ptr) = pb_conf_get("vetype"); 2359 my $vetype = $ptr->{$ENV{'PBPROJ'}}; 2372 if (not defined $vetype) { 2373 my ($ptr) = pb_conf_get("vetype"); 2374 $vetype = $ptr->{$ENV{'PBPROJ'}}; 2375 } 2360 2376 my $arch = pb_get_arch(); 2361 2377 if ($vetype eq "chroot") { … … 2364 2380 } elsif ($vetype eq "schroot") { 2365 2381 $shcmd = "schroot $tp -u $mac -- "; 2382 } elsif ($vetype eq "docker") { 2383 # docker manages the storage so rely on it 2384 $shcmdroot = "sudo /usr/bin/docker $tpdir "; 2385 $shcmd = "$shcmdroot /bin/su - $mac -c "; 2366 2386 } 2367 2387 $shcmd = "setarch i386 $shcmd" if (($pbos->{'arch'} =~ /i[3456]86/) && ($arch eq 'x86_64')); … … 2533 2553 } 2534 2554 if (($cmt =~ /^VE/) && ($snapme != 0)) { 2535 my $tpdir = "$vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}"; 2536 pb_system("sudo tar cz -C $tpdir -f $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}.tar.gz .","Creating a snapshot of $tpdir"); 2555 pb_ve_snap($pbos,$tp); 2537 2556 } 2538 2557 } … … 2617 2636 # Launch the VMs/VEs 2618 2637 if ($vtype eq "vm") { 2619 die "-i i so parameter needed" if (((not defined $iso) || ($isoeq "")) && ($create != 0));2638 die "-i image parameter needed" if (((not defined $pbimage) || ($pbimage eq "")) && ($create != 0)); 2620 2639 2621 2640 my ($ptr,$ptr2,$vmpath,$vmport,$vms) = pb_conf_get("vmtype","vmcmd","vmpath","vmport","vmsize"); … … 2683 2702 if (($vmtype eq "qemu") || ($vmtype eq "kvm")) { 2684 2703 $vmm = "$vmpath->{$ENV{'PBPROJ'}}/$v.qemu"; 2685 if (($create != 0) || (defined $ iso)) {2686 $ENV{'PBVMOPT'} .= " -cdrom $ iso-boot d";2704 if (($create != 0) || (defined $pbimage)) { 2705 $ENV{'PBVMOPT'} .= " -cdrom $pbimage -boot d"; 2687 2706 } 2688 2707 # Always redirect the network and always try to use a 'pb' snapshot … … 2746 2765 } elsif ($vtype eq "ve") { 2747 2766 # Force the creation of the VE and no snapshot usable 2748 pb_ve_launch($v,$create,$usesnap );2767 pb_ve_launch($v,$create,$usesnap,$vetype,$pbimage); 2749 2768 } else { 2750 2769 # RM here … … 3504 3523 # And shouldn't we be getting the one that matches the current pb version? 3505 3524 # For the moment, just take the latest stable one 3506 $cmdget = "wget --passive-ftp ftp://ftp.project-builder.org/src/ProjectBuilder-latest.tar.gz; wget --passive-ftp ftp://ftp.project-builder.org/src/project-builder-latest.tar.gz"; 3525 my $wget = pb_check_req("wget",0); 3526 $cmdget = "$wget --passive-ftp ftp://ftp.project-builder.org/src/ProjectBuilder-latest.tar.gz; $wget --passive-ftp ftp://ftp.project-builder.org/src/project-builder-latest.tar.gz"; 3507 3527 } 3508 3528 print SCRIPT << 'EOF';
Note:
See TracChangeset
for help on using the changeset viewer.