Skip to content

Commit

Permalink
Fix check if opam is already installed
Browse files Browse the repository at this point in the history
The installation needs to be run as the user to have its own PATH.
Thus, the install parts need to be run with sudo

Signed-off-by: Paul-Elliot <[email protected]>
  • Loading branch information
panglesd committed Sep 26, 2022
1 parent ab186ec commit 77b429c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
uncommon one. (#106)
- Display version to be installed and whether a package needs to be built in the
logs (#103)
- Fix opam detection in installer script (#102)
- Log before initialising Opam (#93)
- Use OPAMCLI environment variable set to "2.0" to force the CLI version of
future opam version. (#92)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ This set-up goes through several steps, some of which have to be redone for ever
sudo apt install bzip2 make gcc bubblewrap rsync patch curl unzip
```

You can now run the installer script as `root`:
You can now run the installer script (which will call `sudo` for the final installation step):

```sh
sudo bash < <(curl -sL https://github.com/tarides/ocaml-platform-installer/releases/latest/download/installer.sh)
bash < <(curl -sL https://github.com/tarides/ocaml-platform-installer/releases/latest/download/installer.sh)
```

Don't hesitate to have a look at what the script does.
Expand Down
6 changes: 3 additions & 3 deletions src/distrib/make_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ install_opam ()
check_sha512 "\$sha512" opam
echo "=> Install into \$PREFIX/bin"
install -m755 "opam" "\$PREFIX/bin"
sudo install -m755 "opam" "\$PREFIX/bin"
}
cd "\$(mktemp -d)"
Expand All @@ -107,10 +107,10 @@ check_sha512 "\$sha512" "\$archive"
tar xf "\$archive"
echo "=> Install into \$PREFIX/bin"
install -m755 bin/* "\$PREFIX/bin"
sudo install -m755 bin/* "\$PREFIX/bin"
# Install Opam if necessary
if ! [[ -e \$PREFIX/bin/opam ]]; then
if ! command -v opam &> /dev/null; then
echo "Opam is not installed, installing."
install_opam
fi
Expand Down

0 comments on commit 77b429c

Please sign in to comment.