Spaces:
Sleeping
Sleeping
alpine edge
Browse files- Dockerfile +2 -2
- pixi_install.sh +128 -0
- pup +1 -0
Dockerfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
FROM alpine:
|
2 |
|
3 |
-
RUN apk add --no-cache bash curl
|
4 |
|
5 |
WORKDIR /code
|
6 |
|
|
|
1 |
+
FROM alpine:edge
|
2 |
|
3 |
+
RUN apk add --no-cache bash curl pixi
|
4 |
|
5 |
WORKDIR /code
|
6 |
|
pixi_install.sh
ADDED
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#!/usr/bin/env bash
|
2 |
+
set -euo pipefail
|
3 |
+
|
4 |
+
__wrap__() {
|
5 |
+
|
6 |
+
VERSION=${PIXI_VERSION:-latest}
|
7 |
+
PIXI_HOME=${PIXI_HOME:-"$HOME/.pixi"}
|
8 |
+
BIN_DIR="$PIXI_HOME/bin"
|
9 |
+
|
10 |
+
REPO=prefix-dev/pixi
|
11 |
+
PLATFORM=$(uname -s)
|
12 |
+
ARCH=$(uname -m)
|
13 |
+
|
14 |
+
if [[ $PLATFORM == "Darwin" ]]; then
|
15 |
+
PLATFORM="apple-darwin"
|
16 |
+
elif [[ $PLATFORM == "Linux" ]]; then
|
17 |
+
PLATFORM="unknown-linux-musl"
|
18 |
+
fi
|
19 |
+
|
20 |
+
if [[ $ARCH == "arm64" ]] || [[ $ARCH == "aarch64" ]]; then
|
21 |
+
ARCH="aarch64"
|
22 |
+
fi
|
23 |
+
|
24 |
+
|
25 |
+
|
26 |
+
BINARY="pixi-${ARCH}-${PLATFORM}"
|
27 |
+
|
28 |
+
if [[ $VERSION == "latest" ]]; then
|
29 |
+
DOWNLOAD_URL=https://github.com/${REPO}/releases/latest/download/${BINARY}.tar.gz
|
30 |
+
else
|
31 |
+
DOWNLOAD_URL=https://github.com/${REPO}/releases/download/${VERSION}/${BINARY}.tar.gz
|
32 |
+
fi
|
33 |
+
|
34 |
+
printf "This script will automatically download and install Pixi (${VERSION}) for you.\nGetting it from this url: $DOWNLOAD_URL\nThe binary will be installed into '$BIN_DIR'\n"
|
35 |
+
|
36 |
+
if ! hash curl 2> /dev/null && ! hash wget 2> /dev/null; then
|
37 |
+
echo "error: you need either 'curl' or 'wget' installed for this script."
|
38 |
+
exit 1
|
39 |
+
fi
|
40 |
+
|
41 |
+
if ! hash tar 2> /dev/null; then
|
42 |
+
echo "error: you do not have 'tar' installed which is required for this script."
|
43 |
+
exit 1
|
44 |
+
fi
|
45 |
+
|
46 |
+
TEMP_FILE=$(mktemp "${TMPDIR:-/tmp}/.pixi_install.XXXXXXXX")
|
47 |
+
|
48 |
+
cleanup() {
|
49 |
+
rm -f "$TEMP_FILE"
|
50 |
+
}
|
51 |
+
|
52 |
+
trap cleanup EXIT
|
53 |
+
|
54 |
+
if hash curl 2> /dev/null; then
|
55 |
+
HTTP_CODE=$(curl -SL --progress-bar "$DOWNLOAD_URL" --output "$TEMP_FILE" --write-out "%{http_code}")
|
56 |
+
if [[ ${HTTP_CODE} -lt 200 || ${HTTP_CODE} -gt 299 ]]; then
|
57 |
+
echo "error: '${DOWNLOAD_URL}' is not available"
|
58 |
+
exit 1
|
59 |
+
fi
|
60 |
+
elif hash wget 2> /dev/null; then
|
61 |
+
if ! wget -q --show-progress --output-document="$TEMP_FILE" "$DOWNLOAD_URL"; then
|
62 |
+
echo "error: '${DOWNLOAD_URL}' is not available"
|
63 |
+
exit 1
|
64 |
+
fi
|
65 |
+
fi
|
66 |
+
|
67 |
+
# Check that file was correctly created (https://github.com/prefix-dev/pixi/issues/446)
|
68 |
+
if [[ ! -s $TEMP_FILE ]]; then
|
69 |
+
echo "error: temporary file ${TEMP_FILE} not correctly created."
|
70 |
+
echo " As a workaround, you can try set TMPDIR env variable to directory with write permissions."
|
71 |
+
exit 1
|
72 |
+
fi
|
73 |
+
|
74 |
+
# Extract pixi from the downloaded tar file
|
75 |
+
mkdir -p "$BIN_DIR"
|
76 |
+
tar -xzf "$TEMP_FILE" -C "$BIN_DIR"
|
77 |
+
|
78 |
+
update_shell() {
|
79 |
+
FILE=$1
|
80 |
+
LINE=$2
|
81 |
+
|
82 |
+
# shell update can be suppressed by `PIXI_NO_PATH_UPDATE` env var
|
83 |
+
[[ ! -z "${PIXI_NO_PATH_UPDATE-}" ]] && echo "No path update because PIXI_NO_PATH_UPDATE has a value" && return
|
84 |
+
|
85 |
+
# Create the file if it doesn't exist
|
86 |
+
if [ -f "$FILE" ]; then
|
87 |
+
touch "$FILE"
|
88 |
+
fi
|
89 |
+
|
90 |
+
# Append the line if not already present
|
91 |
+
if ! grep -Fxq "$LINE" "$FILE"
|
92 |
+
then
|
93 |
+
echo "Updating '${FILE}'"
|
94 |
+
echo "$LINE" >> "$FILE"
|
95 |
+
fi
|
96 |
+
}
|
97 |
+
case "$(basename "$SHELL")" in
|
98 |
+
bash)
|
99 |
+
if [ -f ~/.bash_profile ]; then
|
100 |
+
BASH_FILE=~/.bash_profile
|
101 |
+
else
|
102 |
+
# Default to bashrc as that is used in non login shells instead of the profile.
|
103 |
+
BASH_FILE=~/.bashrc
|
104 |
+
fi
|
105 |
+
LINE="export PATH=\$PATH:${BIN_DIR}"
|
106 |
+
update_shell $BASH_FILE "$LINE"
|
107 |
+
;;
|
108 |
+
|
109 |
+
fish)
|
110 |
+
LINE="fish_add_path ${BIN_DIR}"
|
111 |
+
update_shell ~/.config/fish/config.fish "$LINE"
|
112 |
+
;;
|
113 |
+
|
114 |
+
zsh)
|
115 |
+
LINE="export PATH=\$PATH:${BIN_DIR}"
|
116 |
+
update_shell ~/.zshrc "$LINE"
|
117 |
+
;;
|
118 |
+
|
119 |
+
*)
|
120 |
+
echo "Unsupported shell: $(basename "$0")"
|
121 |
+
;;
|
122 |
+
esac
|
123 |
+
|
124 |
+
chmod +x "$BIN_DIR/pixi"
|
125 |
+
|
126 |
+
echo "Please restart or source your shell."
|
127 |
+
|
128 |
+
}; __wrap__
|
pup
CHANGED
@@ -221,6 +221,7 @@ if [ "$1" == "pixi" ]; then
|
|
221 |
curl -fsSL https://pixi.sh/install.sh -o pixi_install.sh
|
222 |
chmod +x ./pixi_install.sh
|
223 |
sh -c ./pixi_install.sh
|
|
|
224 |
fi
|
225 |
PUPHOME=$(pup home)
|
226 |
if [[ ! -f "$PUPHOME"/pixi.toml ]]; then
|
|
|
221 |
curl -fsSL https://pixi.sh/install.sh -o pixi_install.sh
|
222 |
chmod +x ./pixi_install.sh
|
223 |
sh -c ./pixi_install.sh
|
224 |
+
ls -l
|
225 |
fi
|
226 |
PUPHOME=$(pup home)
|
227 |
if [[ ! -f "$PUPHOME"/pixi.toml ]]; then
|