forked from prefix-dev/pixi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·46 lines (40 loc) · 1.89 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·46 lines (40 loc) · 1.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#!/bin/sh
# Install the GR pixi fork (native az:// Azure Blob channel support) as `pixi`.
# curl -fsSL https://github.com/greenroom-robotics/pixi/releases/download/pixi-gr@0.75.2/install.sh | sh
# Override version/dest with PIXI_GR_VERSION / PIXI_GR_BIN_DIR.
set -eu
VERSION="${PIXI_GR_VERSION:-0.75.2}"
DEST="${PIXI_GR_BIN_DIR:-$HOME/.local/bin}"
case "$(uname -m)" in
x86_64 | amd64) arch=linux-64 ;;
aarch64 | arm64) arch=linux-aarch64 ;;
*) echo "pixi-gr: unsupported architecture $(uname -m)" >&2; exit 1 ;;
esac
# Note any pixi already on PATH before we install — the GR build is meant to
# replace it, so a different one left ahead of $DEST would silently win.
existing="$(command -v pixi || true)"
url="https://github.com/greenroom-robotics/pixi/releases/download/pixi-gr@${VERSION}/pixi-${arch}.gz"
mkdir -p "$DEST"
echo "pixi-gr ${VERSION} (${arch}) -> ${DEST}/pixi"
curl -fsSL "$url" | gunzip > "$DEST/pixi"
chmod +x "$DEST/pixi"
if [ -n "$existing" ] && [ "$existing" != "$DEST/pixi" ]; then
echo "warning: another pixi is on PATH at $existing" >&2
echo " remove it (or put $DEST first) so this GR build is the one that runs." >&2
fi
# $DEST holds the `pixi` binary; $PIXI_HOME/bin holds the trampolines that
# `pixi global install` writes, so both have to be on PATH.
for dir in "$DEST" "${PIXI_HOME:-$HOME/.pixi}/bin"; do
case ":$PATH:" in *":$dir:"*) continue ;; esac
shell="${SHELL:-}"
case "${shell##*/}" in
bash) rc="$HOME/.bashrc"; line="export PATH=\"$dir:\$PATH\"" ;;
zsh) rc="$HOME/.zshrc"; line="export PATH=\"$dir:\$PATH\"" ;;
fish) rc="$HOME/.config/fish/config.fish"; line="set -gx PATH \"$dir\" \$PATH" ;;
*) echo "note: add $dir to your PATH" >&2; continue ;;
esac
grep -Fxq "$line" "$rc" 2>/dev/null && continue
mkdir -p "$(dirname "$rc")"
printf '\n%s\n' "$line" >>"$rc"
echo "added $dir to PATH in $rc — restart or source your shell"
done