-
Notifications
You must be signed in to change notification settings - Fork 72
/
code.sh
executable file
·70 lines (60 loc) · 1.71 KB
/
code.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
set -e
shopt -s nullglob
FIRST_RUN="${XDG_CONFIG_HOME}/flatpak-vscode-first-run"
function msg() {
echo "flatpak-vscode: $*" >&2
}
if [ ! -f ${FIRST_RUN} ]; then
WARNING_FILE="/app/share/vscode/flatpak-warning.txt"
touch ${FIRST_RUN}
fi
PYTHON_SITEDIR=$(python3 <<EOFPYTHON
import os
import site
print(os.path.relpath(site.getusersitepackages(), site.getuserbase()))
EOFPYTHON
)
for tool_dir in /app/tools/*; do
tool_bindir=$tool_dir/bin
if [ -d "$tool_bindir" ]; then
msg "Adding $tool_bindir to PATH"
export PATH=$PATH:$tool_bindir
fi
tool_pythondir=$tool_dir/$PYTHON_SITEDIR
if [ -d "$tool_pythondir" ]; then
msg "Adding $tool_pythondir to PYTHONPATH"
if [ -z "$PYTHONPATH" ]; then
export PYTHONPATH=$tool_pythondir
else
export PYTHONPATH=$PYTHONPATH:$tool_pythondir
fi
fi
done
if [ "$FLATPAK_ENABLE_SDK_EXT" = "*" ]; then
SDK=()
for d in /usr/lib/sdk/*; do
SDK+=("${d##*/}")
done
else
IFS=',' read -ra SDK <<< "$FLATPAK_ENABLE_SDK_EXT"
fi
for i in "${SDK[@]}"; do
if [[ -d /usr/lib/sdk/$i ]]; then
msg "Enabling SDK extension \"$i\""
if [[ -f /usr/lib/sdk/$i/enable.sh ]]; then
. /usr/lib/sdk/$i/enable.sh
else
export PATH=$PATH:/usr/lib/sdk/$i/bin
fi
else
msg "Requested SDK extension \"$i\" is not installed"
fi
done
if [ ! -e /etc/shells ] && [ -e /var/run/host/etc/shells ]; then
ln -s /var/run/host/etc/shells /etc/shells
fi
exec env ELECTRON_RUN_AS_NODE=1 PATH="${PATH}:${XDG_DATA_HOME}/node_modules/bin" \
/app/bin/zypak-wrapper.sh /app/extra/vscode/code /app/extra/vscode/resources/app/out/cli.js \
--ms-enable-electron-run-as-node --extensions-dir=${XDG_DATA_HOME}/vscode/extensions \
"$@" ${WARNING_FILE}