diff --git a/install.sh b/install.sh index 8b88d5f..1ab5187 100755 --- a/install.sh +++ b/install.sh @@ -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 @@ -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"