-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·40 lines (33 loc) · 1.05 KB
/
install.sh
File metadata and controls
executable file
·40 lines (33 loc) · 1.05 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
#!/usr/bin/env bash
set -e
scriptDir=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
p=$(pwd)/$1
exec_path=$p/launch.sh
sym_link_path=/usr/local/bin/vscode-$1
arch_path=$scriptDir/code-stable.tar.gz
if [ -f "$arch_path" ]; then
echo ""
else
echo "# fetch archive"
wget https://update.code.visualstudio.com/latest/linux-x64/stable -O "$arch_path"
fi
echo "# extract files and create directory"
echo "$exec_path"
tar -xf "$arch_path" VSCode-linux-x64
mv VSCode-linux-x64 ./"$1"
echo "
#!/bin/sh
$p/bin/code \"\$@\"
" >"$exec_path"
chmod +x "$exec_path"
sudo ln -s "$exec_path" "$sym_link_path"
if [ "$2" = "--update" ]; then
echo '# copy old user data from tmp'
mv /tmp/code-update-data-"$1" "$p/data"
else
echo '# install extension and config'
mkdir -p ./"$1"/data
"$scriptDir"/install-extensions.sh "$1"
mkdir -p "$p"/data/user-data/User/
curl https://gist.githubusercontent.com/iliser/ff944aeb2fcb868fd274e70c3b57bb62/raw/dff78df391b47f04aaf08427b52dd4880546b875/vscode_settings.json -o "$p"/data/user-data/User/settings.json
fi