Skip to content

Commit 47ebc73

Browse files
committed
refactor(provision): split provision commands to multiple files
1 parent 465337b commit 47ebc73

File tree

5 files changed

+107
-49
lines changed

5 files changed

+107
-49
lines changed

Vagrantfile

Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -89,57 +89,15 @@ Vagrant.configure(2) do |config|
8989
# documentation for more information about their specific syntax and use.
9090
config.vm.provision "shell", privileged: false, inline: <<-SHELL
9191
set -o errexit
92+
set -x
93+
9294
sudo apt-get update
95+
sudo apt-get upgrade -y
9396
94-
# Install python
95-
sudo apt-get install python -y
96-
97-
# Install Pandoc
98-
# PANDOC_VERSION=1.19.2.1
99-
curl -LR -O -s https://github.com/jgm/pandoc/releases/download/1.19.2.1/pandoc-1.19.2.1-1-amd64.deb
100-
sudo dpkg --install pandoc-1.19.2.1-1-amd64.deb
101-
git clone https://github.com/jgm/pandocfilters
102-
cd pandocfilters
103-
sudo python setup.py install
104-
cd
105-
106-
# Install ZIP
107-
sudo apt-get install zip -y
108-
109-
# Install R
110-
sudo apt-get install -y libssl-dev libcurl4-openssl-dev
111-
sudo apt-get install -y r-base r-base-dev
112-
sudo Rscript /vagrant/stats/prepare_r_env.R
113-
#cd /vagrant/stats
114-
#sudo R CMD INSTALL . athex
115-
# RStudio Server
116-
RSTUDIO_VERSION=1.1.383
117-
sudo apt-get install -y gdebi-core
118-
curl -R -O -s https://download2.rstudio.org/rstudio-server-${RSTUDIO_VERSION}-amd64.deb
119-
sudo dpkg --install rstudio-server-${RSTUDIO_VERSION}-amd64.deb
120-
sudo systemctl enable rstudio-server.service
121-
# To login to rstudio-server you need to create a user and add the user to
122-
# rstudio-server group. Make sure the user has a home dir too!
123-
124-
# Install tshark
125-
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y tshark
126-
# Allow current user to access the network interfaces.
127-
sudo groupadd wireshark
128-
sudo usermod -a -G wireshark $(whoami)
129-
sudo setcap cap_net_raw,cap_net_admin=eip $(which dumpcap)
130-
# Clone ws_dissector_helper
131-
git clone https://github.com/prontog/ws_dissector_helper
132-
mkdir ~/.wireshark
133-
ln -s /vagrant/network/init.lua ~/.wireshark/
134-
135-
# Install csvkit
136-
sudo apt-get install -y python-pip
137-
sudo pip install --upgrade pip
138-
sudo pip install --upgrade setuptools
139-
sudo pip install csvkit==0.9.1
140-
141-
# Install TCL
142-
sudo apt-get install tcl -y
97+
/vagrant/provision.sh
98+
/vagrant/provision_pandoc.sh
99+
/vagrant/provision_R.sh
100+
/vagrant/provision_tshark.sh
143101
144102
# Add necessary env vars:
145103
echo Updating .bashrc

provision.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -x
4+
5+
# Install ZIP
6+
sudo apt-get install zip -y
7+
8+
# Install csvkit
9+
sudo apt-get install -y python-pip
10+
sudo pip install --upgrade pip
11+
sudo pip install --upgrade setuptools
12+
sudo pip install csvkit==0.9.2
13+
14+
# Install TCL
15+
sudo apt-get install tcl -y

