-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.sh
executable file
·37 lines (32 loc) · 989 Bytes
/
bootstrap.sh
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
#!/usr/bin/env bash
_() {
set -eu
PLATFORM="$(echo "$(uname -m)-$(uname -s)")"
TMP_TAR="/tmp/runix-bootstrap.tgz"
TMP_DEST="/tmp/runix-bootstrap"
FILENAME="runix-$PLATFORM.tgz"
if [ -n "${LOCAL_BOOTSTRAP:-}" ]; then
echo >&2 "[runix-bootstrap] Using local bootstrap archive: $LOCAL_BOOTSTRAP/$FILENAME"
cp "$LOCAL_BOOTSTRAP/$FILENAME" "$TMP_TAR"
else
echo >&2 "[runix-bootstrap] Downloading ${FILENAME} ..."
curl -o "$TMP_TAR" -sSL "https://github.com/timbertson/runix/releases/download/bootstrap/$FILENAME"
fi
function cleanup {
if [ -e "$TMP_DEST" ]; then
chmod -R +w "$TMP_DEST"
rm -rf "$TMP_DEST"
fi
}
cleanup
echo >&2 "[runix-bootstrap] extracting to ${TMP_DEST} ..."
mkdir -p "$TMP_DEST"
tar xzf "$TMP_TAR" -C "$TMP_DEST"
rm -f "$TMP_TAR"
ln -sfn "$TMP_DEST/store" /tmp/runix
echo >&2 "[runix-bootstrap] Running self-install ..."
"$TMP_DEST/runix" --self-install "$TMP_DEST/wrapper"
echo >&2 "[runix-bootstrap] Cleaning up ..."
cleanup
}
_