Skip to content

Commit

Permalink
Fix some small bugs in install.sh
Browse files Browse the repository at this point in the history
The `install.sh` script contains "bashisms" that don't work with POSIX `sh`, or
`bash` in `sh` mode. The location of `bash` on FreeBSD is different than most
Linux distributions so the use of `/usr/bin/env` to find the installed bash is a
safe cross-platform way of launching this script as described in the `README`.

Modified the pre-installation check to test if the currently installed version
is the same rather than just for the presence of the `atomvm_packbeam`
directory so that upgrading to other versions will be possible with future
releases.

Signed-off-by: Winford <[email protected]>
  • Loading branch information
UncleGrumpy committed Nov 4, 2023
1 parent a7b64ea commit eeab71f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
#!/usr/bin/env bash
#
# This file is part of AtomVM.
#
Expand Down Expand Up @@ -84,8 +84,8 @@ echo_run cp "${src_tar}" "${tmp_dir}/."
echo_run gunzip "${tmp_dir}/atomvm_packbeam-${version}.tar.gz"

readonly dest_dir="${prefix}/atomvm_packbeam"
if [ -e "${dest_dir}" ]; then
echo "ERROR! It looks like ${dest_dir} already exists!"
if [ $(${dest_dir}/bin/packbeam version) = ${version} ]; then
echo "ERROR! It looks like ${version} is already installed!"
exit 1
fi

Expand Down

0 comments on commit eeab71f

Please sign in to comment.