provision_R.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -x
4+
5+
# Install R
6+
sudo apt-get install -y libssl-dev libcurl4-openssl-dev
7+
sudo apt-get install -y r-base r-base-dev
8+
sudo Rscript /vagrant/stats/prepare_r_env.R
9+
#cd /vagrant/stats
10+
#sudo R CMD INSTALL . athex
11+
# RStudio Server
12+
RSTUDIO_VERSION=1.1.463
13+
sudo apt-get install -y gdebi-core
14+
curl -R -O -s https://download2.rstudio.org/rstudio-server-${RSTUDIO_VERSION}-amd64.deb
15+
sudo dpkg --install rstudio-server-${RSTUDIO_VERSION}-amd64.deb
16+
sudo systemctl enable rstudio-server.service
17+
# To login to rstudio-server you need to create a user and add the user to
18+
# rstudio-server group. Make sure the user has a home dir too!

provision_pandoc.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -x
4+
5+
# Install python
6+
sudo apt-get install python -y
7+
8+
# Install Pandoc
9+
curl -LR -O -s https://github.com/jgm/pandoc/releases/download/2.5/pandoc-2.5-1-amd64.deb
10+
sudo dpkg --install pandoc-2.5-1-amd64.deb
11+
git clone https://github.com/jgm/pandocfilters
12+
cd pandocfilters
13+
sudo python setup.py install
14+
cd

provision_tshark.sh

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
set -o errexit
3+
set -x
4+
5+
NPROC=$(grep processor /proc/cpuinfo | wc -l)
6+
7+
# Wireshark
8+
sudo apt-get install build-essential -y
9+
sudo apt-get install libglib2.0-dev -y
10+
sudo apt-get install libpcap-dev -y
11+
sudo apt-get install libgcrypt20-dev -y
12+
sudo apt-get install libtool -y
13+
# See https://installfights.blogspot.com/2016/10/install-wireshark-23-on-ubuntu-1604.html
14+
sudo ln -s /usr/bin/libtoolize /usr/bin/libtool
15+
sudo apt-get install pkg-config -y
16+
17+
# Lua
18+
# To use the default lua from yum:
19+
#sudo yum install lua-devel -y
20+
# To use the same with the Wireshark releases:
21+
#LUA_VERSION=5.2.4
22+
#sudo yum install readline-devel -y
23+
#curl -R -O -s http://www.lua.org/ftp/lua-${LUA_VERSION}.tar.gz
24+
#tar -xf lua-${LUA_VERSION}.tar.gz
25+
#cd lua-${LUA_VERSION}
26+
#make linux test MYCFLAGS='-fPIC'
27+
#sudo make install
28+
#cd
29+
# To use Lua JIT:
30+
LUA_JIT_VERSION=2.0.5
31+
curl -R -O -s https://luajit.org/download/LuaJIT-${LUA_JIT_VERSION}.tar.gz
32+
tar -xf LuaJIT-${LUA_JIT_VERSION}.tar.gz
33+
cd LuaJIT-${LUA_JIT_VERSION}
34+
make -j $NPROC
35+
sudo make install
36+
cd
37+
WIRESHARK_VERSION=2.6.5
38+
curl -R -O -s https://2.na.dl.wireshark.org/src/all-versions/wireshark-${WIRESHARK_VERSION}.tar.xz
39+
tar -xf wireshark-${WIRESHARK_VERSION}.tar.xz
40+
cd wireshark-${WIRESHARK_VERSION}
41+
# Add luajit to supported lua implementations
42+
sed -i 's/\(lua5.2\)/luajit \1/' acinclude.m4
43+
# See "Embedding LuaJIT" in https://luajit.org/install.html
44+
sed -i 's/lua_newstate([^;]*)/luaL_newstate()/' epan/wslua/init_wslua.c
45+
./autogen.sh
46+
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure --disable-wireshark --disable-androiddump --disable-packet-editor --disable-sshdump --disable-ciscodump --disable-udpdump --without-plugins --without-kerberos --with-lua
47+
make -j $NPROC
48+
sudo make install
49+
50+
# Allow current user to access the network interfaces.
51+
sudo groupadd wireshark
52+
sudo usermod -a -G wireshark $(whoami)
53+
sudo setcap cap_net_raw,cap_net_admin=eip $(which dumpcap)

0 commit comments

Comments
 (0)