-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathserver-env-setup
25 lines (20 loc) · 1.29 KB
/
server-env-setup
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
# This shell script is run before checking for vscode version updates.
# If a newer version is downloaded, this script won't patch that version,
# resulting in error. Therefore retry is required to patch it.
echo "== '~/.vscode-server/server-env-setup' SCRIPT START =="
# Make sure that basic commands are available
PATH=$PATH:/run/current-system/sw/bin/
# Get directory where this shell script is located
VSCODE_SERVER_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
echo "Got vscode directory : $VSCODE_SERVER_DIR"
echo "If the directory is incorrect, you can hardcode it on the script."
echo "Patching nodejs binaries..."
nix-shell -p patchelf binutils --run "
for versiondir in $VSCODE_SERVER_DIR/bin/*/; do
echo \"Patching \"\"\$versiondir\"\"node\"
# Currently only "libstdc++.so.6" needs to be patched
patchelf --set-interpreter \"\$(cat \$NIX_CC/nix-support/dynamic-linker)\" --set-rpath \"\$(nix eval --raw nixpkgs.stdenv.cc.cc.lib)/lib/\" \"\$versiondir\"\"node_modules/node-pty/build/Release/spawn-helper\"
patchelf --set-interpreter \"\$(cat \$NIX_CC/nix-support/dynamic-linker)\" --set-rpath \"\$(nix eval --raw nixpkgs.stdenv.cc.cc.lib)/lib/\" \"\$versiondir\"\"node\"
done
"
echo "== '~/.vscode-server/server-env-setup' SCRIPT END =="