Support for offline provisioning of apt-packages by caching /var/lib/apt/lists
[GH-84]
This commit is contained in:
parent
d42e5a9886
commit
b548637e4f
5 changed files with 53 additions and 0 deletions
|
@ -20,6 +20,7 @@ BACKWARDS INCOMPATIBILITY:
|
|||
|
||||
FEATURES:
|
||||
|
||||
- Support for offline provisioning of apt-packages by caching `/var/lib/apt/lists` [GH-84]
|
||||
- Support for specifying custom cache bucket synced folder opts
|
||||
- Support to force disabe the plugin [GH-72]
|
||||
- Automatically disable the plugin for cloud providers [GH-45]
|
||||
|
|
|
@ -40,6 +40,7 @@ require_relative "bucket/pacman"
|
|||
require_relative "bucket/yum"
|
||||
require_relative "bucket/rvm"
|
||||
require_relative "bucket/apt_cacher"
|
||||
require_relative "bucket/apt_lists"
|
||||
require_relative "bucket/composer"
|
||||
require_relative "bucket/npm"
|
||||
require_relative "bucket/zypper"
|
||||
|
|
33
lib/vagrant-cachier/bucket/apt_lists.rb
Normal file
33
lib/vagrant-cachier/bucket/apt_lists.rb
Normal file
|
@ -0,0 +1,33 @@
|
|||
module VagrantPlugins
|
||||
module Cachier
|
||||
class Bucket
|
||||
class AptLists < Bucket
|
||||
def self.capability
|
||||
:apt_lists_dir
|
||||
end
|
||||
|
||||
def install
|
||||
machine = @env[:machine]
|
||||
guest = machine.guest
|
||||
|
||||
if guest.capability?(:apt_lists_dir)
|
||||
guest_path = guest.capability(:apt_lists_dir)
|
||||
|
||||
@env[:cache_dirs] << guest_path
|
||||
|
||||
machine.communicate.tap do |comm|
|
||||
comm.execute("mkdir -p /tmp/vagrant-cache/#{@name}/partial")
|
||||
unless comm.test("test -L #{guest_path}")
|
||||
comm.sudo("rm -rf #{guest_path}")
|
||||
comm.sudo("mkdir -p `dirname #{guest_path}`")
|
||||
comm.sudo("ln -s /tmp/vagrant-cache/#{@name} #{guest_path}")
|
||||
end
|
||||
end
|
||||
else
|
||||
@env[:ui].info I18n.t('vagrant_cachier.skipping_bucket', bucket: 'apt-lists')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
13
lib/vagrant-cachier/cap/debian/apt_lists_dir.rb
Normal file
13
lib/vagrant-cachier/cap/debian/apt_lists_dir.rb
Normal file
|
@ -0,0 +1,13 @@
|
|||
module VagrantPlugins
|
||||
module Cachier
|
||||
module Cap
|
||||
module Debian
|
||||
module AptListsDir
|
||||
def self.apt_lists_dir(machine)
|
||||
'/var/lib/apt/lists'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -36,6 +36,11 @@ module VagrantPlugins
|
|||
Cap::Debian::AptCacherDir
|
||||
end
|
||||
|
||||
guest_capability 'debian', 'apt_lists_dir' do
|
||||
require_relative 'cap/debian/apt_lists_dir'
|
||||
Cap::Debian::AptListsDir
|
||||
end
|
||||
|
||||
guest_capability 'redhat', 'yum_cache_dir' do
|
||||
require_relative 'cap/redhat/yum_cache_dir'
|
||||
Cap::RedHat::YumCacheDir
|
||||
|
|
Loading…
Reference in a new issue