-
Notifications
You must be signed in to change notification settings - Fork 7
/
postBuild
90 lines (67 loc) · 2.16 KB
/
postBuild
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
#!/bin/bash -v
# determine which version of Quarto to install
QUARTO_VERSION=1.4.551
# See whether we need to lookup a Quarto version
if [ $QUARTO_VERSION = "prerelease" ]; then
QUARTO_JSON="_prerelease.json"
elif [ $QUARTO_VERSION = "release" ]; then
QUARTO_JSON="_download.json"
fi
if [ $QUARTO_JSON != "" ]; then
# create a python script and run it
PYTHON_SCRIPT=_quarto_version.py
if [ -e $PYTHON_SCRIPT ]; then
rm -rf $PYTHON_SCRIPT
fi
cat > $PYTHON_SCRIPT <<EOF
import urllib, json
import urllib.request, json
with urllib.request.urlopen("https://quarto.org/docs/download/${QUARTO_JSON}") as url:
data = json.load(url)
print(data['version'])
EOF
QUARTO_VERSION=$(python $PYTHON_SCRIPT)
rm -rf $PYTHON_SCRIPT
fi
echo
echo Installing Quarto $QUARTO_VERSION
echo
# download and install the deb file
curl -LO https://github.com/quarto-dev/quarto-cli/releases/download/v$QUARTO_VERSION/quarto-$QUARTO_VERSION-linux-amd64.deb
dpkg -x quarto-$QUARTO_VERSION-linux-amd64.deb .quarto
rm -rf quarto-$QUARTO_VERSION-linux-amd64.deb
# get quarto in the path
mkdir -p ~/.local/bin
ln -s ~/.quarto/opt/quarto/bin/quarto ~/.local/bin/quarto
# create the proper pandoc symlink to enable visual editor in Quarto extension
ln -s ~/.quarto/opt/quarto/bin/tools/x86_64/pandoc ~/.quarto/opt/quarto/bin/tools/pandoc
echo
echo Installed Quarto
echo
echo
echo Configuring VSCode
echo
# download and install VS Code server
CODE_VERSION=4.16.1
# download and extract
wget -q -O code-server.tar.gz https://github.com/coder/code-server/releases/download/v$CODE_VERSION/code-server-$CODE_VERSION-linux-amd64.tar.gz
tar xzf code-server.tar.gz
rm -rf code-server.tar.gz
# place in hidden folder
mv "code-server-$CODE_VERSION-linux-amd64" .code-server
# get code-server in path
mkdir -p ./.local/bin
ln -s ~/.code-server/bin/code-server ~/.local/bin/code-server
# install vscode extensions
code-server --install-extension ms-python.python
code-server --install-extension sumneko.lua
code-server --install-extension quarto.quarto
echo
echo Configured VSCode
echo
# install required python packages
python3 -m pip install jupyter-server-proxy
python3 -m pip install jupyterlab-quarto==0.1.45
echo
echo Completed
echo