generated from devcontainers/feature-starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall.sh
64 lines (46 loc) · 1.53 KB
/
install.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
#!/usr/bin/env bash
set -e
CODE_SERVER_INSTALL_ARGS=""
if [[ -n $VERSION ]]; then
CODE_SERVER_INSTALL_ARGS="$CODE_SERVER_INSTALL_ARGS --version=\"$VERSION\""
fi
curl -fsSL https://code-server.dev/install.sh | sh -s -- $CODE_SERVER_INSTALL_ARGS
IFS=',' read -ra extensions <<<"$EXTENSIONS"
declare -p extensions
for extension in "${extensions[@]}"
do
code-server --install-extension "$extension"
done
CODE_SERVER_WORKSPACE="$_REMOTE_USER_HOME"
if [[ -n $WORKSPACE ]]; then
CODE_SERVER_WORKSPACE="$WORKSPACE"
fi
DISABLE_FLAGS=""
if [[ "$DISABLEFILEDOWNLOADS" == "true" ]]; then
DISABLE_FLAGS="$DISABLE_FLAGS --disable-file-downloads"
fi
if [[ "$DISABLEFILEUPLOADS" == "true" ]]; then
DISABLE_FLAGS="$DISABLE_FLAGS --disable-file-uploads"
fi
if [[ "$DISABLEGETTINGSTARTEDOVERRIDE" == "true" ]]; then
DISABLE_FLAGS="$DISABLE_FLAGS --disable-getting-started-override"
fi
if [[ "$DISABLEPROXY" == "true" ]]; then
DISABLE_FLAGS="$DISABLE_FLAGS --disable-proxy"
fi
if [[ "$DISABLETELEMETRY" == "true" ]]; then
DISABLE_FLAGS="$DISABLE_FLAGS --disable-telemetry"
fi
if [[ "$DISABLEUPDATECHECK" == "true" ]]; then
DISABLE_FLAGS="$DISABLE_FLAGS --disable-update-check"
fi
if [[ "$DISABLEWORKSPACETRUST" == "true" ]]; then
DISABLE_FLAGS="$DISABLE_FLAGS --disable-workspace-trust"
fi
cat > /usr/local/bin/code-server-entrypoint \
<< EOF
#!/usr/bin/env bash
set -e
su $_REMOTE_USER -c 'code-server --auth "$AUTH" --bind-addr "$HOST:$PORT" $DISABLE_FLAGS "$CODE_SERVER_WORKSPACE"'
EOF
chmod +x /usr/local/bin/code-server-entrypoint