-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall_code.sh
executable file
·76 lines (67 loc) · 2.43 KB
/
install_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
71
72
73
74
75
76
#!/bin/bash
#wget -qO - https://gitlab.com/paulcarroty/vscodium-deb-rpm-repo/raw/master/pub.gpg | gpg --dearmor | sudo tee /usr/share/keyrings/vscodium-archive-keyring.gpg | sha256sum
#echo 'deb [ signed-by=/usr/share/keyrings/vscodium-archive-keyring.gpg ] https://download.vscodium.com/debs vscodium main' | sudo tee /etc/apt/sources.list.d/vscodium.list
#sudo apt-get update
#sudo apt-get install -y codium
user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36"
script_dir=$(readlink -f $(dirname "$0"))
cd ~/Downloads
$script_dir/download-vsx.sh xaver/clang-format
$script_dir/download-vsx.sh ms-python/python
$script_dir/download-vsx.sh James-Yu/latex-workshop
$script_dir/download-vsx.sh webfreak/debug
if which code; then
exit
fi
if which codium; then
exit
fi
rm vscode.deb
if file /usr/bin/ls| grep -q "armhf"; then
curl -H "User-Agent: ${user_agent}" -L -C - https://update.code.visualstudio.com/latest/linux-deb-armhf/stable -o vscode.deb
elif file /usr/bin/ls| grep -q "x86-64"; then
curl -H "User-Agent: ${user_agent}" -L -C - https://update.code.visualstudio.com/latest/linux-deb-x64/stable -o vscode.deb
else
curl -H "User-Agent: ${user_agent}" -L -C - https://update.code.visualstudio.com/latest/linux-deb-arm64/stable -o vscode.deb
fi
if curl https://code.visualstudio.com/sha|grep -q $(sha256sum vscode.deb |sed "s/ .*//"); then
sudo apt install ./vscode.deb
else
echo hash mismatch
fi
mkdir -p ~/.config/Code/User
tee ~/.config/Code/User/settings.json <<EOF
{
"extensions.autoCheckUpdates": false,
"extensions.autoUpdate": false,
"update.showReleaseNotes": false,
"update.mode": "none",
"telemetry.telemetryLevel": "off"
}
EOF
sudo tee /etc/apparmor.d/vscode-yongb <<EOF
# vim:syntax=apparmor
#include <tunables/global>
/usr/share/code/code {
#include <abstractions/base>
network inet dgram,
owner /** rwm,
/usr/share/code/** rmix,
/proc/sys/fs/inotify/** r,
/proc/ r,
/sys/devices/system/cpu/** r,
/etc/fonts/** r,
/usr/share/** r,
/usr/local/share/fonts/** r,
ptrace,
signal,
unix,
capability sys_admin,
capability sys_chroot,
@{PROC}/[0-9]*/ r, # sandbox wants these
@{PROC}/[0-9]*/fd/ r, # sandbox wants these
@{PROC}/[0-9]*/statm r, # sandbox wants these
@{PROC}/[0-9]*/task/[0-9]*/stat r, # sandbox wants these
}
EOF
sudo apparmor_parser -r /etc/apparmor.d/vscode-yongb