From 80a626443791f01cbf80feb437fba5e5cf9e9963 Mon Sep 17 00:00:00 2001 From: Jamil Bou Kheir Date: Sun, 3 May 2020 13:31:52 -0700 Subject: [PATCH] Install elixir/erlang as unprivileged --- Vagrantfile | 3 ++- provision.sh => provision_deps.sh | 18 ------------------ provision_runtimes.sh | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+), 19 deletions(-) rename provision.sh => provision_deps.sh (68%) create mode 100644 provision_runtimes.sh diff --git a/Vagrantfile b/Vagrantfile index 796dd721e..63b65de04 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -7,5 +7,6 @@ Vagrant.configure("2") do |config| vb.memory = "1024" end - config.vm.provision "shell", path: "provision.sh" + config.vm.provision "shell", path: "provision_deps.sh", privileged: true + config.vm.provision "shell", path: "provision_runtimes.sh", privileged: false end diff --git a/provision.sh b/provision_deps.sh similarity index 68% rename from provision.sh rename to provision_deps.sh index 1be131cb8..d4669ea87 100644 --- a/provision.sh +++ b/provision_deps.sh @@ -61,21 +61,3 @@ apt-get install -y --no-install-recommends \ libwxgtk3.0-dev \ wireguard wireguard-tools wireguard-dkms \ nftables - - -# Install asdfgit clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.o -git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.8 -echo '. $HOME/.asdf/asdf.sh' >> ~/.bash_profile -echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile -source ~/.bash_profile - -asdf plugin-add erlang -asdf install erlang 22.3.3 -asdf global erlang 22.3.3 - -asdf plugin-add elixir -asdf install elixir 1.10.3-otp-22 -asdf global elixir 1.10.3-otp-22 - -# Is it working? -elixir -e 'IO.puts("Hello World!")' diff --git a/provision_runtimes.sh b/provision_runtimes.sh new file mode 100644 index 000000000..18b968c49 --- /dev/null +++ b/provision_runtimes.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +set -e + +# Install runtimes as vagrant user +# Install asdf +git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.8 +echo '. $HOME/.asdf/asdf.sh' >> ~/.bash_profile +echo '. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile +source ~/.bash_profile + +asdf plugin-add erlang +asdf install erlang 22.3.3 +asdf global erlang 22.3.3 + +asdf plugin-add elixir +asdf install elixir 1.10.3-otp-22 +asdf global elixir 1.10.3-otp-22 + +# Is it working? +elixir -e 'IO.puts("Hello World!")'