-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall
More file actions
executable file
·46 lines (40 loc) · 1.88 KB
/
Copy pathinstall
File metadata and controls
executable file
·46 lines (40 loc) · 1.88 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 -e
{ cd "$(cd -- "$(dirname -- "$0")" && pwd)"
chk_py_ver() {
command -v "$1" >/dev/null 2>&1 && {
version_check=$("$1" -c 'import sys; print(sys.version_info >= (3, 12))' 2>/dev/null)
[ "$version_check" = "True" ] && {
PYTHON=$(command -v "$1")
echo "Using $1 at \"$PYTHON\""; } } }
chk_py_pip() { "$PYTHON" -c "import pip" 2>/dev/null; }
[ -z "$PYTHON" ] && chk_py_ver "python3.15" || :
[ -z "$PYTHON" ] && chk_py_ver "python3.14" || :
[ -z "$PYTHON" ] && chk_py_ver "python3.13" || :
[ -z "$PYTHON" ] && chk_py_ver "python3.12" || :
[ -z "$PYTHON" ] && chk_py_ver "python3" || :
[ -z "$PYTHON" ] && chk_py_ver "python" || :
[ -z "$PYTHON" ] && { echo "Unable to find a valid python install!"
exit 1; }
chk_py_pip || { echo "pip is not installed. Running ensurepip."
"$PYTHON" -m ensurepip || echo "Failed to run ensurepip ⎺⟍_⟨⍩⟩_⟋⎺"; }
chk_py_pip && "$PYTHON" -m pip install --break-system-packages -U psutil pycryptodome cffi regex clipboard \
|| echo "Failed to run pip ⎺⟍_⟨⍩⟩_⟋⎺"
chk_py_pip && "$PYTHON" -m pip install --break-system-packages -U ./Extra/Misc/jsbeautifier-2.0.1 \
|| echo "Failed to install jsbeautifier :<"
DEST=$([ "$(id -u)" -eq 0 ] && echo "/bin/☾" || (\
[ "$(uname)" = "Darwin" ] && echo "/usr/local/bin/☾" || (\
echo "$HOME/.local/bin/☾" )))
echo "Installing script to \"$DEST\""
rm -f "$DEST" 2>/dev/null
printf '%s' "\
#!/bin/sh
PY=\"$PYTHON\"
MOON=\"$(realpath moon.py)\""'
PY="${MOON_PYTHON_BIN:-$PY}"
[ "$1" = "--py" ] && { shift; exec "$PY" "$@"; }
ulimit -s unlimited
exec "$PY" -Su "$MOON" "$@"' > "$DEST"
chmod a+x "$DEST"
echo "Preloading cache…"
"$DEST" -c '13ᐸ␛!ᐸ‹Welcome to ☾! ›3𝗻'
exit $?; }