Changeset 1348


Ignore:
Timestamp:
Oct 26, 2011, 11:28:44 AM (8 years ago)
Author:
bruno
Message:

r4374@localhost: bruno | 2011-10-25 12:10:59 +0200

  • Add mkbmpath parameter and document it
  • Create a new VE.pm module to host pb_ve_launch (from pb code now reusable for pbmkbm)
Location:
devel
Files:
1 added
5 edited

Legend:

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

    r1318 r1348  
    358358#rbsmirrorsrv debian = http://ftp.us.debian.org/debian/
    359359#rbsmirrorsrv ubuntu = http://us.releases.ubuntu.com/releases/
     360#
     361
     362#
     363# pbmkbm configuration parameters
     364#
     365mkbmpath default = /var/cache/pbmkbm
    360366
    361367# pb install dependencies per distro
  • devel/pb-modules/etc/pb.conf.pod

    r1287 r1348  
    5454 Conffile: project
    5555 Example: filteredfiles mindi = rootfs/sbin/init,mindi,install.sh,doc/mindi.8
     56
     57=item B<mkbmpath>
     58
     59 Nature: Mandatory
     60 Key: OS (could be from the most generic up to the most specific from ostype, osfamily, os, os-ver, os-ver-arch). The family name is generaly used here.
     61 Value: path of the temporary directory into which the boot media is created.
     62 Conffile: pb
     63 Example: mkbmpath default = /var/cache/pbmkbm
    5664
    5765=item B<namingtype>
  • devel/pb-modules/lib/ProjectBuilder/Env.pm

    r1312 r1348  
    5959sub pb_env_init_pbrc {
    6060
    61 # if sudo, then get the real id of the user laucnhing the context
     61# if sudo, then get the real id of the user launching the context
    6262# to point to the right conf file
    6363# Mandatory for rpmbootstrap calls
  • devel/pb/bin/pb

    r1340 r1348  
    3636use ProjectBuilder::Filter;
    3737use ProjectBuilder::Changelog;
     38use ProjectBuilder::VE;
    3839
    3940# Global variables
     
    20692070    my $create = shift || 0;        # By default do not create a VM/VE/RM
    20702071    my $snapme = shift || 0;        # By default do not snap a VM/VE/RM
     2072    my $usesnap = shift || 1;       # By default study the usage of the snapshot feature of VM/VE/RM    my $create = shift || 0;        # By default do not create a VM/VE/RM
     2073    my $snapme = shift || 0;        # By default do not snap a VM/VE/RM
    20712074    my $usesnap = shift || 1;       # By default study the usage of the snapshot feature of VM/VE/RM
     2075
    20722076
    20732077    # If creation or snapshot creation mode, no snapshot usable
     
    20822086
    20832087    my $pbos = pb_distro_get_context($v);
    2084     my $arch = pb_get_arch();
    2085 
     2088   
    20862089    # Launch the VMs/VEs
    20872090    if ($vtype eq "vm") {
     
    22092212        return($vmexist,$vmpid);
    22102213    } elsif ($vtype eq "ve") {
    2211         # VE here
    2212         # Get distro context
    2213         my $pbos = pb_distro_get_context($v);
    2214 
    2215         # Get VE context
    2216         my ($ptr,$vepath) = pb_conf_get("vetype","vepath");
    2217         my $vetype = $ptr->{$ENV{'PBPROJ'}};
    2218 
    2219         # We can probably only get those params now we have the distro context
    2220         my ($rbsb4pi,$rbspi,$vesnap,$oscodename,$osmindep,$verebuild,$rbsmirrorsrv) = pb_conf_get_if("rbsb4pi","rbspi","vesnap","oscodename","osmindep","verebuild","rbsmirrorsrv");
    2221 
    2222         # We need to avoid umask propagation to the VE
    2223         umask 0022;
    2224 
    2225         if (($vetype eq "chroot") || ($vetype eq "schroot")) {
    2226             # Architecture consistency
    2227             if ($arch ne $pbos->{'arch'}) {
    2228                 die "Unable to launch a VE of architecture $pbos->{'arch'} on a $arch platform" if (($pbos->{'arch'} eq "x86_64") && ($arch =~ /i?86/));
    2229             }
    2230 
    2231             my ($verpmtype,$vedebtype) = pb_conf_get("verpmtype","vedebtype");
    2232             if (($create != 0) || ((defined $verebuild) && ($verebuild->{$ENV{'PBPROJ'}} =~ /true/i)) || ($pbforce == 1)) {
    2233                 my ($rbsopt1) = pb_conf_get_if("rbsopt");
    2234 
    2235                 # We have to rebuild the chroot
    2236                 if ($pbos->{'type'} eq "rpm") {
    2237 
    2238                     # Which tool is used
    2239                     my $verpmstyle = $verpmtype->{$ENV{'PBPROJ'}};
    2240 
    2241                     # Get potential rbs option
    2242                     my $rbsopt = "";
    2243                     if (defined $rbsopt1) {
    2244                         if (defined $rbsopt1->{$verpmstyle}) {
    2245                             $rbsopt = $rbsopt1->{$verpmstyle};
    2246                         } elsif (defined $rbsopt1->{$ENV{'PBPROJ'}}) {
    2247                             $rbsopt = $rbsopt1->{$ENV{'PBPROJ'}};
    2248                         } else {
    2249                             $rbsopt = "";
    2250                         }
    2251                     }
    2252 
    2253                     my $postinstall = pb_get_postinstall($pbos,$rbspi,$verpmstyle);
    2254                     if ($verpmstyle eq "rinse") {
    2255                         # Need to reshape the mirrors generated with local before-post-install script
    2256                         my $b4post = "--before-post-install ";
    2257                         my $postparam = pb_distro_get_param($pbos,$rbsb4pi);
    2258                         if ($postparam eq "") {
    2259                             $b4post = "";
    2260                         } else {
    2261                             $b4post .= $postparam;
    2262                         }
    2263 
    2264                         # Need to reshape the package list for pb
    2265                         my $addpkgs;
    2266                         $postparam = "";
    2267                         $postparam .= pb_distro_get_param($pbos,$osmindep);
    2268                         if ($postparam eq "") {
    2269                             $addpkgs = "";
    2270                         } else {
    2271                             my $pkgfile = "$ENV{'PBTMP'}/addpkgs.lis";
    2272                             open(PKG,"> $pkgfile") || die "Unable to create $pkgfile";
    2273                             foreach my $p (split(/,/,$postparam)) {
    2274                                 print PKG "$p\n";
    2275                             }
    2276                             close(PKG);
    2277                             $addpkgs = "--add-pkg-list $pkgfile";
    2278                         }
    2279 
    2280                         my $rinseverb = "";
    2281                         $rinseverb = "--verbose" if ($pbdebug gt 0);
    2282                         my ($rbsconf) = pb_conf_get("rbsconf");
    2283 
    2284                         my $command = pb_check_req("rinse",0);
    2285                         pb_system("sudo $command --directory \"$vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}\" --arch \"$pbos->{'arch'}\" --distribution \"$pbos->{'name'}-$pbos->{'version'}\" --config \"$rbsconf->{$ENV{'PBPROJ'}}\" $b4post $postinstall $rbsopt $addpkgs $rinseverb","Creating the rinse VE for $pbos->{'name'}-$pbos->{'version'} ($pbos->{'arch'})", "verbose");
    2286                     } elsif ($verpmstyle eq "rpmbootstrap") {
    2287                         my $rbsverb = "";
    2288                         foreach my $i (1..$pbdebug) {
    2289                             $rbsverb .= " -v";
    2290                         }
    2291                         my $addpkgs = "";
    2292                         my $postparam = "";
    2293                         $postparam .= pb_distro_get_param($pbos,$osmindep);
    2294                         if ($postparam eq "") {
    2295                             $addpkgs = "";
    2296                         } else {
    2297                             $addpkgs = "-a $postparam";
    2298                         }
    2299                         my $command = pb_check_req("rpmbootstrap",0);
    2300                         pb_system("sudo $command $rbsopt $postinstall $addpkgs $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'} $rbsverb","Creating the rpmbootstrap VE for $pbos->{'name'}-$pbos->{'version'} ($pbos->{'arch'})", "verbose");
    2301                     } elsif ($verpmstyle eq "mock") {
    2302                         my ($rbsconf) = pb_conf_get("rbsconf");
    2303                         my $command = pb_check_req("mock",0);
    2304                         pb_system("sudo $command --init --resultdir=\"/tmp\" --configdir=\"$rbsconf->{$ENV{'PBPROJ'}}\" -r $v $rbsopt","Creating the mock VE for $pbos->{'name'}-$pbos->{'version'} ($pbos->{'arch'})");
    2305                         # Once setup we need to install some packages, the pb account, ...
    2306                         pb_system("sudo $command --install --configdir=\"$rbsconf->{$ENV{'PBPROJ'}}\" -r $v su","Configuring the mock VE");
    2307                     } else {
    2308                         die "Unknown verpmtype type $verpmstyle. Report to dev team";
    2309                     }
    2310                 } elsif ($pbos->{'type'} eq "deb") {
    2311                     my $vedebstyle = $vedebtype->{$ENV{'PBPROJ'}};
    2312 
    2313                     my $codename = pb_distro_get_param($pbos,$oscodename);
    2314                     my $postparam = "";
    2315                     my $addpkgs;
    2316                     $postparam .= pb_distro_get_param($pbos,$osmindep);
    2317                     if ($postparam eq "") {
    2318                         $addpkgs = "";
    2319                     } else {
    2320                         $addpkgs = "--include $postparam";
    2321                     }
    2322                     my $debmir = "";
    2323                     $debmir .= pb_distro_get_param($pbos,$rbsmirrorsrv);
    2324 
    2325                     # Get potential rbs option
    2326                     my $rbsopt = "";
    2327                     if (defined $rbsopt1) {
    2328                         if (defined $rbsopt1->{$vedebstyle}) {
    2329                             $rbsopt = $rbsopt1->{$vedebstyle};
    2330                         } elsif (defined $rbsopt1->{$ENV{'PBPROJ'}}) {
    2331                             $rbsopt = $rbsopt1->{$ENV{'PBPROJ'}};
    2332                         } else {
    2333                             $rbsopt = "";
    2334                         }
    2335                     }
    2336    
    2337                     # debootstrap works with amd64 not x86_64
    2338                     my $debarch = $pbos->{'arch'};
    2339                     $debarch = "amd64" if ($pbos->{'arch'} eq "x86_64");
    2340                     if ($vedebstyle eq "debootstrap") {
    2341                         my $dbsverb = "";
    2342                         $dbsverb = "--verbose" if ($pbdebug gt 0);
    2343 
    2344                         # Some perl modules are in Universe on Ubuntu
    2345                         $rbsopt .= " --components=main,universe" if ($pbos->{'name'} eq "ubuntu");
    2346 
    2347                         pb_system("sudo /usr/sbin/debootstrap $dbsverb $rbsopt --arch=$debarch $addpkgs $codename \"$vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}\" $debmir","Creating the debootstrap VE for $pbos->{'name'}-$pbos->{'version'} ($pbos->{'arch'})", "verbose");
    2348                         # debootstrap doesn't create an /etc/hosts file
    2349                         if (! -f "$vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/etc/hosts" ) {
    2350                             pb_system("sudo cp /etc/hosts $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}/etc/hosts");
    2351                         }
    2352                     } else {
    2353                         die "Unknown vedebtype type $vedebstyle. Report to dev team";
    2354                     }
    2355                 } elsif ($pbos->{'type'} eq "ebuild") {
    2356                     die "Please teach the dev team how to build gentoo chroot";
    2357                 } else {
    2358                     die "Unknown distribution type $pbos->{'type'}. Report to dev team";
    2359                 }
    2360             }
    2361             # Fix modes to allow access to the VE for pb user
    2362             pb_system("sudo chmod 755 $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'} $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'} $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}","Fixing permissions");
    2363 
    2364             # Test if an existing snapshot exists and use it if appropriate
    2365             # And also use it of no local extracted VE is present
    2366             if ((-f "$vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}.tar.gz") &&
    2367                 (((defined $vesnap->{$v}) && ($vesnap->{$v} =~ /true/i)) ||
    2368                     ((defined $vesnap->{$ENV{'PBPROJ'}}) && ($vesnap->{$ENV{'PBPROJ'}} =~ /true/i)) ||
    2369                     ($pbsnap eq 1) ||
    2370                     (! -d "$vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}"))) {
    2371                         pb_system("sudo rm -rf $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'} ; sudo mkdir -p $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'} ; sudo tar xz  -C $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'} -f $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}.tar.gz","Extracting snapshot of $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}.tar.gz under $vepath->{$ENV{'PBPROJ'}}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}");
    2372             }
    2373             # Nothing more to do for VE. No real launch
    2374         } else {
    2375             die "VE of type $vetype not supported. Report to the dev team";
    2376         }
     2214        pb_ve_launch($v,$create,$pbforce,$pbsnap);
    23772215    } else {
    23782216        # RM here
     
    36783516}
    36793517
    3680 #
    3681 # Return the postinstall line if needed
    3682 #
    3683 
    3684 sub pb_get_postinstall {
    3685 
    3686 my $pbos = shift;
    3687 my $rbspi = shift;
    3688 my $vestyle = shift;
    3689 my $post = "";
    3690 
    3691 # Do we have a local post-install script
    3692 if ($vestyle eq "rinse") {
    3693     $post = "--post-install ";
    3694 } elsif ($vestyle eq "rpmbootstrap") {
    3695     $post = "-s ";
    3696 }
    3697 
    3698 my $postparam = pb_distro_get_param($pbos,$rbspi);
    3699 if ($postparam eq "") {
    3700     $post = "";
    3701 } else {
    3702     $post .= $postparam;
    3703 }
    3704 return($post);
    3705 }
    3706 
    37073518# Manages VM/RM SSH port communication
    37083519sub pb_get_port {
  • devel/pbmkbm/bin/pbmkbm

    r1341 r1348  
    2121use ProjectBuilder::Conf;
    2222use ProjectBuilder::Distribution;
     23use ProjectBuilder::VE;
    2324
    2425# Global variables
     
    5051Kernel, modules could come either from the local installed system
    5152(typically for disaster recovery context) or from a kernel package of a
    52 given configuration.
     53given configuration or a referenced content.
    5354Utilities could come from busybox, local utilities or set of packages.
    5455The root filesystem is made with them.
    5556The initrd/initramfs could be made internaly or by calling dracut.
    56 THe boot config file is generated from analysis content or provided externally.
     57The boot config file is generated from analysis content or provided externally.
    5758
    5859=head1 SYNOPSIS
    5960
    60 pbmkbm [-vhq][-t boot-media-type [-d device]][-m os-ver-arch]
     61pbmkbm [-vhq][-t boot-type [-d device]][-b boot-method][-m os-ver-arch]
    6162[-s script][-a pkg1[,pkg2,...]] [target-dir]
    6263
    63 pbmkbm [--verbose][--help][--man][--quiet][--type  boot-media-type [-device device]]
    64 [--script script][--iso iso][--add pkg1,[pkg2,...]][target-dir]
     64pbmkbm [--verbose][--help][--man][--quiet][--type boot-type [--device device]]
     65[--machine os-ver-arch][--boot boot-method]
     66[--script script][--add pkg1,[pkg2,...]] [target-dir]
    6567
    6668=head1 OPTIONS
     
    8486Do not print any output.
    8587
     88=item B<-t|--type boot-type>
     89
     90Type of the boot device to generate. A boot-type can be:
     91
     92=over 4
     93
     94=item B<iso>
     95
     96Generate an ISO9660 image format (suitable to be burned later on or loopback mounted. Uses isolinux.
     97
     98=item B<usb>
     99
     100Generate a USB image format (typically a key of external hard drive). Uses syslinux.
     101
     102=item B<pxe>
     103
     104Generate a PXE environement (suitable to be integrated in a PXElinux configuration). Uses pxelinux.
     105
     106=back
     107
     108=item B<-d|--device device-file>
     109
     110Name of the device or file on which you want to create the boot media.
     111
     112=item B<-b|--boot boot-method>
     113
     114This is the boot method to use to create the boot media. A boot-method can be:
     115
     116=over 4
     117
     118=item B<native>
     119
     120Use the tools of the native distribution to create the boot media. No other dependency.
     121
     122=item B<ve>
     123
     124Use the project-builder.org virtual environment notion to create the boot media. No other dependency outside of the project.
     125
     126=item B<busybox>
     127
     128Use the busybox tool to create the boot media. Cf: L<http://www.busybox.net>
     129
     130=item B<dracut>
     131
     132Use the dracut tool to create the boot media. Cf: L<http://www.dracut.net>
     133
     134=back
     135
    86136=item B<-s|--script script>
    87137
    88 Name of the script you want to execute on the related VEs after the installation.
    89 It is executed in host environment.
    90 You can use the chroot command to execute actions in the VE.
     138Name of the script you want to execute on the related boot media at the end o the build.
    91139
    92140=item B<-a|--add pkg1[,pkg2,...]>
    93141
    94 Additional packages to add from the distribution you want to install on the related VE
    95 at the end of the chroot build.
     142Additional packages to add from the distribution you want to install on the related boot media
     143at the end of the build.
     144
     145=item B<-m|--machine os-ver-arch>
     146
     147This is the target tuple operating system-version-architecture for which you want to create the boot media.
    96148
    97149=back
     
    99151=head1 ARGUMENTS
    100152
     153target-dir is the directory under which the boot media will be build.
     154
    101155=over 4
    102156
    103 =item B<target-dir>
    104 
    105 This is the target directory under which the VE will be created.
    106 Created on the fly if needed.
    107 If none is given use the default directory hosting VE for project-builder.org
    108 (Cf: vepath parameter in $HOME/.pbrc)
    109 
    110157=back
    111158
    112159=head1 EXAMPLE
    113160
    114 To setup a USB boot media on the /dev/sdb device for a Fedora 12 distribution with an i386 architecture issue:
    115 
    116 pbmkbm -t usb -d /dev/sdb -m fedora-12-i386
     161To setup a USB busybox based boot media on the /dev/sdb device for a Fedora 12 distribution with an i386 architecture issue:
     162
     163pbmkbm -t usb -d /dev/sdb -m fedora-12-i386 -b busybox
     164
     165To setup an ISO image under /tmp for a RHEL 6 x86_64 distribution issue using the native environment:
     166
     167pbmkbm -t iso -d /tmp -m rhel-6-x86_64 -b ve
    117168
    118169=head1 WEB SITES
     
    153204
    154205GetOptions("help|?|h" => \$opts{'h'},
    155     "man|m" => \$opts{'man'},
     206    "man" => \$opts{'man'},
    156207    "verbose|v+" => \$opts{'v'},
    157208    "quiet|q" => \$opts{'q'},
     
    160211    "machine|m=s" => \$opts{'m'},
    161212    "add|a=s" => \$opts{'a'},
     213    "device|d=s" => \$opts{'d'},
     214    "type|t=s" => \$opts{'t'},
     215    "boot|b=s" => \$opts{'b'},
    162216    "version|V=s" => \$opts{'V'},
    163217) || pb_syntax(-1,0);
     
    184238# Get VE name
    185239$ENV{'PBV'} = $opts{'m'};
    186 die pb_syntax(-1,1) if (not defined $ENV{'PBV'});
    187 
    188 die "Needs to be run as root" if ($EFFECTIVE_USER_ID != 0);
    189240
    190241#
    191242# Initialize distribution info from pb conf file
    192243#
    193 pb_log(0,"Starting VE build for $ENV{'PBV'}\n");
    194244my $pbos = pb_distro_get_context($ENV{'PBV'});
     245pb_log(0,"Starting boot media build for $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}\n");
     246
     247pb_env_init_pbrc(); # to get content of HOME/.pbrc
    195248
    196249#
     
    198251# Create if not existent and use default if none given
    199252#
    200 pb_env_init_pbrc(); # to get content of HOME/.pbrc
    201 my $vepath = shift @ARGV;
     253my $targetdir = shift @ARGV;
    202254
    203255#
     
    207259pb_check_requirements($req,$opt,$appname);
    208260
    209 if (not defined $vepath) {
    210     my ($vestdpath) = pb_conf_get("vepath");
    211     $vepath = "$vestdpath->{'default'}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}" if (defined $vestdpath->{'default'});
    212 }
    213 
    214 die pb_log(0,"No target-dir specified and no default vepath found in $ENV{'PBETC'}\n") if (not defined $vepath);
    215 
    216 pb_mkdir_p($vepath) if (! -d $vepath);
    217 
    218 #
     261# After that we will need root access
     262die "$appname needs to be run as root" if ($EFFECTIVE_USER_ID != 0);
     263
     264#
     265# Where is our build target directory
     266#
     267
     268if (not defined $targetdir) {
     269    $targetdir = "/var/cache/pbmkbm";
     270    my ($vestdpath) = pb_conf_get("mkbmpath");
     271    $targetdir = "$vestdpath->{'default'}/$pbos->{'name'}/$pbos->{'version'}/$pbos->{'arch'}" if (defined $vestdpath->{'default'});
     272}
     273
     274die pb_log(0,"No target-dir specified and no default mkbmpath found in $ENV{'PBETC'}\n") if (not defined $targetdir);
     275
     276# Point to the right subdir and create it if needed
     277pb_mkdir_p($targetdir) if (! -d $targetdir);
     278
     279
     280# Now the preparation is over, we need to do something useful :-)
     281# But it all depends on how we're asked to do it.
     282#
     283# First we need to copy into the target dir all the relevant content
     284pb_mkbm_create_content();
     285
     286# Then we need to package this content in the destination format
     287pb_mkbm_create_media();
     288
     289sub pb_mkbm_create_content {
     290
     291pb_log(1,"Creating boot media content\n");
     292if ($opts{'b'} eq "ve") {
     293    # Use existing tools to create a good VE !
     294    pb_ve_launch($ENV{'PBV'});
     295} elsif ($opts{'b'} eq "native") {
     296    # Use native tools to create a good VE !
     297} else {
     298    die "Unknown method $opts{'b'} used to create the media content";
     299}
     300}
     301
     302sub pb_mkbm_create_media {
     303
     304}
     305
    219306# Get the package list to download, store them in a cache directory
    220307#
    221308my ($mkbmcachedir) = pb_conf_get_if("mkbmcachedir");
    222 my ($pkgs,$mirror) = pb_distro_get_param($pbos,pb_conf_get("mkbmmindep","mkbmmirrorsrv"));
    223 
    224 my $cachedir = "/var/cache/pbmkbm";
    225 $cachedir = $mkbmcachedir->{'default'} if (defined $mkbmcachedir->{'default'});
    226 
    227 # Point to the right subdir and create it if needed
    228 $cachedir .= "/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}";
    229 pb_mkdir_p($cachedir) if (! -d $cachedir);
     309my ($pkgs) = pb_distro_get_param($pbos,pb_conf_get("mkbmmindep"));
    230310
    231311#
    232312# /proc needed
    233313#
    234 pb_system("mount -o bind /proc $vepath/proc","Mounting /proc");
     314pb_system("mount -o bind /proc $targetdir/proc","Mounting /proc");
    235315
    236316# Installed additional packages we were asked to
    237317if (defined $opts{'a'}) {
    238318    $opts{'a'} =~ s/,/ /g;
    239     pb_system("chroot $vepath /bin/bash -c \"$pbos->{'install'} $opts{'a'} \"","Adding packages to OS by running $pbos->{'install'} $opts{'a'}");
     319    pb_system("chroot $targetdir /bin/bash -c \"$pbos->{'install'} $opts{'a'} \"","Adding packages to OS by running $pbos->{'install'} $opts{'a'}");
    240320}
    241321
     
    244324#
    245325pb_log(1,"Cleaning up\n");
    246 pb_system("umount $vepath/proc","Unmounting /proc");
     326pb_system("umount $targetdir/proc","Unmounting /proc");
    247327
    248328# Executes post-install step if asked for
    249329if ($opts{'s'}) {
    250     pb_system("$opts{'s'} $vepath","Executing the post-install script: $opts{'s'} $vepath");
    251 }
     330    pb_system("$opts{'s'} $targetdir","Executing the post-install script: $opts{'s'} $targetdir");
     331}
Note: See TracChangeset for help on using the changeset viewer.