vagrant-lxc 0.2.0 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/.vimrc +1 -1
  4. data/CHANGELOG.md +22 -0
  5. data/Gemfile +1 -1
  6. data/Gemfile.lock +10 -9
  7. data/README.md +43 -29
  8. data/boxes/quantal64/download-ubuntu +21 -20
  9. data/boxes/quantal64/lxc-template +11 -11
  10. data/boxes/quantal64/metadata.json +1 -1
  11. data/development/Vagrantfile +8 -4
  12. data/example/Vagrantfile +3 -15
  13. data/lib/vagrant-lxc.rb +0 -2
  14. data/lib/vagrant-lxc/action.rb +1 -14
  15. data/lib/vagrant-lxc/action/boot.rb +8 -9
  16. data/lib/vagrant-lxc/action/check_created.rb +6 -2
  17. data/lib/vagrant-lxc/action/check_running.rb +6 -2
  18. data/lib/vagrant-lxc/action/compress_rootfs.rb +1 -1
  19. data/lib/vagrant-lxc/action/create.rb +15 -7
  20. data/lib/vagrant-lxc/action/created.rb +6 -2
  21. data/lib/vagrant-lxc/action/destroy.rb +6 -2
  22. data/lib/vagrant-lxc/action/disconnect.rb +5 -1
  23. data/lib/vagrant-lxc/action/forced_halt.rb +3 -3
  24. data/lib/vagrant-lxc/action/forward_ports.rb +2 -2
  25. data/lib/vagrant-lxc/action/handle_box_metadata.rb +38 -27
  26. data/lib/vagrant-lxc/action/is_running.rb +6 -2
  27. data/lib/vagrant-lxc/action/share_folders.rb +8 -8
  28. data/lib/vagrant-lxc/config.rb +20 -10
  29. data/lib/vagrant-lxc/driver.rb +162 -0
  30. data/lib/vagrant-lxc/driver/builder.rb +21 -0
  31. data/lib/vagrant-lxc/{container → driver}/cli.rb +16 -11
  32. data/lib/vagrant-lxc/driver/fetch_ip_from_dnsmasq.rb +41 -0
  33. data/lib/vagrant-lxc/driver/fetch_ip_with_attach.rb +29 -0
  34. data/lib/vagrant-lxc/errors.rb +10 -0
  35. data/lib/vagrant-lxc/plugin.rb +4 -0
  36. data/lib/vagrant-lxc/provider.rb +14 -11
  37. data/lib/vagrant-lxc/version.rb +1 -1
  38. data/spec/fixtures/sample-ip-addr-output +2 -0
  39. data/spec/spec_helper.rb +1 -0
  40. data/spec/unit/action/compress_rootfs_spec.rb +4 -4
  41. data/spec/unit/action/forward_ports_spec.rb +3 -3
  42. data/spec/unit/action/handle_box_metadata_spec.rb +52 -26
  43. data/spec/unit/{container → driver}/cli_spec.rb +17 -19
  44. data/spec/unit/driver_spec.rb +173 -0
  45. data/tasks/boxes.rake +3 -3
  46. metadata +13 -15
  47. data/lib/vagrant-lxc/action/base_action.rb +0 -11
  48. data/lib/vagrant-lxc/action/network.rb +0 -21
  49. data/lib/vagrant-lxc/container.rb +0 -141
  50. data/lib/vagrant-lxc/machine_state.rb +0 -25
  51. data/spec/fixtures/sample-ifconfig-output +0 -18
  52. data/spec/unit/container_spec.rb +0 -147
  53. data/spec/unit/machine_state_spec.rb +0 -39
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 186bdb083beeef3921bd1365defc643f73ee384e
4
- data.tar.gz: 493eaf050cd7c208af7098ed3f0d6a4ecd3b508f
3
+ metadata.gz: 1c9e378441e40002c34e265155c4066485bf4e00
4
+ data.tar.gz: 26cfdc7e029ba157e961944c2346fa1e3d3b5135
5
5
  SHA512:
