Skip to content

Commit f67f806

Browse files
authored
fix centos8 eol (#12)
1 parent e7e589f commit f67f806

6 files changed

+37
-32
lines changed

Diff for: .dockerignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ config.toml
99
*.log
1010
*.out
1111
*.o
12-
src.*
12+
src.*

Diff for: .prettierignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
build
2-
dist
2+
dist

Diff for: Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ FROM centos:8
22
WORKDIR /hc
33
COPY . .
44
RUN bash ./prepare-docker.sh
5-
CMD ["node", "dist/index.js"]
5+
CMD ["node", "dist/index.js"]

Diff for: prepare-centos8.sh

+11-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
if [ $UID -ne 0 ]; then
1+
if [ $UID -ne 0 ]; then
22
echo Please run as root
33
exit
44
fi
55

6-
HCDIR=`dirname $(readlink -f "$0")`
6+
HCDIR=$(dirname $(readlink -f "$0"))
77
export GIT_SSL_NO_VERIFY=true
88

9+
# https://www.centos.org/centos-linux-eol/
910
dnf update --assumeyes
1011

1112
pkgs="autoconf \
@@ -59,22 +60,22 @@ registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
5960
# rustcc 社区
6061
[source.rustcc]
6162
registry = "git://crates.rustcc.cn/crates.io-index"
62-
' > ~/.cargo/config
63+
' >~/.cargo/config
6364
source /etc/profile
6465

6566
npm install -g npm --registry=https://registry.npm.taobao.org
6667
npm i -g cnpm --registry=https://registry.npm.taobao.org && source /etc/profile
6768

68-
git clone -b v0.4.0 --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/ojcmp.git ~/ojcmp \
69-
&& cd ~/ojcmp && cargo build --release && cp target/release/ojcmp /usr/bin
69+
git clone -b v0.4.0 --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/ojcmp.git ~/ojcmp &&
70+
cd ~/ojcmp && cargo build --release && cp target/release/ojcmp /usr/bin
7071

71-
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/google/nsjail.git ~/nsjail \
72-
&& cd ~/nsjail && make && cp ~/nsjail/nsjail /usr/bin/nsjail
72+
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/google/nsjail.git ~/nsjail &&
73+
cd ~/nsjail && make && cp ~/nsjail/nsjail /usr/bin/nsjail
7374

74-
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/Heng-Core.git ~/Heng-Core \
75-
&& cd ~/Heng-Core && make && cp ~/Heng-Core/hc /usr/bin/hc && cd ~
75+
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/Heng-Core.git ~/Heng-Core &&
76+
cd ~/Heng-Core && make && cp ~/Heng-Core/hc /usr/bin/hc && cd ~
7677

77-
cp -r ~/.rustup/toolchains/`ls ~/.rustup/toolchains/ | grep "stable"` /usr/local/rustup && ln -s /usr/local/rustup/bin/rustc /usr/bin/rustc
78+
cp -r ~/.rustup/toolchains/$(ls ~/.rustup/toolchains/ | grep "stable") /usr/local/rustup && ln -s /usr/local/rustup/bin/rustc /usr/bin/rustc
7879

7980
cp $HCDIR/Tools/testlib.h /testlib.h
8081

Diff for: prepare-docker.sh

+12-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
HCDIR=`dirname $(readlink -f "$0")`
1+
HCDIR=$(dirname $(readlink -f "$0"))
2+
3+
# https://www.centos.org/centos-linux-eol/
4+
sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
5+
sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*
26

37
dnf update --assumeyes
48

@@ -33,16 +37,16 @@ source /etc/profile
3337

3438
npm install -g npm
3539

36-
git clone -b v0.4.0 --depth=1 --single-branch https://github.com/ThinkSpiritLab/ojcmp.git ~/ojcmp \
37-
&& cd ~/ojcmp && cargo build --release && cp target/release/ojcmp /usr/bin && cd ~
40+
git clone -b v0.4.0 --depth=1 --single-branch https://github.com/ThinkSpiritLab/ojcmp.git ~/ojcmp &&
41+
cd ~/ojcmp && cargo build --release && cp target/release/ojcmp /usr/bin && cd ~
3842

39-
git clone --depth=1 --single-branch https://github.com/google/nsjail.git ~/nsjail \
40-
&& cd ~/nsjail && make && cp ~/nsjail/nsjail /usr/bin/nsjail && cd ~
43+
git clone --depth=1 --single-branch https://github.com/google/nsjail.git ~/nsjail &&
44+
cd ~/nsjail && make && cp ~/nsjail/nsjail /usr/bin/nsjail && cd ~
4145

42-
git clone --depth=1 --single-branch https://github.com/ThinkSpiritLab/Heng-Core.git ~/Heng-Core \
43-
&& cd ~/Heng-Core && make && cp ~/Heng-Core/hc /usr/bin/hc && cd ~
46+
git clone --depth=1 --single-branch https://github.com/ThinkSpiritLab/Heng-Core.git ~/Heng-Core &&
47+
cd ~/Heng-Core && make && cp ~/Heng-Core/hc /usr/bin/hc && cd ~
4448

45-
cp -r ~/.rustup/toolchains/`ls ~/.rustup/toolchains/ | grep "stable"` /usr/local/rustup && ln -s /usr/local/rustup/bin/rustc /usr/bin/rustc
49+
cp -r ~/.rustup/toolchains/$(ls ~/.rustup/toolchains/ | grep "stable") /usr/local/rustup && ln -s /usr/local/rustup/bin/rustc /usr/bin/rustc
4650

4751
cp $HCDIR/Tools/testlib.h /testlib.h
4852

Diff for: prepare-ubuntu20.sh

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
if [ $UID -ne 0 ]; then
1+
if [ $UID -ne 0 ]; then
22
echo Please run as root
33
exit
44
fi
55

6-
HCDIR=`dirname $(readlink -f "$0")`
6+
HCDIR=$(dirname $(readlink -f "$0"))
77
export GIT_SSL_NO_VERIFY=true
88

99
apt update
@@ -55,23 +55,23 @@ registry = "https://mirrors.sjtug.sjtu.edu.cn/git/crates.io-index"
5555
# rustcc 社区
5656
[source.rustcc]
5757
registry = "git://crates.rustcc.cn/crates.io-index"
58-
' > ~/.cargo/config
58+
' >~/.cargo/config
5959
source /etc/profile
6060

6161
npm install -g npm --registry=https://registry.npm.taobao.org
6262
npm i -g cnpm --registry=https://registry.npm.taobao.org && source /etc/profile
6363

64-
git clone -b v0.4.0 --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/ojcmp.git ~/ojcmp \
65-
&& cd ~/ojcmp && cargo build --release && cp target/release/ojcmp /usr/bin
64+
git clone -b v0.4.0 --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/ojcmp.git ~/ojcmp &&
65+
cd ~/ojcmp && cargo build --release && cp target/release/ojcmp /usr/bin
6666

67-
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/google/nsjail.git ~/nsjail \
68-
&& sed -i '/ .set_tid = 0,\| .set_tid_size = 0,\| .cgroup = 0,/d' ~/nsjail/subproc.cc \
69-
&& cd ~/nsjail && make && cp ~/nsjail/nsjail /usr/bin/nsjail
67+
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/google/nsjail.git ~/nsjail &&
68+
sed -i '/ .set_tid = 0,\| .set_tid_size = 0,\| .cgroup = 0,/d' ~/nsjail/subproc.cc &&
69+
cd ~/nsjail && make && cp ~/nsjail/nsjail /usr/bin/nsjail
7070

71-
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/Heng-Core.git ~/Heng-Core \
72-
&& cd ~/Heng-Core && make && cp ~/Heng-Core/hc /usr/bin/hc && cd ~
71+
git clone --depth=1 --single-branch https://github.com.cnpmjs.org/ThinkSpiritLab/Heng-Core.git ~/Heng-Core &&
72+
cd ~/Heng-Core && make && cp ~/Heng-Core/hc /usr/bin/hc && cd ~
7373

74-
cp -r ~/.rustup/toolchains/`ls ~/.rustup/toolchains/ | grep "stable"` /usr/local/rustup && ln -s /usr/local/rustup/bin/rustc /usr/bin/rustc
74+
cp -r ~/.rustup/toolchains/$(ls ~/.rustup/toolchains/ | grep "stable") /usr/local/rustup && ln -s /usr/local/rustup/bin/rustc /usr/bin/rustc
7575

7676
cp $HCDIR/Tools/testlib.h /testlib.h
7777

0 commit comments

Comments
 (0)