vagrant-solaris10 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/.rvmrc ADDED
@@ -0,0 +1,23 @@
1
+ #!/usr/bin/env bash
2
+
3
+ # This is an RVM Project .rvmrc file, used to automatically load the ruby
4
+ # development environment upon cd'ing into the directory
5
+ environment_id="ruby-1.9.3-p125@vagrant-solaris10"
6
+
7
+ # First we attempt to load the desired environment directly from the environment
8
+ # file. This is very fast and efficient compared to running through the entire
9
+ # CLI and selector. If you want feedback on which environment was used then
10
+ # insert the word 'use' after --create as this triggers verbose mode.
11
+ if [[ -d "${rvm_path:-$HOME/.rvm}/environments"
12
+ && -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
13
+ then
14
+ \. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
15
+ [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]] &&
16
+ \. "${rvm_path:-$HOME/.rvm}/hooks/after_use" || true
17
+ else
18
+ # If the environment file has not yet been created, use the RVM CLI to select.
19
+ rvm --create use "$environment_id" || {
20
+ echo "Failed to create RVM environment '${environment_id}'."
21
+ return 1
22
+ }
23
+ fi
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-solaris10.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 tnarik
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Vagrant::Solaris10
2
+
3
+ TODO: Write a gem description
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'vagrant-solaris10'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install vagrant-solaris10
18
+
19
+ ## Usage
20
+
21
+ TODO: Write usage instructions here
22
+
23
+ ## Contributing
24
+
25
+ 1. Fork it
26
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
27
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
28
+ 4. Push to the branch (`git push origin my-new-feature`)
29
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require "bundler/gem_tasks"
@@ -0,0 +1,168 @@
1
+ module VagrantPlugins
2
+
3
+ module GuestSolaris10
4
+ class Guest < Vagrant.plugin("2", :guest)
5
+
6
+ def detect?(machine)
7
+ machine.communicate.test("grep 'Solaris' /etc/release")
8
+ end
9
+
10
+ def configure_networks(networks)
11
+ networks.each do |network|
12
+ device = "#{vm.config.solaris.device}#{network[:interface]}"
13
+ su_cmd = vm.config.solaris.suexec_cmd
14
+ ifconfig_cmd = "#{su_cmd} /sbin/ifconfig #{device}"
15
+
16
+ vm.communicate.execute("#{ifconfig_cmd} plumb")
17
+
18
+ if network[:type].to_sym == :static
19
+ vm.communicate.execute("#{ifconfig_cmd} inet #{network[:ip]} netmask #{network[:netmask]}")
20
+ vm.communicate.execute("#{ifconfig_cmd} up")
21
+ vm.communicate.execute("#{su_cmd} sh -c \"echo '#{network[:ip]}' > /etc/hostname.#{device}\"")
22
+ elsif network[:type].to_sym == :dhcp
23
+ vm.communicate.execute("#{ifconfig_cmd} dhcp start")
24
+ end
25
+ end
26
+ end
27
+
28
+ def change_host_name(name)
29
+ su_cmd = vm.config.solaris.suexec_cmd
30
+
31
+ # Only do this if the hostname is not already set
32
+ if !vm.communicate.test("#{su_cmd} hostname | grep '#{name}'")
33
+ vm.communicate.execute("#{su_cmd} sh -c \"echo '#{name}' > /etc/nodename\"")
34
+ vm.communicate.execute("#{su_cmd} uname -S #{name}")
35
+ end
36
+ end
37
+
38
+ # There should be an exception raised if the line
39
+ #
40
+ # vagrant::::profiles=Primary Administrator
41
+ #
42
+ # does not exist in /etc/user_attr. TODO
43
+ def halt
44
+ # Wait until the VM's state is actually powered off. If this doesn't
45
+ # occur within a reasonable amount of time (15 seconds by default),
46
+ # then simply return and allow Vagrant to kill the vm.
47
+ count = 0
48
+ last_error = nil
49
+ while vm.state != :poweroff
50
+ begin
51
+ vm.communicate.execute("#{vm.config.solaris.suexec_cmd} /usr/sbin/poweroff")
52
+ rescue IOError => e
53
+ # Save the last error; if it's not shutdown in a reasonable amount
54
+ # of attempts we will re-raise the error so it's not hidden for
55
+ # all time
56
+ last_error = e
57
+ end
58
+
59
+ count += 1
60
+ if count >= vm.config.solaris.halt_timeout
61
+ # Check for last error and re-raise it
62
+ if last_error != nil
63
+ raise last_error
64
+ else
65
+ # Otherwise, just return
66
+ return
67
+ end
68
+ end
69
+
70
+ # Still opportunities remaining; sleep and loop
71
+ sleep vm.config.solaris.halt_check_interval
72
+ end # while
73
+ end
74
+
75
+ def mount_shared_folder(name, guestpath, options)
76
+ # These are just far easier to use than the full options syntax
77
+ owner = options[:owner]
78
+ group = options[:group]
79
+
80
+ # Create the shared folder
81
+ vm.communicate.execute("#{vm.config.solaris.suexec_cmd} mkdir -p #{guestpath}")
82
+
83
+ # We have to use this `id` command instead of `/usr/bin/id` since this
84
+ # one accepts the "-u" and "-g" flags.
85
+ id_cmd = "/usr/xpg4/bin/id"
86
+
87
+ # Mount the folder with the proper owner/group
88
+ mount_options = "-o uid=`#{id_cmd} -u #{owner}`,gid=`#{id_cmd} -g #{group}`"
89
+ mount_options += ",#{options[:extra]}" if options[:extra]
90
+ vm.communicate.execute("#{vm.config.solaris.suexec_cmd} /sbin/mount -F vboxfs #{mount_options} #{name} #{guestpath}")
91
+
92
+ # chown the folder to the proper owner/group
93
+ vm.communicate.execute("#{vm.config.solaris.suexec_cmd} chown `#{id_cmd} -u #{owner}`.`#{id_cmd} -g #{group}` #{guestpath}")
94
+ end
95
+ end
96
+
97
+
98
+
99
+ class SolarisConfig < Vagrant.plugin("2", :config)
100
+
101
+ def detect?(vm)
102
+ vm.communicate.test("grep 'Solaris' /etc/release")
103
+ end
104
+
105
+ attr_accessor :halt_timeout
106
+ attr_accessor :halt_check_interval
107
+ # This sets the command to use to execute items as a superuser. pfexec is default
108
+ attr_accessor :suexec_cmd
109
+ attr_accessor :device
110
+
111
+ def initialize
112
+ @halt_timeout = 30
113
+ @halt_check_interval = 1
114
+ @suexec_cmd = 'pfexec'
115
+ @device = "e1000g"
116
+ end
117
+ end
118
+
119
+
120
+ # A general Vagrant system implementation for "solaris10".
121
+ class Plugin < Vagrant.plugin("2")
122
+ name "Solaris10 guest"
123
+ description "Solaris10 guest support."
124
+
125
+ # A custom config class which will be made accessible via `config.solaris10`
126
+ # This is not necessary for all system implementers, of course. However,
127
+ # generally, Vagrant tries to make almost every aspect of its execution
128
+ # configurable, and this assists that goal.
129
+
130
+ guest(:solaris10) do
131
+
132
+ p "doing the guest"
133
+ p Vagrant::Plugin::V2::Plugin
134
+
135
+ Guest
136
+ end
137
+
138
+ config(:solaris10) do
139
+ SolarisConfig
140
+ end
141
+
142
+ #config("solaris10") do
143
+ # SolarisConfig
144
+ #end
145
+
146
+
147
+ # guest_capability("solaris10", "configure_networks") do
148
+ # Solaris10::Guest::configure_networks
149
+ # end
150
+ #
151
+ # guest_capability("solaris10", "configure_networks") do
152
+ # Solaris10::Guest::configure_networks
153
+ # end
154
+ #
155
+ # guest_capability("solaris10", "change_host_name") do
156
+ # Solaris10::Guest::change_host_name
157
+ # end
158
+ #
159
+ # guest_capability("solaris10", "mount_shared_folder") do
160
+ # Solaris10::Guest::mount_shared_folder
161
+ # end
162
+ #
163
+ # guest_capability("solaris10", "halt") do
164
+ # Guest::halt
165
+ # end
166
+ end
167
+ end
168
+ end
@@ -0,0 +1,5 @@
1
+ module Vagrant
2
+ module Solaris10
3
+ VERSION = "0.0.0"
4
+ end
5
+ end
data/tasks/gem.thor ADDED
@@ -0,0 +1,33 @@
1
+ class Gem < Thor
2
+ include Thor::Actions
3
+
4
+ # This allows for dynamic descriptions
5
+ begin
6
+ @gemhelper = Bundler::GemHelper.new
7
+ rescue
8
+ end
9
+
10
+ def initialize(*args)
11
+ super
12
+ @gemhelper = Bundler::GemHelper.new
13
+ end
14
+
15
+ # tasks
16
+ desc "build", @gemhelper.nil? ? "Building gem into the pkg directory" :
17
+ "Building #{@gemhelper.gemspec.name}-#{@gemhelper.gemspec.version}.gem into the pkg directory"
18
+ def build
19
+ @gemhelper.build_gem
20
+ end
21
+
22
+ desc "install", @gemhelper.nil? ? "Build and install gem into system gems" :
23
+ "Build and install #{@gemhelper.gemspec.name}-#{@gemhelper.gemspec.version}.gem into system gems"
24
+ def install
25
+ @gemhelper.install_gem
26
+ end
27
+
28
+ desc "release", @gemhelper.nil? ? "Create tag and build and push gem to Rubygems" :
29
+ "Create tag v#{@gemhelper.gemspec.version} and build and push #{@gemhelper.gemspec.name}-#{@gemhelper.gemspec.version}.gem to Rubygems"
30
+ def release
31
+ @gemhelper.release_gem
32
+ end
33
+ end
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'vagrant-solaris10/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "vagrant-solaris10"
8
+ gem.version = Vagrant::Solaris10::VERSION
9
+ gem.authors = ["Tnarik Innael"]
10
+ gem.email = ["tnarik@gmail.com"]
11
+ gem.description = "Guest plugin for Vagrant... Solaris10"
12
+ gem.summary = "Guest plugin for Vagrant... Solaris10"
13
+ gem.homepage = ""
14
+
15
+ gem.rubyforge_project = "vagrant-solaris10"
16
+
17
+ gem.files = `git ls-files`.split($/)
18
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
19
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
20
+ gem.require_paths = ["lib"]
21
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: vagrant-solaris10
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.0
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Tnarik Innael
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-04-15 00:00:00.000000000 Z
13
+ dependencies: []
14
+ description: Guest plugin for Vagrant... Solaris10
15
+ email:
16
+ - tnarik@gmail.com
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - .gitignore
22
+ - .rvmrc
23
+ - Gemfile
24
+ - LICENSE.txt
25
+ - README.md
26
+ - Rakefile
27
+ - lib/vagrant-solaris10.rb
28
+ - lib/vagrant-solaris10/version.rb
29
+ - tasks/gem.thor
30
+ - vagrant-solaris10.gemspec
31
+ homepage: ''
32
+ licenses: []
33
+ post_install_message:
34
+ rdoc_options: []
35
+ require_paths:
36
+ - lib
37
+ required_ruby_version: !ruby/object:Gem::Requirement
38
+ none: false
39
+ requirements:
40
+ - - ! '>='
41
+ - !ruby/object:Gem::Version
42
+ version: '0'
43
+ required_rubygems_version: !ruby/object:Gem::Requirement
44
+ none: false
45
+ requirements:
46
+ - - ! '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ requirements: []
50
+ rubyforge_project: vagrant-solaris10
51
+ rubygems_version: 1.8.17
52
+ signing_key:
53
+ specification_version: 3
54
+ summary: Guest plugin for Vagrant... Solaris10
55
+ test_files: []