Skip to content

Commit

Permalink
Fix some small bugs in install.sh
Browse files Browse the repository at this point in the history
Fixes bashism in the `args` test in `install.sh` that won't work with POSIX `sh`,
or `bash` in `sh` mode.

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 <winford@object.stream>
  • Loading branch information
UncleGrumpy committed Nov 4, 2023
1 parent a7b64ea commit d7356c0
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
Expand Up @@ -48,7 +48,7 @@ set -e
readonly root_dir="$(cd $(dirname $0) && pwd)"

readonly nargs=$#
if [[ ${nargs} -lt 2 ]]; then
if [ ${nargs} -lt 2 ]; then
echo
echo "Syntax: $0 <prefix> <version>"
echo " where <prefix> is the prefix location for the install"
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 d7356c0

Please sign in to comment.