Commit fc02c625 authored by Mike Hibler's avatar Mike Hibler

Add the -B option to specify the "base" iocage to use.

This could make it easier in the future to try out different
versions of the jail environment (e.g., FreeBSD 10.2 vs. 10.1)
without manually tweaking a magic symlink in /iocage/tags.

Also, document that you need to create the geni-lib mountpoint
and may need to add some symlinks that are missing in newer
FreeBSD packages.
parent 1c211767
How to setup update the genilib-jail environment.
A. How to setup update the genilib-jail environment.
We use a combination of iocage and our own hand-rolled script to efficiently
spawn up environments in which we can interpret geni-lib scripts. Right now
......@@ -40,13 +40,24 @@ EOF
chroot . pkg install -r Emulab-devel emulab-genilib
4. Make it a template
4. Take care of some riff-raff
# mount point for geni-lib stuff
mkdir -p usr/testbed/lib/geni-lib
# symlinks we use
ln -sf python2.7 usr/local/bin/python2
ln -sf python2.7 usr/local/bin/python
# if perl is loaded
ln -sf /usr/local/bin/perl5 usr/bin/perl
5. Make it a template
iocage set template=yes py-cage-new
Updating your iocage:
B. Updating your iocage:
1. Fetch the appropriate release:
sudo iocage fetch release=10.2-RELEASE
2. to be finished...
......@@ -76,11 +76,13 @@ sub usage()
" -n jailname Name of jail; default is 'py-cage-<pid>'.\n".
" -d Turn on debugging.\n".
" -C Just create the jail; use 'jexec' to run commands.\n".
" -R Remove an existing (left-over) jail; must specify a name (-n)\n";
" -R Remove an existing (left-over) jail; must specify a name (-n)\n".
" -B base Which base to use (see /iocage/tags); default: 'py-cage'.\n";
exit(-1);
}
my $optlist = "du:p:o:n:CR";
my $optlist = "du:p:o:n:CRB:";
my $basename = "py-cage";
my $jailname = "py-cage-$$";
my $user = "nobody";
my $uid;
......@@ -203,6 +205,14 @@ if (defined($options{"n"})) {
usage();
}
}
if (defined($options{"B"})) {
my $base = $options{"B"};
if (! -e "/iocage/tags/$base") {
print STDERR "No such base '$base'\n";
usage();
}
$basename = $base;
}
#
# Extract params from the environment (if invoked via rungenilib.proxy).
......@@ -263,7 +273,7 @@ if ($action != 2 && -e "$JAILROOT/$jailname") {
# XXX figure out the appropriate snapshot.
# This is marginally better than hardwiring a UUID.
#
my $path = readlink("/iocage/tags/py-cage");
my $path = readlink("/iocage/tags/$basename");
if (!$path || $path !~ /(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})$/) {
die("*** $0:\n".
" Cannot find UUID for base FS");
......@@ -294,7 +304,7 @@ if (mysystem("zfs snapshot $ZFSBASE/$jailuuid/root\@$jailname")) {
}
msg("Snapshotting done");
$snapshot = "$ZFSBASE/$jailuuid/root\@$jailname";
msg("Cloning py-cage FS");
msg("Cloning $basename FS");
if (mysystem("zfs clone $zfsattrs $snapshot $ZFSBASE/$jailname")) {
print STDERR "Could not create geni-lib jail FS\n";
exit(-1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment