From d7356c04529b497e356caba4d9ee34e3548d4ed6 Mon Sep 17 00:00:00 2001 From: Winford Date: Fri, 3 Nov 2023 22:34:53 -0700 Subject: [PATCH] Fix some small bugs in install.sh 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 --- install.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/install.sh b/install.sh index a38e033..188bb1c 100755 --- a/install.sh +++ b/install.sh @@ -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 " echo " where is the prefix location for the install" @@ -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