-
Notifications
You must be signed in to change notification settings - Fork 3
/
prepare-docker.sh
64 lines (49 loc) · 1.71 KB
/
prepare-docker.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
HCDIR=$(dirname $(readlink -f "$0"))
# https://www.centos.org/centos-linux-eol/
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
dnf update --assumeyes
pkgs="autoconf \
bison \
flex \
gcc \
gcc-c++ \
libstdc++ \
libstdc++-static \
glibc-static \
git \
libtool \
make \
pkg-config \
protobuf-devel \
protobuf-compiler \
git \
wget \
java-1.8.0-openjdk \
java-1.8.0-openjdk-devel \
python3 \
libnl3-devel"
dnf install --enablerepo=PowerTools --assumeyes $pkgs || dnf install --enablerepo=powertools --assumeyes $pkgs
dnf module --assumeyes install nodejs:14
curl https://sh.rustup.rs -sSf | sh -s -- --profile default -y && source ~/.cargo/env
source /etc/profile
npm install -g npm
git clone -b v0.4.0 --depth=1 --single-branch https://github.com/ThinkSpiritLab/ojcmp.git ~/ojcmp &&
cd ~/ojcmp && cargo build --release && cp target/release/ojcmp /usr/bin && cd ~
git clone --depth=1 --single-branch https://github.com/google/nsjail.git ~/nsjail &&
cd ~/nsjail && make && cp ~/nsjail/nsjail /usr/bin/nsjail && cd ~
git clone --depth=1 --single-branch https://github.com/ThinkSpiritLab/Heng-Core.git ~/Heng-Core &&
cd ~/Heng-Core && make && cp ~/Heng-Core/hc /usr/bin/hc && cd ~
cp -r ~/.rustup/toolchains/$(ls ~/.rustup/toolchains/ | grep "stable") /usr/local/rustup && ln -s /usr/local/rustup/bin/rustc /usr/bin/rustc
cp $HCDIR/Tools/testlib.h /testlib.h
cd $HCDIR && npm install && npm run build && cd ~
dnf clean all
rm -rf /var/cache/yum
rm -rf /var/cache/dnf
rm -rf ~/ojcmp
rm -rf ~/nsjail
rm -rf ~/Heng-Core
rm -rf ~/.cargo
rm -rf ~/.rustup/
rm -rf /usr/local/rustup/share/doc
npm cache clean --force