Skip to content

Commit

Permalink
fix: share directory in install script for macos
Browse files Browse the repository at this point in the history
  • Loading branch information
zshipko committed Oct 10, 2024
1 parent b977db1 commit c98ecfd
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,15 @@ fi

echo "Installing extism-py release with tag: $LATEST_TAG"

USER_DATA_DIR=''
OS=''
case `uname` in
Darwin*) OS="macos" ;;
Linux*) OS="linux" ;;
Darwin*)
OS="macos"
USER_DATA_DIR="$HOME/Library/Application Support" ;;
Linux*)
OS="linux"
USER_DATA_DIR="$HOME/.local/share" ;;
*) echo "unknown os: $OSTYPE" && exit 1 ;;
esac

Expand Down Expand Up @@ -122,15 +127,15 @@ if curl -fsSL --output /tmp/extism-py.tar.gz "$DOWNLOAD_URL"; then

if [ "$USE_SUDO" = "1" ]; then
echo "No user-writable bin directory found in PATH. Using sudo to install in $INSTALL_DIR"
sudo mkdir -p /usr/local/share
sudo rm -rf /usr/local/share/extism-py
sudo rm -rf /usr/share/extism-py
sudo mkdir -p /usr/share
sudo mv /tmp/extism-py/bin/extism-py "$TARGET"
sudo mv /tmp/extism-py/share/extism-py /usr/local/share
sudo mv /tmp/extism-py/share/extism-py /usr/share/extism-py
else
mkdir -p ~/.local/share
rm -rf ~/.local/share/extism-py
rm -rf "$USER_DATA_DIR/extism-py"
mkdir -p "$USER_DATA_DIR"
mv /tmp/extism-py/bin/extism-py "$TARGET"
mv /tmp/extism-py/share/extism-py ~/.local/share
mv /tmp/extism-py/share/extism-py "$USER_DATA_DIR/extism-py"
fi
chmod +x "$TARGET"

Expand Down

0 comments on commit c98ecfd

Please sign in to comment.