vagrant-localdeb 1.1.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: f74d4150fc8bc3ec73567e6b938805e6d4f40ca0
4
+ data.tar.gz: 448cd057aa45166ebcaca85ac4638072c3a5d542
5
+ SHA512:
6
+ metadata.gz: 517e8583f206bf50d4a01ef49928b7f948eb3ae113fcaf85dfaa59fc6cd01d349903e1be310c238827a262676d328ae0f7e05d50aa753e5f1d6ab1e60a4d5e8d
7
+ data.tar.gz: 936e9ab9916b2bfd1381fff56df2f6bf5a4f6c5f28255fe1f6977587274ae5e5760e6fae33f8b1c97741fe464459af98d49eac4184d1f98f89d2fdae6fcb7406
data/.gitignore ADDED
@@ -0,0 +1,9 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,4 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.10
4
+ before_install: gem install bundler -v 1.17.1
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-localdeb.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem "vagrant", git: "https://github.com/hashicorp/vagrant.git", tag: "v2.0.0"
8
+ end
9
+
10
+ group :plugins do
11
+ gemspec
12
+ #gem "vagrant-localdeb", path: "."
13
+ end
data/README.md ADDED
@@ -0,0 +1,34 @@
1
+ # Vagrant-LocalDeb
2
+
3
+ Overrides the Debian capabilities to use local .deb files instead of apt-get to install `rsync` and an NFS client. This means you can proceed to the provisioning stage on a vanilla Debian box without Internet access, but you must provide the necessary .deb files.
4
+
5
+ ## Installation
6
+
7
+ $ vagrant plugin install vagrant-localdeb
8
+
9
+ ## Usage
10
+
11
+ Obtain .deb files and take note of which dependencies are required for which installation. The simplest way is to:
12
+
13
+ ```
14
+ $ apt-get install rsync
15
+ $ ls /var/cache/apt/archives/*.deb
16
+ ```
17
+
18
+ ```
19
+ $ apt-get install nfs-common
20
+ $ ls /var/cache/apt/archives/*.deb
21
+ ```
22
+
23
+ Take a copy of the files, and place them in one of the following locations:
24
+
25
+ - your vagrant project directory (alongside Vagrantfile)
26
+ - the '.vagrant' subdirectory
27
+ - a '.offline' subdirectory
28
+
29
+ Name the files rsync.n.deb and nfs.n.deb where 'n' is a number indicating the order the files should be installed (dependencies first).
30
+
31
+ Alternatively, you can place symlinks to the real files.
32
+
33
+ Voilà!
34
+
data/Rakefile ADDED
@@ -0,0 +1,5 @@
1
+ # require "bundler/gem_tasks"
2
+
3
+ require "rubygems"
4
+ require "bundler/setup"
5
+ Bundler::GemHelper.install_tasks
@@ -0,0 +1,58 @@
1
+ # vim: set ts=2 sw=2 et :
2
+
3
+ module VagrantPlugins
4
+ module LocalDeb
5
+
6
+ class Capabilities
7
+ def self.rsync_install(machine)
8
+ install_debs_or_apt(machine, "rsync", "rsync")
9
+ end
10
+
11
+ def self.nfs_client_install(machine)
12
+ install_debs_or_apt(machine, "nfs", "nfs-common")
13
+ end
14
+
15
+ def self.install_debs_or_apt(machine, basename, fallback_packages)
16
+ comms = machine.communicate
17
+ raise NotReady.new() unless comms.wait_for_ready(60)
18
+ debs = []
19
+ paths = [".offline/", ".vagrant/", ""]
20
+ while debs.count == 0 and paths.count > 0
21
+ debs = Dir.glob(paths.pop + basename + '*.deb')
22
+ end
23
+ if debs.count > 0
24
+ debs.sort!
25
+ debs.each do |deb|
26
+ begin
27
+ comms.upload(deb,"/tmp/package.deb")
28
+ rescue
29
+ raise NoUpload.new()
30
+ end
31
+ raise NoDebInstall.new() unless comms.sudo("dpkg -i /tmp/package.deb") == 0
32
+ end
33
+ else
34
+ comms.sudo("apt-get -yqq update")
35
+ raise NoAptInstall.new() unless comms.sudo("apt-get -yqq install " + fallback_packages) == 0
36
+ end
37
+ end
38
+ private_class_method :install_debs_or_apt
39
+ end
40
+
41
+ class NotReady < Vagrant::Errors::VagrantError
42
+ error_message("VM not ready for communication")
43
+ end
44
+
45
+ class NoUpload < Vagrant::Errors::VagrantError
46
+ error_message("Error uploading .deb file")
47
+ end
48
+
49
+ class NoDebInstall < Vagrant::Errors::VagrantError
50
+ error_message("Error installing .deb file")
51
+ end
52
+
53
+ class NoAptInstall < Vagrant::Errors::VagrantError
54
+ error_message("Error installing with apt-get (no .deb files found)")
55
+ end
56
+
57
+ end
58
+ end
@@ -0,0 +1,30 @@
1
+ begin
2
+ require "vagrant"
3
+ rescue LoadError
4
+ raise "The Vagrant local .deb plugin must be run within Vagrant."
5
+ end
6
+
7
+ module VagrantPlugins
8
+ module LocalDeb
9
+ class Plugin < Vagrant.plugin("2")
10
+
11
+ name "LocalDeb"
12
+
13
+ description <<-DESC
14
+ Overrides Debian capabilities to use a .deb files instead
15
+ of apt-get to install rsync and an NFS client.
16
+ DESC
17
+
18
+ guest_capability "debian", "rsync_install" do
19
+ require_relative "capabilities"
20
+ Capabilities
21
+ end
22
+
23
+ guest_capability "debian", "nfs_client_install" do
24
+ require_relative "capabilities"
25
+ Capabilities
26
+ end
27
+
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,5 @@
1
+ module VagrantPlugins
2
+ module LocalDeb
3
+ VERSION = "1.1.0"
4
+ end
5
+ end
@@ -0,0 +1 @@
1
+ require "vagrant-localdeb/plugin"
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-localdeb/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "vagrant-localdeb"
8
+ spec.version = VagrantPlugins::LocalDeb::VERSION
9
+ spec.platform = Gem::Platform::RUBY
10
+ spec.license = "MIT"
11
+ spec.authors = ["Ben Schmidt"]
12
+ spec.email = ["<insightful_schmidt@yahoo.com.au>"]
13
+ spec.summary = "Uses local .deb files instead of apt-get to install rsync and an NFS client on Debian"
14
+ spec.description = "Uses local .deb files instead of apt-get to install rsync and an NFS client on Debian"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
+ spec.bindir = "exe"
18
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.10"
22
+ spec.add_development_dependency "rake", "~> 10.0"
23
+ end
metadata ADDED
@@ -0,0 +1,84 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-localdeb
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Schmidt
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2018-12-06 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.10'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.10'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ description: Uses local .deb files instead of apt-get to install rsync and an NFS
42
+ client on Debian
43
+ email:
44
+ - "<insightful_schmidt@yahoo.com.au>"
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - ".travis.yml"
51
+ - Gemfile
52
+ - README.md
53
+ - Rakefile
54
+ - lib/vagrant-localdeb.rb
55
+ - lib/vagrant-localdeb/capabilities.rb
56
+ - lib/vagrant-localdeb/plugin.rb
57
+ - lib/vagrant-localdeb/version.rb
58
+ - vagrant-localdeb.gemspec
59
+ homepage:
60
+ licenses:
61
+ - MIT
62
+ metadata: {}
63
+ post_install_message:
64
+ rdoc_options: []
65
+ require_paths:
66
+ - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ version: '0'
72
+ required_rubygems_version: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - ">="
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ requirements: []
78
+ rubyforge_project:
79
+ rubygems_version: 2.4.5.5
80
+ signing_key:
81
+ specification_version: 4
82
+ summary: Uses local .deb files instead of apt-get to install rsync and an NFS client
83
+ on Debian
84
+ test_files: []