Skip to content

Instantly share code, notes, and snippets.

@lotreal
Last active October 6, 2023 10:26
Show Gist options
  • Save lotreal/1e16a3fe24191ec86137 to your computer and use it in GitHub Desktop.
Save lotreal/1e16a3fe24191ec86137 to your computer and use it in GitHub Desktop.
解决中国局域网中 vagrant plugin install vagrant-vbguest 出错的问题
#!/usr/bin/env bash
GEMS=$(cat <<EOF
childprocess-0.5.8.gem
ffi-1.9.10.gem
little-plugger-1.1.4.gem
micromachine-1.1.0.gem
multi_json-1.11.1.gem
net-ssh-2.9.2.gem
rest-client-1.6.9.gem
vagrant-vbguest-0.11.0.gem
EOF
)
CACHE=$HOME/.vagrant.d/gems/cache
mkdir -p $CACHE
for GEM in $GEMS
do
URL=https://gems.ruby-china.com/$GEM
echo "Downloading: $URL"
curl --progress-bar -o $CACHE/$GEM -L $URL
done
vagrant plugin install vagrant-vbguest
@lotreal
Copy link
Author

lotreal commented Feb 17, 2020

taobao 的 ruby 镜像已经没有了,改成 ruby china 来提供镜像了:
https://gems.ruby-china.com/
麻烦楼主更新一下脚本

已更新,谢谢提供

@ivalue2333
Copy link

你好,执行这个脚本遇到了以下问题。

环境 windows10

$ vagrant -v
Vagrant 2.2.14

VirtualBox 图形用户界面
版本 6.1.16 r140961 (Qt5.6.2)

$ sh install-vagrant-vbguest.sh
Downloading: https://gems.ruby-china.com/childprocess-0.5.8.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/ffi-1.9.10.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/little-plugger-1.1.4.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/micromachine-1.1.0.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/multi_json-1.11.1.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/net-ssh-2.9.2.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/rest-client-1.6.9.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/vagrant-vbguest-0.11.0.gem
######################################################################## 100.0%
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.6.0/rubygems/package/tar_header.rb:130:in strict_oct': "arset=ut" is not an octal string (ArgumentError) from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.6.0/rubygems/package/tar_header.rb:109:in from'

@lotreal
Copy link
Author

lotreal commented Jan 19, 2021

你好,执行这个脚本遇到了以下问题。

环境 windows10

$ vagrant -v
Vagrant 2.2.14

VirtualBox 图形用户界面
版本 6.1.16 r140961 (Qt5.6.2)

$ sh install-vagrant-vbguest.sh
Downloading: https://gems.ruby-china.com/childprocess-0.5.8.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/ffi-1.9.10.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/little-plugger-1.1.4.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/micromachine-1.1.0.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/multi_json-1.11.1.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/net-ssh-2.9.2.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/rest-client-1.6.9.gem
######################################################################## 100.0%
Downloading: https://gems.ruby-china.com/vagrant-vbguest-0.11.0.gem
######################################################################## 100.0%
Installing the 'vagrant-vbguest' plugin. This can take a few minutes...
C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.6.0/rubygems/package/tar_header.rb:130:in strict_oct': "arset=ut" is not an octal string (ArgumentError) from C:/HashiCorp/Vagrant/embedded/mingw64/lib/ruby/2.6.0/rubygems/package/tar_header.rb:109:in from'

你好,已经几年,依赖包的版本号估计需要手动改一下。另外,脚本没有在 Windows 环境下测试过。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment