ligo/scripts/install_opam.sh

28 lines
940 B
Bash
Raw Normal View History

2019-05-28 22:54:37 +04:00
#!/bin/sh
set -e
2019-09-06 06:02:18 +04:00
set -x
# TODO: this has many different modes of failure (file temp.opam-2.0.1-x86_64-linux.download-in-progress already exists, /usr/local/bin/opam already exists and is a directory or hard link, …)
# Try to improve these aspects.
2019-09-06 06:02:18 +04:00
if command -v wget >/dev/null 2>&1; then
wget https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux -O temp.opam-2.0.1-x86_64-linux.download-in-progress
else
curl -L https://github.com/ocaml/opam/releases/download/2.0.1/opam-2.0.1-x86_64-linux --output temp.opam-2.0.1-x86_64-linux.download-in-progress
fi
# debug
ls
apt -y install hexdump || true
apt -y install xxd || true
(cat temp.opam-2.0.1-x86_64-linux.download-in-progress | xxd | head -n 30) || true
cp -i temp.opam-2.0.1-x86_64-linux.download-in-progress /usr/local/bin/opam
chmod +x /usr/local/bin/opam
rm temp.opam-2.0.1-x86_64-linux.download-in-progress
2019-09-06 06:02:18 +04:00
which opam || true
opam init -a --bare