Utility to manage disk images and chroots to provide developers with quick clean room environments
Perl JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
bin
debian
lib
t
Build.PL
MANIFEST
README
TODO
joot.cfg

README

Joot is a utility that manages disk images and chroots to provide you with 
quick clean room environments for development, testing and package management.

Goals
-----
  * fast (subsecond) to create, destroy and enter
  * only limitation on number of joots is disk space
  * use COW and sparse disks when possible
  * few dependencies (fast and easy installs)
  * support debian/redhat base os install out of the box
  * support AMIs (Amazon ec2), and VMDK (VMware) images
  * manage system files inside chroot (such as /etc/resolv.conf and /proc/*) 
    when reasonable

Status
------
This project is considered alpha.  I'd love to hear your feedback if you want
try it out.

Prereqs
-------
On Debian:
Install these packages:
export DEBIAN_FRONTEND=noninteractive
sudo apt-get install mount sudo qemu-kvm libjson-perl liblog-log4perl-perl \
libwww-perl perl-modules socat -y

# for development only 
sudo apt-get install libtest-perl-critic-perl libtest-exception-perl \
libtest-pod-perl -y
# be sure to add PERL5LIB to pass_thru_env in config file 

linux kernel 2.6.26 for nbd support (ubuntu release intrepid ibex or later)
When you mount a joot it uses a /dev/nbdX device.  
sudo modprobe nbd nbds_max=256

For Linux you'll want the QCOW and BindMount plugins enabled in your joot.cfg.

For Mac OS X:
Use macports to install these packages: 
sudo port install bindfs socat p5-json p5-log-log4perl p5-libwww-perl

For Mac OS X you'll want the MacOSX and BindFS plugins enabled in your joot.cfg.

Note that Mac support is very alpha.  Don't expect anything to work.

Creating Images
---------------
CentOS:
http://geek.co.il/wp/2010/03/14/how-to-build-a-chroot-jail-environment-for-centos

Ubuntu/Debian:
export image_name=ubuntu-10.10-i386
export image_file=~/images/$image_name.qcow2
joot_image --create $image_file --size 10G
joot_image --mount $image_file /mnt/$image_name
sudo apt-get install debootstrap
sudo debootstrap --variant=buildd --arch i386 maverick \
    /mnt/$image_name/ http://archive.ubuntu.com/ubuntu/
sudo env LANG=C chroot /mnt/$image_name bash -c  "apt-get install -y \
    --force-yes sudo language-pack-en vim ssh man && apt-get clean"
joot_image --umount $image_file
sudo rmdir /mnt/$image_name

Mac OS X:
# Insert Mac OS X installation disk (assumes 10.5.7)
export image_name=mac_os_x-10.5.7
export image_file=~/images/$image_name.sparseimage
mkdir ~/images
hdiutil create -type SPARSE -fs HFS+ -volname $image_name -size 5g -attach \
    $image_file
touch /Volumes/$image_name/.metadata_never_index # Prevent spotlight indexing
for P in BaseSystem Essentials BSD X11User; do \
    sudo installer -target /Volumes/$image_name -pkg \
        '/Volumes/Mac OS X Install DVD/System/Installation/Packages/'$P.pkg;\
done

#TODO consider runnng softwareupdate -i -a
curl -L http://support.apple.com/downloads/DL827/en_US/MacOSXUpdCombo10.5.7.dmg\
    -O /tmp/MacOSXUpdCombo10.5.7.dmg
hdiutil attach /tmp/MacOSXUpdCombo10.5.7.dmg
sudo env CM_BUILD=CM_BUILD installer -target /Volumes/$image_name -pkg \
    /Volumes/'Mac OS X Update Combined'/MacOSXUpdCombo10.5.7.pkg
hdiutil detach /Volumes/'Mac OS X Update Combined'
rm /tmp/MacOSXUpdCombo10.5.7.dmg
hdiutil detach /Volumes/$image_name -force 

The default config file references a collection of images at getjoot.org

Configuration
-------------
Joot will look for a config options in JOOT_CONFIG env var, ~/.joot or 
/etc/joot.cfg in that order. 

License
-------
Copyright 2010 Jay Buffington

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this software except in compliance with the License.
You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.