6
- metadata.gz: 1efa2adc9cce87eca8a4fa1878f019cecb0834ec347f0ec5fed463fed8a5dd50f63792d72928d2ba34fecc9ee908190d6a3119551987158bba47d68444e7dc95
7
- data.tar.gz: 080dde3c3857967619f7b1033e379d9c8e0c340e6128b7d53edcd2a89b71b496fefbe4f525c7c6874ee1978c207f054777da6bf7e9f13234c4fb0beedb6a9b4a
6
+ metadata.gz: 20495f21d5311e8397de76cfab8d01cb40247dca891a5051382b16e5b4ba6a948f4708addcafc691384a6f82aca1dc64b7318ea03b98a65c3ca3bb64bcd43010
7
+ data.tar.gz: d9b10838087a6d919a83c28430e8c657bd2fddf0223f9cd910d64f6051591a912cf7308ece39f5535ea4c24b02dcdb2124af5d5633b14680b73e09ad9d986b2c
data/.gitignore CHANGED
@@ -24,5 +24,6 @@ doc/
24
24
  /cache
25
25
 
26
26
  /boxes/**/*.tar.gz
27
- /boxes/quantal64/rootfs-amd64/
27
+ /boxes/quantal64/partial/
28
+ /boxes/quantal64/rootfs/
28
29
  /boxes/output/
