vagrant-guest-msys2 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +11 -0
- data/README.md +2 -0
- data/lib/vagrant-guest-msys2/cap/change_host_name.rb +0 -2
- data/lib/vagrant-guest-msys2/cap/mount_shared_folder.rb +40 -0
- data/lib/vagrant-guest-msys2/plugin.rb +5 -10
- data/lib/vagrant-guest-msys2/scripts/mount_volume.ps1.erb +48 -0
- data/lib/vagrant-guest-msys2/version.rb +1 -1
- data/vagrant-guest-msys2.gemspec +3 -31
- metadata +22 -20
- data/lib/vagrant-guest-msys2/cap/powershell.rb +0 -59
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af7802cda0568d6a063b68cb3452f67648159dd0
|
4
|
+
data.tar.gz: fcfbc1a87759bb101f21de94f6b8810bc968c4cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a395497aeffc997adbcf174e3393db6b91c3930ef52d0417ba8a18d8e889888a73e38bdaec566db87b395c5045e7d3b38afbebd7cf30a8ef92eb62d37557f0cf
|
7
|
+
data.tar.gz: 0a14c3a8f140356d7e35f77796b634c9eb23466468e71639f93613061ae78f8ad83430ca0f7d223e631858689580dec81aa202b041b540462102879682dc7520
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
[![Build Status](https://travis-ci.org/tsmolka/vagrant-guest-msys2.svg?branch=master)](https://travis-ci.org/tsmolka/vagrant-guest-msys2) [![Gem Version](https://badge.fury.io/rb/vagrant-guest-msys2.svg)](http://badge.fury.io/rb/vagrant-guest-msys2)
|
2
|
+
|
1
3
|
vagrant-guest-msys2
|
2
4
|
==============
|
3
5
|
|
@@ -9,8 +9,6 @@ module VagrantPlugins
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.change_host_name_and_wait(machine, name, sleep_timeout)
|
12
|
-
machine.guest.capability(:powershell_check) if machine.guest.capability?(:powershell_check)
|
13
|
-
|
14
12
|
escaped_name = name.gsub("'", "''")
|
15
13
|
|
16
14
|
# If the configured name matches the current name, then bail
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require "vagrant/util/template_renderer"
|
2
|
+
require "vagrant-guest-msys2/util/cap_helpers"
|
3
|
+
|
4
|
+
module VagrantPlugins
|
5
|
+
module GuestMSYS2
|
6
|
+
module Cap
|
7
|
+
class MountSharedFolder
|
8
|
+
def self.mount_virtualbox_shared_folder(machine, name, guestpath, options)
|
9
|
+
mount_shared_folder(machine, name, guestpath, "\\\\vboxsrv\\")
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.mount_vmware_shared_folder(machine, name, guestpath, options)
|
13
|
+
mount_shared_folder(machine, name, guestpath, "\\\\vmware-host\\Shared Folders\\")
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.mount_parallels_shared_folder(machine, name, guestpath, options)
|
17
|
+
mount_shared_folder(machine, name, guestpath, "\\\\psf\\")
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.mount_smb_shared_folder(machine, name, guestpath, options)
|
21
|
+
machine.communicate.execute("cmdkey -add:#{options[:smb_host]} -user:#{options[:smb_username]} -pass:#{options[:smb_password]}")
|
22
|
+
mount_shared_folder(machine, name, guestpath, "\\\\#{options[:smb_host]}\\")
|
23
|
+
end
|
24
|
+
|
25
|
+
protected
|
26
|
+
|
27
|
+
def self.mount_shared_folder(machine, name, guestpath, vm_provider_unc_base)
|
28
|
+
name = name.gsub(/[\/\/]/,'_').sub(/^_/, '')
|
29
|
+
path = File.expand_path("../../scripts/mount_volume.ps1", __FILE__)
|
30
|
+
script = Vagrant::Util::TemplateRenderer.render(path, options: {
|
31
|
+
mount_point: guestpath,
|
32
|
+
share_name: name,
|
33
|
+
vm_provider_unc_path: vm_provider_unc_base + name,
|
34
|
+
})
|
35
|
+
machine.communicate.execute(Util::CapHelpers.wrap_powershell(script))
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -77,21 +77,16 @@ module VagrantPlugins
|
|
77
77
|
Cap::Powershell
|
78
78
|
end
|
79
79
|
|
80
|
-
guest_capability("msys2", "powershell_install") do
|
81
|
-
require_relative "cap/powershell"
|
82
|
-
Cap::Powershell
|
83
|
-
end
|
84
|
-
|
85
|
-
guest_capability("msys2", "powershell_installed") do
|
86
|
-
require_relative "cap/powershell"
|
87
|
-
Cap::Powershell
|
88
|
-
end
|
89
|
-
|
90
80
|
guest_capability("msys2", "configure_networks") do
|
91
81
|
require_relative "cap/configure_networks"
|
92
82
|
Cap::ConfigureNetworks
|
93
83
|
end
|
94
84
|
|
85
|
+
guest_capability("msys2", "mount_virtualbox_shared_folder") do
|
86
|
+
require_relative "cap/mount_shared_folder"
|
87
|
+
Cap::MountSharedFolder
|
88
|
+
end
|
89
|
+
|
95
90
|
protected
|
96
91
|
|
97
92
|
def self.init!
|
@@ -0,0 +1,48 @@
|
|
1
|
+
function Test-ReparsePoint([string]$path) {
|
2
|
+
$file = Get-Item $path -Force -ea 0
|
3
|
+
return [bool]($file.Attributes -band [IO.FileAttributes]::ReparsePoint)
|
4
|
+
}
|
5
|
+
|
6
|
+
$MountPoint = [System.IO.Path]::GetFullPath("<%= options[:mount_point] %>")
|
7
|
+
$ShareName = "<%= options[:share_name] %>"
|
8
|
+
$VmProviderUncPath = "<%= options[:vm_provider_unc_path] %>"
|
9
|
+
|
10
|
+
# https://github.com/BIAINC/vagrant-windows/issues/4
|
11
|
+
# Not sure why this works, but it does.
|
12
|
+
|
13
|
+
& net use $ShareName 2>&1 | Out-Null
|
14
|
+
|
15
|
+
Write-Output "Attempting to mount $ShareName to $MountPoint"
|
16
|
+
if( (Test-Path "$MountPoint") -and (Test-ReparsePoint "$MountPoint") )
|
17
|
+
{
|
18
|
+
Write-Output "Junction already exists, so I will delete it"
|
19
|
+
# Powershell refuses to delete junctions, oh well use cmd
|
20
|
+
cmd /c rd "$MountPoint"
|
21
|
+
|
22
|
+
if ( $LASTEXITCODE -ne 0 )
|
23
|
+
{
|
24
|
+
Write-Error "Failed to delete symbolic link at $MountPoint"
|
25
|
+
exit 1
|
26
|
+
}
|
27
|
+
|
28
|
+
}
|
29
|
+
elseif(Test-Path $MountPoint)
|
30
|
+
{
|
31
|
+
Write-Output "Mount point already exists and is not a symbolic link"
|
32
|
+
exit 1
|
33
|
+
}
|
34
|
+
|
35
|
+
$BaseDirectory = [System.IO.Path]::GetDirectoryName($MountPoint)
|
36
|
+
|
37
|
+
if (-not (Test-Path $BaseDirectory))
|
38
|
+
{
|
39
|
+
Write-Output "Creating parent directory for mount point $BaseDirectory"
|
40
|
+
New-Item $BaseDirectory -Type Directory -Force | Out-Null
|
41
|
+
}
|
42
|
+
|
43
|
+
& cmd.exe /c mklink /D "$MountPoint" "$VmProviderUncPath" | out-null
|
44
|
+
|
45
|
+
if ( $LASTEXITCODE -ne 0 )
|
46
|
+
{
|
47
|
+
exit 1
|
48
|
+
}
|
data/vagrant-guest-msys2.gemspec
CHANGED
@@ -14,37 +14,9 @@ Gem::Specification.new do |s|
|
|
14
14
|
s.description = "Adds MSYS2 (https://sourceforge.net/p/msys2/wiki/Home/) as a guest for Vagrant. "
|
15
15
|
s.homepage = "https://github.com/tsmolka/vagrant-guest-msys2"
|
16
16
|
s.required_rubygems_version = ">= 1.3.6"
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
root_path = File.dirname(__FILE__)
|
21
|
-
all_files = Dir.chdir(root_path) { Dir.glob("**/{*,.*}") }
|
22
|
-
all_files.reject! { |file| [".", ".."].include?(File.basename(file)) }
|
23
|
-
gitignore_path = File.join(root_path, ".gitignore")
|
24
|
-
gitignore = File.readlines(gitignore_path)
|
25
|
-
gitignore.map! { |line| line.chomp.strip }
|
26
|
-
gitignore.reject! { |line| line.empty? || line =~ /^(#|!)/ }
|
27
|
-
|
28
|
-
unignored_files = all_files.reject do |file|
|
29
|
-
# Ignore any directories, the gemspec only cares about files
|
30
|
-
next true if File.directory?(file)
|
31
|
-
|
32
|
-
# Ignore any paths that match anything in the gitignore. We do
|
33
|
-
# two tests here:
|
34
|
-
#
|
35
|
-
# - First, test to see if the entire path matches the gitignore.
|
36
|
-
# - Second, match if the basename does, this makes it so that things
|
37
|
-
# like '.DS_Store' will match sub-directories too (same behavior
|
38
|
-
# as git).
|
39
|
-
#
|
40
|
-
gitignore.any? do |ignore|
|
41
|
-
File.fnmatch(ignore, file, File::FNM_PATHNAME) ||
|
42
|
-
File.fnmatch(ignore, File.basename(file), File::FNM_PATHNAME)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
s.files = unignored_files
|
47
|
-
s.executables = unignored_files.map { |f| f[/^bin\/(.*)/, 1] }.compact
|
17
|
+
root_path = File.dirname(__FILE__)
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split($INPUT_RECORD_SEPARATOR)
|
48
20
|
s.require_path = 'lib'
|
49
21
|
end
|
50
22
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-guest-msys2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tobias
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2017-03-09 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: 'Adds MSYS2 (https://sourceforge.net/p/msys2/wiki/Home/) as a guest for
|
15
15
|
Vagrant. '
|
@@ -18,30 +18,32 @@ executables: []
|
|
18
18
|
extensions: []
|
19
19
|
extra_rdoc_files: []
|
20
20
|
files:
|
21
|
+
- ".gitignore"
|
22
|
+
- ".travis.yml"
|
23
|
+
- CHANGELOG.md
|
24
|
+
- Gemfile
|
25
|
+
- LICENSE
|
26
|
+
- README.md
|
27
|
+
- Rakefile
|
21
28
|
- lib/vagrant-guest-msys2.rb
|
22
|
-
- lib/vagrant-guest-msys2/plugin.rb
|
23
29
|
- lib/vagrant-guest-msys2/cap/change_host_name.rb
|
24
30
|
- lib/vagrant-guest-msys2/cap/choose_addressable_ip_addr.rb
|
25
|
-
- lib/vagrant-guest-msys2/cap/powershell.rb
|
26
|
-
- lib/vagrant-guest-msys2/cap/remove_public_key.rb
|
27
|
-
- lib/vagrant-guest-msys2/cap/halt.rb
|
28
31
|
- lib/vagrant-guest-msys2/cap/configure_networks.rb
|
32
|
+
- lib/vagrant-guest-msys2/cap/halt.rb
|
33
|
+
- lib/vagrant-guest-msys2/cap/insert_public_key.rb
|
34
|
+
- lib/vagrant-guest-msys2/cap/mount_shared_folder.rb
|
29
35
|
- lib/vagrant-guest-msys2/cap/reboot.rb
|
36
|
+
- lib/vagrant-guest-msys2/cap/remove_public_key.rb
|
30
37
|
- lib/vagrant-guest-msys2/cap/rsync.rb
|
31
|
-
- lib/vagrant-guest-msys2/cap/insert_public_key.rb
|
32
|
-
- lib/vagrant-guest-msys2/util/cap_helpers.rb
|
33
|
-
- lib/vagrant-guest-msys2/guest_network.rb
|
34
|
-
- lib/vagrant-guest-msys2/version.rb
|
35
38
|
- lib/vagrant-guest-msys2/errors.rb
|
36
39
|
- lib/vagrant-guest-msys2/guest.rb
|
37
|
-
-
|
38
|
-
-
|
39
|
-
- vagrant-guest-msys2.
|
40
|
-
-
|
41
|
-
-
|
42
|
-
- LICENSE
|
40
|
+
- lib/vagrant-guest-msys2/guest_network.rb
|
41
|
+
- lib/vagrant-guest-msys2/plugin.rb
|
42
|
+
- lib/vagrant-guest-msys2/scripts/mount_volume.ps1.erb
|
43
|
+
- lib/vagrant-guest-msys2/util/cap_helpers.rb
|
44
|
+
- lib/vagrant-guest-msys2/version.rb
|
43
45
|
- locales/en.yml
|
44
|
-
- .
|
46
|
+
- vagrant-guest-msys2.gemspec
|
45
47
|
homepage: https://github.com/tsmolka/vagrant-guest-msys2
|
46
48
|
licenses:
|
47
49
|
- GPL-2.0
|
@@ -52,17 +54,17 @@ require_paths:
|
|
52
54
|
- lib
|
53
55
|
required_ruby_version: !ruby/object:Gem::Requirement
|
54
56
|
requirements:
|
55
|
-
- -
|
57
|
+
- - ">="
|
56
58
|
- !ruby/object:Gem::Version
|
57
59
|
version: '0'
|
58
60
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
59
61
|
requirements:
|
60
|
-
- -
|
62
|
+
- - ">="
|
61
63
|
- !ruby/object:Gem::Version
|
62
64
|
version: 1.3.6
|
63
65
|
requirements: []
|
64
66
|
rubyforge_project:
|
65
|
-
rubygems_version: 2.
|
67
|
+
rubygems_version: 2.6.10
|
66
68
|
signing_key:
|
67
69
|
specification_version: 4
|
68
70
|
summary: MSYS2 guest for Vagrant
|
@@ -1,59 +0,0 @@
|
|
1
|
-
module VagrantPlugins
|
2
|
-
module GuestMSYS2
|
3
|
-
module Cap
|
4
|
-
class Powershell
|
5
|
-
def self.powershell_installed(machine)
|
6
|
-
machine.communicate.test('which powershell')
|
7
|
-
end
|
8
|
-
|
9
|
-
def self.powershell_install(machine)
|
10
|
-
machine.ui.info I18n.t("vagrant-guest-msys2.info.run_powershell_install")
|
11
|
-
script = <<-EOH.gsub(/^ {12}/, '')
|
12
|
-
set -e
|
13
|
-
OS_VERSION=`echo '' | wmic os get version | grep -o '^[0-9]*\\.[0-9]*'`
|
14
|
-
OS_ARCH=`regtool -l get '\\HKLM\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment\\PROCESSOR_ARCHITECTURE' | tr '[:upper:]' '[:lower:]'`
|
15
|
-
|
16
|
-
if [ "$OS_VERSION" = "5.1" -a "$OS_ARCH" = "x86" ]; then # Windows XP 32-bit
|
17
|
-
pacman -S --noconfirm wget
|
18
|
-
|
19
|
-
if ! (regtool -l get '\\HKLM\\SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v2.0.50727\\SP' | grep -q "1"); then
|
20
|
-
wget --no-verbose --no-check-certificate "https://download.microsoft.com/download/0/8/c/08c19fa4-4c4f-4ffb-9d6c-150906578c9e/NetFx20SP1_x86.exe" -O "/tmp/NetFx20SP1_x86.exe"
|
21
|
-
/tmp/NetFx20SP1_x86.exe //passive //norestart
|
22
|
-
rm /tmp/NetFx20SP1_x86.exe
|
23
|
-
fi
|
24
|
-
|
25
|
-
if ! (regtool -l get '\\HKLM\\SOFTWARE\\Microsoft\\PowerShell\\1\\PowerShellEngine\\PowerShellVersion' | grep -q "2\\.0"); then
|
26
|
-
wget --no-verbose --no-check-certificate "https://download.microsoft.com/download/E/C/E/ECE99583-2003-455D-B681-68DB610B44A4/WindowsXP-KB968930-x86-ENG.exe" -O "/tmp/WindowsXP-KB968930-x86-ENG.exe"
|
27
|
-
/tmp/WindowsXP-KB968930-x86-ENG.exe //passive //norestart
|
28
|
-
rm /tmp/WindowsXP-KB968930-x86-ENG.exe
|
29
|
-
fi
|
30
|
-
else
|
31
|
-
(>&2 echo Unsupported OS $OS_VERSION $OS_ARCH)
|
32
|
-
fi
|
33
|
-
|
34
|
-
if [ -f "c:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -a ! -f /bin/powershell ]; then
|
35
|
-
echo '#!/bin/sh'$'\\n''"c:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe" -inputformat none $@' > /bin/powershell
|
36
|
-
chmod 755 /bin/powershell
|
37
|
-
fi
|
38
|
-
|
39
|
-
which powershell
|
40
|
-
EOH
|
41
|
-
machine.communicate.execute(script)
|
42
|
-
end
|
43
|
-
|
44
|
-
def self.powershell_check(machine)
|
45
|
-
if machine.guest.capability?(:powershell_installed)
|
46
|
-
installed = machine.guest.capability(:powershell_installed)
|
47
|
-
if !installed
|
48
|
-
if machine.guest.capability?(:powershell_install)
|
49
|
-
machine.guest.capability(:powershell_install)
|
50
|
-
end
|
51
|
-
installed = machine.guest.capability(:powershell_installed)
|
52
|
-
raise Errors::PowershellNotInstalledInGuest if !installed
|
53
|
-
end
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|