27 lines
688 B
Bash
Executable File
27 lines
688 B
Bash
Executable File
#!/bin/bash
|
|
# 更新软件包
|
|
echo "更新软件包..."
|
|
yum update -y
|
|
|
|
# 安装编译工具和库
|
|
echo "安装必要的工具和库..."
|
|
yum groupinstall "Development Tools" -y
|
|
yum install -y openssl openssl-devel
|
|
yum install -y zlib zlib-devel
|
|
openssl ecparam -name SM2 -genkey -noout -out sm2_key.pem
|
|
openssl ec -in sm2_key.pem -pubout -out sm2_pub.pem
|
|
|
|
# 编译程序
|
|
echo "开始编译程序..."
|
|
gcc -o linux linux.c -lpthread -lssl -lcrypto -lgmssl
|
|
|
|
# 显示编译结果
|
|
if [ $? -eq 0 ]; then
|
|
echo "编译成功,生成可执行文件 'linux'"
|
|
else
|
|
echo "编译失败,请检查代码"
|
|
fi
|
|
|
|
# 保持容器运行
|
|
echo "容器初始化完成,进入交互模式..."
|
|
exec /bin/bash |