From 402982149f8ea5c0cd8e543777bd842ce7441477 Mon Sep 17 00:00:00 2001 From: ActivePeter <1020401660@qq.com> Date: Tue, 23 Apr 2024 12:40:48 +0800 Subject: [PATCH] feature: crac compile --- scripts/.gitignore | 3 ++- scripts/1.1.compile_crac.py | 43 +++++++++++++++++++++++++++++++++++ scripts/1.2send_crac_2_con.py | 16 +++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) create mode 100644 scripts/1.1.compile_crac.py create mode 100644 scripts/1.2send_crac_2_con.py diff --git a/scripts/.gitignore b/scripts/.gitignore index 3dd718b..d26a68e 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,4 +1,5 @@ registry-all.tgz registry-all logs -log \ No newline at end of file +log +crac \ No newline at end of file diff --git a/scripts/1.1.compile_crac.py b/scripts/1.1.compile_crac.py new file mode 100644 index 0000000..8b3df33 --- /dev/null +++ b/scripts/1.1.compile_crac.py @@ -0,0 +1,43 @@ +# CRAC can't be compiled in container because it uses vfork + + + +### chdir +import os +CUR_FPATH = os.path.abspath(__file__) +CUR_FDIR = os.path.dirname(CUR_FPATH) +# chdir to the directory of this script +os.chdir(CUR_FDIR) + + +### utils +def os_system_sure(command): + print(f"执行命令:{command}") + result = os.system(command) + if result != 0: + print(f"命令执行失败:{command}") + exit(1) + print(f"命令执行成功:{command}") + + +def compile_crac(): + os_system_sure("apt install build-essential autoconf -y") + os.system("git clone https://github.com/openjdk/crac.git") + os.chdir("crac") + os_system_sure("git checkout crac-17+6") + installs=[ + 'libfontconfig1-dev', + 'libx11-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev', + 'zip unzip', + 'file', + 'build-essential', + 'libasound2-dev', + 'libcups2-dev' + ] + os_system_sure("apt update") + os_system_sure("apt install {} -y".format(" ".join(installs))) + os_system_sure("bash configure") + os_system_sure("make images") + # os_system_sure("mv build/linux-x86_64-server-release/images/jdk/ .") + +compile_crac() \ No newline at end of file diff --git a/scripts/1.2send_crac_2_con.py b/scripts/1.2send_crac_2_con.py new file mode 100644 index 0000000..2c01528 --- /dev/null +++ b/scripts/1.2send_crac_2_con.py @@ -0,0 +1,16 @@ +### chdir +import os +CUR_FPATH = os.path.abspath(__file__) +CUR_FDIR = os.path.dirname(CUR_FPATH) +# chdir to the directory of this script +os.chdir(CUR_FDIR) +os.chdir("crac") + +COMPILED_JDK_PATH='build/linux-x86_64-server-release/images/jdk/' +REMOTE_PORT=2222 +REMOTE_PATH='root@192.168.31.96:/pvcdata/crac_jdk' + +print(f"Ls jdk content: {COMPILED_JDK_PATH}") +os.system(f"ls {COMPILED_JDK_PATH}") + +os.system(f"scp -r -P {REMOTE_PORT} {COMPILED_JDK_PATH} {REMOTE_PATH}") \ No newline at end of file