diff options
| author | Mitch Riedstra <mitch@riedstra.us> | 2020-11-12 15:11:10 -0500 |
|---|---|---|
| committer | Mitch Riedstra <mitch@riedstra.us> | 2020-11-12 15:11:10 -0500 |
| commit | 00bcdaf78ee2bd258ec40c0111be8db3399a22bc (patch) | |
| tree | cebe18877be92c7470dc30323ac05c9a6f22c973 /tezos/install.sh | |
| parent | 55d75452c658f2a46c439d0d632b626f1889b612 (diff) | |
| download | dotfiles-00bcdaf78ee2bd258ec40c0111be8db3399a22bc.tar.gz dotfiles-00bcdaf78ee2bd258ec40c0111be8db3399a22bc.tar.xz | |
Add tezos scripts
Diffstat (limited to 'tezos/install.sh')
| -rw-r--r-- | tezos/install.sh | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/tezos/install.sh b/tezos/install.sh new file mode 100644 index 0000000..0d55472 --- /dev/null +++ b/tezos/install.sh @@ -0,0 +1,68 @@ +#!/bin/sh +set -e + +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +# FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +ocaml_compiler="4.09.1" +ocaml_switch_name="for_tezos" + +printf "\033[1;31m" +echo "**********************************************************************" +echo "* Short install script for tezos from source code, loosely based on: *" +echo "* https://tezos.gitlab.io/introduction/howtoget.html *" +echo "* *" +echo "* This script was created on 09-12-2020 and may need some checking *" +echo "* over for updates in the future *" +echo "* *" +echo "* ocaml_compiler: $ocaml_compiler *" +echo "**********************************************************************" +echo +printf "\033[0m" + +set -x + +# Check and see if cargo is in the path, if not let's add it +if ! echo "$PATH"| grep -q cargo ; then + export PATH="$HOME/.cargo/bin:$PATH" +fi + +# Check and see if rustc is available, if not we're going to go ahead +# and try to install it from their main source +if ! stat "$(which rustc | sed 1q)" >/dev/null 2>&1 ; then + echo "Need rustc... installing" + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh +fi + +rustup set profile minimal +rustup toolchain install 1.39.0 +rustup default 1.39.0 +. $HOME/.cargo/env + +# Check and see if we have the ppa already, if not let's go ahead and add it +if ! apt policy 2>/dev/null | grep -q avsm/ppa ; then + sudo add-apt-repository ppa:avsm/ppa + sudo apt update +fi +sudo apt install opam + +# Only run if the switch for our tezos install does not currently exist +if ! opam switch list 2>/dev/null | grep -q "$ocaml_switch_name" ; then + opam switch create "$ocaml_switch_name" "$ocaml_compiler" +fi +opam switch "$ocaml_switch_name" +eval $(opam env) + +opam install depext +opam depext tezos + +opam install tezos |
