mirror of https://github.com/zulip/zulip.git
Vagrantfile: Check for OS before patching the lxc-config.
Followup of e68b45d089
Without this vagrant up will fail on Windows.
https://chat.zulip.org/#narrow/stream/development.20help/topic/
Vagrant.20up.20error
This commit is contained in:
parent
b12a5a2da0
commit
718b3fcd6a
|
@ -31,25 +31,27 @@ end
|
||||||
# have the box (e.g. on first setup), Vagrant would download it but too
|
# have the box (e.g. on first setup), Vagrant would download it but too
|
||||||
# late for us to patch it like this; so we prompt them to explicitly add it
|
# late for us to patch it like this; so we prompt them to explicitly add it
|
||||||
# first and then rerun.
|
# first and then rerun.
|
||||||
if ['up', 'provision'].include? ARGV[0]
|
if Vagrant::Util::Platform.linux?
|
||||||
LXC_VERSION = `lxc-ls --version`.strip unless defined? LXC_VERSION
|
if ['up', 'provision'].include? ARGV[0]
|
||||||
if LXC_VERSION == "2.1.0"
|
LXC_VERSION = `lxc-ls --version`.strip unless defined? LXC_VERSION
|
||||||
lxc_config_file = ENV['HOME'] + "/.vagrant.d/boxes/fgrehm-VAGRANTSLASH-trusty64-lxc/1.2.0/lxc/lxc-config"
|
if LXC_VERSION == "2.1.0"
|
||||||
if File.file?(lxc_config_file)
|
lxc_config_file = ENV['HOME'] + "/.vagrant.d/boxes/fgrehm-VAGRANTSLASH-trusty64-lxc/1.2.0/lxc/lxc-config"
|
||||||
lines = File.readlines(lxc_config_file)
|
if File.file?(lxc_config_file)
|
||||||
deprecated_line = "lxc.pivotdir = lxc_putold\n"
|
lines = File.readlines(lxc_config_file)
|
||||||
if lines[1] == deprecated_line
|
deprecated_line = "lxc.pivotdir = lxc_putold\n"
|
||||||
lines[1] = "# #{deprecated_line}"
|
if lines[1] == deprecated_line
|
||||||
File.open(lxc_config_file, 'w') do |f|
|
lines[1] = "# #{deprecated_line}"
|
||||||
f.puts(lines)
|
File.open(lxc_config_file, 'w') do |f|
|
||||||
|
f.puts(lines)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
puts 'You are running LXC 2.1.0, and fgrehm/trusty64-lxc box is incompatible '\
|
||||||
|
"with it by default. First add the box by doing:\n"\
|
||||||
|
" vagrant box add https://vagrantcloud.com/fgrehm/trusty64-lxc\n"\
|
||||||
|
'Once this command succeeds, do "vagrant up" again.'
|
||||||
|
exit
|
||||||
end
|
end
|
||||||
else
|
|
||||||
puts 'You are running LXC 2.1.0, and fgrehm/trusty64-lxc box is incompatible '\
|
|
||||||
"with it by default. First add the box by doing:\n"\
|
|
||||||
" vagrant box add https://vagrantcloud.com/fgrehm/trusty64-lxc\n"\
|
|
||||||
'Once this command succeeds, do "vagrant up" again.'
|
|
||||||
exit
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue