Skip to content

Commit

Permalink
Fixed installation scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
janpfeifer committed Nov 26, 2024
1 parent 4de06e6 commit 7df853e
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
12 changes: 11 additions & 1 deletion cmd/install_darwin_amd64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,18 @@ PLATFORM="darwin_amd64"

# Base installation directory:
GOPJRT_INSTALL_DIR="${GOPJRT_INSTALL_DIR:-/usr/local}"
echo "Installing GoPJRT C/C++ dependencies under ${GOPJRT_INSTALL_DIR} (lib/ and include/ sub-directories)"
echo " - Set GOPJRT_INSTALL_DIR if you want another directory."

# Should it use 'sudo' while installing ?
_SUDO="sudo"
if [[ "${GOPJRT_NOSUDO}" != "" ]] ; then
echo " - Not using sudo during installation, disabled with GOPJRT_NOSUDO != ''."
_SUDO=""
elif command -v sudo ; then
echo " - Using sudo when extracting files to final destination (Set GOPJRT_NOSUDO=1 if you don't want sudo to be used)"
else
echo " - Not using sudo during installation, no program 'sudo' found in PATH."
_SUDO=""
fi

Expand All @@ -48,7 +58,7 @@ if [[ "${_SUDO}" != "" ]] ; then
echo "Checking sudo authorization for installation"
${_SUDO} printf "\tsudo authorized\n"
fi
sudo tar xvzf "${tar_file}"
${_SUDO} tar xvzf "${tar_file}"
rm -f "${tar_file}"

popd
Expand Down
12 changes: 11 additions & 1 deletion cmd/install_darwin_arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,18 @@ PLATFORM="darwin_arm64"

# Base installation directory:
GOPJRT_INSTALL_DIR="${GOPJRT_INSTALL_DIR:-/usr/local}"
echo "Installing GoPJRT C/C++ dependencies under ${GOPJRT_INSTALL_DIR} (lib/ and include/ sub-directories)"
echo " - Set GOPJRT_INSTALL_DIR if you want another directory."

# Should it use 'sudo' while installing ?
_SUDO="sudo"
if [[ "${GOPJRT_NOSUDO}" != "" ]] ; then
echo " - Not using sudo during installation, disabled with GOPJRT_NOSUDO != ''."
_SUDO=""
elif command -v sudo ; then
echo " - Using sudo when extracting files to final destination (Set GOPJRT_NOSUDO=1 if you don't want sudo to be used)"
else
echo " - Not using sudo during installation, no program 'sudo' found in PATH."
_SUDO=""
fi

Expand All @@ -53,7 +63,7 @@ if [[ "${_SUDO}" != "" ]] ; then
echo "Checking sudo authorization for installation"
${_SUDO} printf "\tsudo authorized\n"
fi
sudo tar xvzf "${tar_file}"
${_SUDO} tar xvzf "${tar_file}"
rm -f "${tar_file}"

popd
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Next

* Fixed installation scripts: s/sudo/$_SUDO. Also made them more verbose.

# v0.4.9 - 2024-11-25

* Optional preloading CPU PJRT plugin:
Expand Down

0 comments on commit 7df853e

Please sign in to comment.