data/.vimrc CHANGED
@@ -1 +1 @@
1
- set wildignore+=*/vagrant-1.1/*
1
+ set wildignore+=*/boxes/quantal64/rootfs/*,*/boxes/quantal64/partial/*
data/CHANGELOG.md CHANGED
@@ -1,3 +1,25 @@
1
+ ## [0.3.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.2.0...v0.3.0)
2
+
3
+ BACKWARDS INCOMPATIBILITIES:
4
+
5
+ - Boxes `lxc-template` should support a `--tarball` parameter
6
+ - `start_opts` config was renamed to `customize`, please check the README for the expected parameters
7
+ - V1 boxes are no longer supported
8
+ - `target_rootfs_path` is no longer supported, just symlink `/var/lib/lxc` to the desired folder in case you want to point it to another partition
9
+
10
+ IMPROVEMENTS:
11
+
12
+ - lxc templates are removed from lxc template dir after container is created
13
+ - Treat NFS shared folders as a normal shared folder instead of ignoring it so we can share the same Vagrantfile with VBox environments
14
+ - Support for lxc 0.7.5 (tested on Ubuntu 12.04) [#49](https://github.com/fgrehm/vagrant-lxc/issues/49)
15
+ - Remove `/tmp` files when packaging quantal64 base box [#48](https://github.com/fgrehm/vagrant-lxc/issues/48)
16
+ - Avoid picking the best mirror on quantal64 base box [#38](https://github.com/fgrehm/vagrant-lxc/issues/38)
17
+
18
+ BUG FIXES:
19
+
20
+ - Redirect `redir`'s stderr output to `/dev/null` [#51](https://github.com/fgrehm/vagrant-lxc/issues/51)
21
+ - Switch from `ifconfig` to `ip` to grab container's IP to avoid localization issues [#50](https://github.com/fgrehm/vagrant-lxc/issues/50)
22
+
1
23
  ## [0.2.0](https://github.com/fgrehm/vagrant-lxc/compare/v0.1.1...v0.2.0)
2
24
 
3
25
  - Experimental box packaging (only tested with Ubuntu 64 base box)
data/Gemfile CHANGED
@@ -6,7 +6,7 @@ group :development do
6
6
  # We depend on Vagrant for development, but we don't add it as a
7
7
  # gem dependency because we expect to be installed within the
8
8
  # Vagrant environment itself using `vagrant plugin`.
9
- gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
9
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git', tag: 'v1.1.5'
10
10
  gem 'guard'
11
11
  gem 'guard-rspec'
12
12
  gem 'guard-bundler'
data/Gemfile.lock CHANGED
@@ -1,8 +1,9 @@
1
1
  GIT
2
2
  remote: https://github.com/mitchellh/vagrant.git
3
- revision: 87613ec9392d4660ffcb1d5755307136c06af08c
3
+ revision: 64e360814c3ad960d810456add977fd4c7d47ce6
4
+ tag: v1.1.5
4
5
  specs:
5
- vagrant (1.1.4)
6
+ vagrant (1.1.5)
6
7
  childprocess (~> 0.3.7)
7
8
  erubis (~> 2.7.0)
8
9
  i18n (~> 0.6.0)
@@ -14,7 +15,7 @@ GIT
14
15
  PATH
15
16
  remote: .
16
17
  specs:
17
- vagrant-lxc (0.2.0)
18
+ vagrant-lxc (0.3.0)
18
19
 
19
20
  GEM
20
21
  remote: https://rubygems.org/
@@ -22,21 +23,22 @@ GEM
22
23
  childprocess (0.3.9)
23
24
  ffi (~> 1.0, >= 1.0.11)
24
25
  coderay (1.0.9)
25
- diff-lcs (1.2.1)
26
+ diff-lcs (1.2.2)
26
27
  erubis (2.7.0)
27
28
  ffi (1.6.0)
28
- guard (1.6.2)
29
+ formatador (0.2.4)
30
+ guard (1.7.0)
31
+ formatador (>= 0.2.4)
29
32
  listen (>= 0.6.0)
30
33
  lumberjack (>= 1.0.2)
31
34
  pry (>= 0.9.10)
32
- terminal-table (>= 1.4.3)
33
35
  thor (>= 0.14.6)
34
36
  guard-bundler (1.0.0)
35
37
  bundler (~> 1.0)
36
38
  guard (~> 1.1)
37
39
  guard-ctags-bundler (0.1.6)
38
40
  guard (>= 1.1)
39
- guard-rspec (2.5.1)
41
+ guard-rspec (2.5.2)
40
42
  guard (>= 1.1)
41
43
  rspec (~> 2.11)
42
44
  i18n (0.6.4)
@@ -73,8 +75,7 @@ GEM
73
75
  simplecov-html (~> 0.7.1)
74
76
  simplecov-html (0.7.1)
75
77
  slop (3.4.4)
76
- terminal-table (1.4.5)
77
- thor (0.18.0)
78
+ thor (0.18.1)
78
79
 
79
80
  PLATFORMS
80
81
  ruby
data/README.md CHANGED
@@ -1,22 +1,27 @@
1
1
  # vagrant-lxc [![Build Status](https://travis-ci.org/fgrehm/vagrant-lxc.png?branch=master)](https://travis-ci.org/fgrehm/vagrant-lxc) [![Gem Version](https://badge.fury.io/rb/vagrant-lxc.png)](http://badge.fury.io/rb/vagrant-lxc) [![Code Climate](https://codeclimate.com/github/fgrehm/vagrant-lxc.png)](https://codeclimate.com/github/fgrehm/vagrant-lxc)
2
2
 
3
- Experimental Linux Containers support for Vagrant 1.1+
3
+ Linux Containers support for Vagrant 1.1+
4
4
 
5
5
 
6
6
  ## Dependencies
7
7
 
8
- Vagrant 1.1+ (1.1.4+ recommended), `lxc` and `redir` packages and a Kernel [higher than 3.5.0-17.28](#help-im-unable-to-restart-containers),
9
- which on Ubuntu 12.10 means something like:
8
+ * Vagrant 1.1+ (1.1.3+ recommended)
9
+ * lxc 0.7.5+ (0.8.0-rc1+ recommended)
10
+ * redir
11
+ * A Kernel [higher than 3.5.0-17.28](#help-im-unable-to-restart-containers)
12
+
13
+ On a clean Ubuntu 12.10 machine it means something like:
10
14
 
11
15
  ```
12
16
  sudo apt-get update && sudo apt-get dist-upgrade
13
17
  sudo apt-get install lxc redir
14
- wget "http://files.vagrantup.com/packages/87613ec9392d4660ffcb1d5755307136c06af08c/vagrant_`uname -m`.deb" -O /tmp/vagrant.deb
18
+ # Downloads and install Vagrant 1.1.5
19
+ wget "http://files.vagrantup.com/packages/64e360814c3ad960d810456add977fd4c7d47ce6/vagrant_`uname -m`.deb" -O /tmp/vagrant.deb
15
20
  sudo dpkg -i /tmp/vagrant.deb
16
21
  ```
17
22
 
18
23
 
19
- ## What is currently supported? (v0.2.0)
24
+ ## What is currently supported? (v0.3.0)
20
25
 
21
26
  Pretty much everything you need from Vagrant:
22
27
 
@@ -27,13 +32,13 @@ Pretty much everything you need from Vagrant:
27
32
  * Port forwarding
28
33
 
29
34
  *Please refer to the [closed issues](https://github.com/fgrehm/vagrant-lxc/issues?labels=&milestone=&page=1&state=closed)
30
- for the most up to date list.*
35
+ and the [changelog](CHANGELOG.md) for most up to date information.*
31
36
 
32
37
 
33
38
  ## Current limitations
34
39
 
35
40
  * Does not detect forwarded ports collision, right now you are responsible for taking care of that
36
- * A hell lot of `sudo`s
41
+ * A hell lot of `sudo`s (this will probably be like this until [user namespaces](http://s3hh.wordpress.com/2013/02/12/user-namespaces-lxc-meeting/) are supported)
37
42
  * Only a [single ubuntu box supported](boxes)
38
43
  * "[works on my machine](https://github.com/fgrehm/vagrant-lxc/issues/20)" (TM)
39
44
  * [Does not tell you if dependencies are not met](https://github.com/fgrehm/vagrant-lxc/issues/11)
@@ -42,42 +47,52 @@ for the most up to date list.*
42
47
  and some known [bugs](https://github.com/fgrehm/vagrant-lxc/issues?labels=bug&page=1&state=open)
43
48
 
44
49
 
50
+ ## Installation
51
+
52
+ ```
53
+ vagrant plugin install vagrant-lxc
54
+ ```
55
+
45
56
  ## Usage
46
57
 
47
- Make sure you have [Vagrant 1.1+](http://downloads.vagrantup.com/) and run:
58
+ After installing, add the quantal64 base box using any name you want:
48
59
 
49
60
  ```
50
- vagrant plugin install vagrant-lxc
61
+ vagrant box add lxc-quantal64 http://dl.dropbox.com/u/13510779/lxc-quantal64-2013-04-10.box
51
62
  ```
52
63
 
53
- After that you can create a `Vagrantfile` like the one below and run `vagrant up --provider=lxc`:
64
+ Make a Vagrantfile that looks like the following, filling in your information where necessary:
54
65
 
55
66
  ```ruby
56
67
  Vagrant.configure("2") do |config|
57
- config.vm.box = "lxc-quantal64"
58
- config.vm.box_url = 'http://dl.dropbox.com/u/13510779/lxc-quantal64-2013-03-31.box'
59
-
60
- # Share an additional folder to the guest Container. The first argument
61
- # is the path on the host to the actual folder. The second argument is
62
- # the path on the guest to mount the folder. And the optional third
63
- # argument is a set of non-required options.
64
- config.vm.synced_folder "/tmp", "/host_tmp"
68
+ config.vm.box = "lxc-quantal64"
65
69
 
70
+ # You can omit this block if you don't need to override any container setting
66
71
  config.vm.provider :lxc do |lxc|
67
- # Set the folder where container's rootfs will be stored when created
68
- lxc.target_rootfs_path = '/path/to/container/rootfs'
69
- # Same as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox
70
- lxc.start_opts << 'lxc.cgroup.memory.limit_in_bytes=400M'
71
- # Limits swap size
72
- lxc.start_opts << 'lxc.cgroup.memory.memsw.limit_in_bytes=500M'
72
+ # OPTIONAL: Same effect as as 'customize ["modifyvm", :id, "--memory", "1024"]' for VirtualBox
73
+ lxc.customize 'cgroup.memory.limit_in_bytes', '1024M'
74
+ # OPTIONAL: Limits swap size
75
+ lxc.customize 'cgroup.memory.memsw.limit_in_bytes', '512M'
73
76
  end
74
-
75
- # ... your puppet / chef / shell provisioner configs here ...
76
77
  end
77
78
  ```
78
79
 
80
+ And finally run `vagrant up --provider=lxc`.
81
+
79
82
  If you are on a mac or window host and still want to try this plugin out, you
80
- can use the [same Vagrant VirtualBox machine I use for development](#using-virtualbox-and-vagrant-11-for-development).
83
+ can use the [same Vagrant VirtualBox machine I use for development](#using-virtualbox-for-development).
84
+
85
+ ### Storing container's rootfs on a separate partition
86
+
87
+ Before the 0.3.0 version of this plugin, there used to be a support for specifying
88
+ the container's rootfs path from the `Vagrantfile`, on 0.3.0 this was removed as you
89
+ can achieve the same effect by symlinking or mounting `/var/lib/lxc` on a separate
90
+ partition.
91
+
92
+ ### NFS shared folders
93
+
94
+ NFS shared folders are not supported and will behave as a "normal" shared folder
95
+ so we can share the same Vagrantfile with VBox environments.
81
96
 
82
97
 
83
98
  ## Development
@@ -85,7 +100,7 @@ can use the [same Vagrant VirtualBox machine I use for development](#using-virtu
85
100
  If want to develop from your physical machine, just sing that same old song:
86
101
 
87
102
  ```
88
- git clone git://github.com/fgrehm/vagrant-lxc.git --recurse
103
+ git clone git://github.com/fgrehm/vagrant-lxc.git
89
104
  cd vagrant-lxc
90
105
  bundle install
91
106
  bundle exec rake # to run all specs
@@ -98,7 +113,6 @@ bundle exec rake boxes:quantal64:build
98
113
  vagrant box add quantal64 boxes/output/lxc-quantal64.box
99
114
  ```
100
115
 
101
-
102
116
  ### Using `vagrant-lxc` to develop itself
103
117
 
104
118
  Yes! The gem has been [bootstrapped](http://en.wikipedia.org/wiki/Bootstrapping_(compilers)
@@ -15,16 +15,15 @@ suggest_flush()
15
15
 
16
16
  cleanup()
17
17
  {
18
- rm -rf $cache/partial-$arch
19
- rm -rf $cache/rootfs-$arch
18
+ rm -rf $cache/partial
19
+ rm -rf $cache/rootfs
20
20
  }
21
21
 
22
22
  write_sourceslist()
23
23
  {
24
24
  # $1 => path to the rootfs
25
25
 
26
- # TODO: Mirrors sometimes are giving us some 404s
27
- MIRROR=${MIRROR:-mirror://mirrors.ubuntu.com/mirrors.txt}
26
+ MIRROR=${MIRROR:-http://archive.ubuntu.com/ubuntu}
28
27
  SECURITY_MIRROR=${SECURITY_MIRROR:-http://security.ubuntu.com/ubuntu}
29
28
 
30
29
  cat >> "$1/etc/apt/sources.list" << EOF
@@ -41,18 +40,18 @@ download_ubuntu()
41
40
 
42
41
  trap cleanup EXIT SIGHUP SIGINT SIGTERM
43
42
  # check the mini ubuntu was not already downloaded
44
- mkdir -p "$cache/partial-$arch"
43
+ mkdir -p "$cache/partial"
45
44
  if [ $? -ne 0 ]; then
46
- echo "Failed to create '$cache/partial-$arch' directory"
45
+ echo "Failed to create '$cache/partial' directory"
47
46
  return 1
48
47
  fi
49
48
 
50
49
  # download a mini ubuntu into a cache
51
50
  echo "Downloading ubuntu $release minimal ..."
52
51
  if [ -n "$(which qemu-debootstrap)" ]; then
53
- qemu-debootstrap --verbose --components=main,universe --arch=$arch --include=$packages $release $cache/partial-$arch $MIRROR
52
+ qemu-debootstrap --verbose --components=main,universe --arch=$arch --include=$packages $release $cache/partial $MIRROR
54
53
  else
55
- debootstrap --verbose --components=main,universe --arch=$arch --include=$packages $release $cache/partial-$arch $MIRROR
54
+ debootstrap --verbose --components=main,universe --arch=$arch --include=$packages $release $cache/partial $MIRROR
56
55
  fi
57
56
 
58
57
  if [ $? -ne 0 ]; then
@@ -63,27 +62,27 @@ download_ubuntu()
63
62
  # Serge isn't sure whether we should avoid doing this when
64
63
  # $release == `distro-info -d`
65
64
  echo "Installing updates"
66
- > $cache/partial-$arch/etc/apt/sources.list
67
- write_sourceslist $cache/partial-$arch/ $arch
65
+ > $cache/partial/etc/apt/sources.list
66
+ write_sourceslist $cache/partial/ $arch
68
67
 
69
- chroot "$1/partial-${arch}" apt-get update
68
+ chroot "$1/partial" apt-get update
70
69
  if [ $? -ne 0 ]; then
71
70
  echo "Failed to update the apt cache"
72
71
  return 1
73
72
  fi
74
- cat > "$1/partial-${arch}"/usr/sbin/policy-rc.d << EOF
73
+ cat > "$1/partial"/usr/sbin/policy-rc.d << EOF
75
74
  #!/bin/sh
76
75
  exit 101
77
76
  EOF
78
- chmod +x "$1/partial-${arch}"/usr/sbin/policy-rc.d
77
+ chmod +x "$1/partial"/usr/sbin/policy-rc.d
79
78
 
80
- lxc-unshare -s MOUNT -- chroot "$1/partial-${arch}" apt-get dist-upgrade -y || { suggest_flush; false; }
79
+ lxc-unshare -s MOUNT -- chroot "$1/partial" apt-get dist-upgrade -y || { suggest_flush; false; }
81
80
 
82
- rm -f "$1/partial-${arch}"/usr/sbin/policy-rc.d
81
+ rm -f "$1/partial"/usr/sbin/policy-rc.d
83
82
 
84
- chroot "$1/partial-${arch}" apt-get clean
83
+ chroot "$1/partial" apt-get clean
85
84
 
86
- mv "$1/partial-$arch" "$1/rootfs-$arch"
85
+ mv "$1/partial" "$1/rootfs"
87
86
  trap EXIT
88
87
  trap SIGINT
89
88
  trap SIGTERM
@@ -96,14 +95,14 @@ declare cache=`readlink -f .` \
96
95
  arch=amd64 \
97
96
  release=quantal
98
97
 
99
- if [ -d "${cache}/rootfs-${arch}" ]; then
100
- echo 'The rootfs cache has been downloaded already, please remove it if you want to update'
98
+ if [ -d "${cache}/rootfs" ]; then
99
+ echo 'The rootfs cache has been built already, please remove it if you want to update'
101
100
  exit 1
102
101
  fi
103
102
 
104
103
  download_ubuntu $cache $arch $release
105
104
 
106
- rootfs="${cache}/rootfs-${arch}"
105
+ rootfs="${cache}/rootfs"
107
106
 
108
107
  echo "installing puppet"
109
108
  wget http://apt.puppetlabs.com/puppetlabs-release-precise.deb -O "${rootfs}/tmp/puppetlabs-release-${release}.deb"
@@ -118,3 +117,5 @@ curl -L https://www.opscode.com/chef/install.sh -k | sudo bash
118
117
  EOF
119
118
  chmod +x $rootfs/tmp/install-chef.sh
120
119
  chroot $rootfs /tmp/install-chef.sh
120
+
121
+ rm -rf $rootfs/tmp/*
@@ -155,16 +155,17 @@ EOF
155
155
  fi
156
156
  }
157
157
 
158
- copy_ubuntu()
158
+ extract_rootfs()
159
159
  {
160
- cache=$1
160
+ tarball=$1
161
161
  arch=$2
162
162
  rootfs=$3
163
163
 
164
- # make a local copy of the miniubuntu
165
- echo "Copying rootfs to $rootfs ..."
164
+ echo "Extracting $tarball ..."
166
165
  mkdir -p $(dirname $rootfs)
167
- mv $cache/rootfs-$arch $rootfs || return 1
166
+ # Make sure the rootfs does not exist before extracting
167
+ rm -rf $rootfs
168
+ (cd `dirname $rootfs` && tar xfz $tarball)
168
169
  return 0
169
170
  }
170
171
 
@@ -172,7 +173,7 @@ install_ubuntu()
172
173
  {
173
174
  rootfs=$1
174
175
  release=$2
175
- cache=$3 # "/var/cache/lxc/$release"
176
+ tarball=$3
176
177
  mkdir -p /var/lock/subsys/
177
178
 
178
179
  (
@@ -182,8 +183,7 @@ install_ubuntu()
182
183
  return 1
183
184
  fi
184
185
 
185
- echo "Copy $cache/rootfs-$arch to $rootfs ... "
186
- copy_ubuntu $cache $arch $rootfs
186
+ extract_rootfs $tarball $arch $rootfs
187
187
  if [ $? -ne 0 ]; then
188
188
  echo "Failed to copy rootfs"
189
189
  return 1
@@ -454,7 +454,7 @@ EOF
454
454
  return 0
455
455
  }
456
456
 
457
- options=$(getopt -o a:b:hp:r:xn:FS:d:C -l arch:,help,path:,release:,trim,name:,flush-cache,auth-key:,debug:,cache: -- "$@")
457
+ options=$(getopt -o a:b:hp:r:xn:FS:d:C -l arch:,help,path:,release:,trim,name:,flush-cache,auth-key:,debug:,tarball: -- "$@")
458
458
  if [ $? -ne 0 ]; then
459
459
  usage $(basename $0)
460
460
  exit 1
@@ -496,7 +496,7 @@ do
496
496
  -h|--help) usage $0 && exit 0;;
497
497
  -p|--path) path=$2; shift 2;;
498
498
  -n|--name) name=$2; shift 2;;
499
- -C|--cache) cache=$2; shift 2;;
499
+ -T|--tarball) tarball=$2; shift 2;;
500
500
  -r|--release) release=$2; shift 2;;
501
501
  -a|--arch) arch=$2; shift 2;;
502
502
  -x|--trim) trim_container=1; shift 1;;
@@ -539,7 +539,7 @@ else
539
539
  rootfs=$path/rootfs
540
540
  fi
541
541
 
542
- install_ubuntu $rootfs $release $cache
542
+ install_ubuntu $rootfs $release $tarball
543
543
  if [ $? -ne 0 ]; then
544
544
  echo "failed to install ubuntu $release"
545
545
  exit 1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "provider": "lxc",
3
- "version": "1",
3
+ "version": "2",
4
4
 
5
5
  "template-opts": {
6
6
  "--arch": "amd64",
@@ -49,17 +49,21 @@ Vagrant.configure("2") do |config|
49
49
  end
50
50
  end
51
51
 
52
+ config.vm.define :precise do |precise|
53
+ precise.vm.box = 'precise64'
54
+ precise.vm.hostname = 'vbox'
55
+ precise.vm.box_url = 'http://files.vagrantup.com/precise64.box'
56
+ end
57
+
52
58
  config.vm.define :lxc do |lxc_config|
53
59
  lxc_config.vm.hostname = 'lxc-dev-box'
54
- lxc_config.vm.box_url = 'http://dl.dropbox.com/u/13510779/lxc-quantal64-2013-03-31.box'
60
+ lxc_config.vm.box_url = 'http://dl.dropbox.com/u/13510779/lxc-quantal64-2013-04-10.box'
55
61
  # Uncomment to test boxes built locally:
56
62
  # lxc_config.vm.box_url = '../boxes/output/lxc-quantal64.box'
57
63
 
58
64
  lxc_config.vm.provider :lxc do |lxc|
59
65
  # Required to boot nested containers
60
- lxc.start_opts << 'lxc.aa_profile=unconfined'
61
- # Change this to override the path where the rootfs gets stored
62
- # lxc.target_rootfs_path = '/path/to/vagrant-lxc-dev-box-rootfs'
66
+ lxc.customize 'aa_profile', 'unconfined'
63
67
  end
64
68
  end
65
69