scripts/vagrant: Remove inline shell scripts
Moved inline provisioning steps to external script, to tidy up Vagrantfile Signed-off-by: Maciej Wawryk <maciejx.wawryk@intel.com> Change-Id: I65ffae8180c2fb28701be34384b13928877db5fa Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2946 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Mellanox Build Bot Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com>
This commit is contained in:
parent
6fac35a3f4
commit
436b9be9d0
49
scripts/vagrant/Vagrantfile
vendored
49
scripts/vagrant/Vagrantfile
vendored
@ -74,14 +74,11 @@ Vagrant.configure(2) do |config|
|
||||
|
||||
# Copy the tsocks configuration file for use when installing some spdk test pool dependencies
|
||||
if File.file?("/etc/tsocks.conf")
|
||||
$tsocks_copy = <<-SCRIPT
|
||||
sudo -s
|
||||
mv -f tsocks.conf /etc/tsocks.conf
|
||||
chown root /etc/tsocks.conf
|
||||
chmod 644 /etc/tsocks.conf
|
||||
SCRIPT
|
||||
config.vm.provision "file", source: "/etc/tsocks.conf", destination: "tsocks.conf"
|
||||
config.vm.provision "shell", inline: $tsocks_copy
|
||||
config.vm.provision "shell" do |setup|
|
||||
setup.path = "#{spdk_dir}/scripts/vagrant/vagrantfiles/tsocks_setup.sh"
|
||||
setup.privileged = true
|
||||
end
|
||||
end
|
||||
|
||||
# vagrant-cachier caches apt/yum etc to speed subsequent
|
||||
@ -105,15 +102,11 @@ Vagrant.configure(2) do |config|
|
||||
# Proxyconf does not seem to support FreeBSD boxes or at least it's
|
||||
# docs do not mention that. Set up proxy configuration manually.
|
||||
if distro.include?("freebsd")
|
||||
$freebsd_proxy = <<-SCRIPT
|
||||
sudo -s
|
||||
echo "export http_proxy=#{ENV['http_proxy']}" >> /etc/profile
|
||||
echo "export https_proxy=#{ENV['http_proxy']}" >> /etc/profile
|
||||
echo "pkg_env: {http_proxy: #{ENV['http_proxy']}}" > /usr/local/etc/pkg.conf
|
||||
chown root:wheel /usr/local/etc/pkg.conf
|
||||
chmod 644 /usr/local/etc/pkg.conf
|
||||
SCRIPT
|
||||
config.vm.provision "shell", inline: $freebsd_proxy
|
||||
config.vm.provision "shell" do |setup|
|
||||
setup.path = "#{spdk_dir}/scripts/vagrant/vagrantfiles/freebsd_proxy.sh"
|
||||
setup.privileged = true
|
||||
setup.args = ["#{ENV['http_proxy']}"]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -122,14 +115,10 @@ Vagrant.configure(2) do |config|
|
||||
# To make sources usable in the guest VM we need to unmount them and use
|
||||
# local copy.
|
||||
if distro.include?("freebsd")
|
||||
$freebsd_spdk_repo = <<-SCRIPT
|
||||
sudo -s
|
||||
cp -R /home/vagrant/spdk_repo/spdk /tmp/spdk
|
||||
umount /home/vagrant/spdk_repo/spdk && rm -rf /home/vagrant/spdk_repo/spdk
|
||||
mv /tmp/spdk /home/vagrant/spdk_repo/spdk
|
||||
chown -R vagrant:vagrant /home/vagrant/spdk_repo/spdk
|
||||
SCRIPT
|
||||
config.vm.provision "shell", inline: $freebsd_spdk_repo
|
||||
config.vm.provision "shell" do |setup|
|
||||
setup.path = "#{spdk_dir}/scripts/vagrant/vagrantfiles/freebsd_spdk_repo.sh"
|
||||
setup.privileged = true
|
||||
end
|
||||
end
|
||||
|
||||
config.ssh.forward_agent = true
|
||||
@ -252,14 +241,10 @@ Vagrant.configure(2) do |config|
|
||||
|
||||
# Clear CFLAGS in clear linux
|
||||
if distro == "clearlinux"
|
||||
$clearcflags = <<-SCRIPT
|
||||
echo "export CFLAGS=" >> /etc/profile.d/clearcflags.sh
|
||||
echo "export CFFLAGS=" >> /etc/profile.d/clearcflags.sh
|
||||
echo "export CXXFLAGS=" >> /etc/profile.d/clearcflags.sh
|
||||
echo "export FFLAGS=" >> /etc/profile.d/clearcflags.sh
|
||||
echo "export THEANO_FLAGS=" >> /etc/profile.d/clearcflags.sh
|
||||
SCRIPT
|
||||
config.vm.provision "shell", inline: $clearcflags, run: "always"
|
||||
config.vm.provision "shell" do |setup|
|
||||
setup.path = "#{spdk_dir}/scripts/vagrant/vagrantfiles/clearlinux_cflags.sh"
|
||||
setup.privileged = false
|
||||
end
|
||||
end
|
||||
|
||||
# Copy in the user's tools if they exists
|
||||
|
9
scripts/vagrant/vagrantfiles/clearlinux_cflags.sh
Executable file
9
scripts/vagrant/vagrantfiles/clearlinux_cflags.sh
Executable file
@ -0,0 +1,9 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cat <<- FLAGS >> /etc/profile.d/clearcflags.sh
|
||||
export CFLAGS=
|
||||
export CFFLAGS=
|
||||
export CXXFLAGS=
|
||||
export FFLAGS=
|
||||
export THEANO_FLAGS=
|
||||
FLAGS
|
11
scripts/vagrant/vagrantfiles/freebsd_proxy.sh
Executable file
11
scripts/vagrant/vagrantfiles/freebsd_proxy.sh
Executable file
@ -0,0 +1,11 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
http_proxy=$1
|
||||
|
||||
cat <<- PROXY >> /etc/profile
|
||||
export http_proxy=${http_proxy}
|
||||
export https_proxy=${http_proxy}
|
||||
PROXY
|
||||
echo "pkg_env: {http_proxy: ${http_proxy}" > /usr/local/etc/pkg.conf
|
||||
chown root:wheel /usr/local/etc/pkg.conf
|
||||
chmod 644 /usr/local/etc/pkg.conf
|
6
scripts/vagrant/vagrantfiles/freebsd_spdk_repo.sh
Executable file
6
scripts/vagrant/vagrantfiles/freebsd_spdk_repo.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cp -R /home/vagrant/spdk_repo/spdk /tmp/spdk
|
||||
umount /home/vagrant/spdk_repo/spdk && rm -rf /home/vagrant/spdk_repo/spdk
|
||||
mv /tmp/spdk /home/vagrant/spdk_repo/spdk
|
||||
chown -R vagrant:vagrant /home/vagrant/spdk_repo/spdk
|
5
scripts/vagrant/vagrantfiles/tsocks_setup.sh
Executable file
5
scripts/vagrant/vagrantfiles/tsocks_setup.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
mv -f tsocks.conf /etc/tsocks.conf
|
||||
chown root /etc/tsocks.conf
|
||||
chmod 644 /etc/tsocks.conf
|
Loading…
Reference in New Issue
Block a user