Skip to content

Commit e8c7296

Browse files
authored
update
优化了代码适用性 增加了日志记录功能 修复了已知bug
1 parent 98967fa commit e8c7296

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

Diff for: s390x-build.sh

+20-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,16 @@
11
#!/bin/bash
2+
rundir=$(cd $(dirname $0); pwd)#获取脚本执行目录
3+
touch v.txt
4+
wzx=$(sed -n '1p' v.txt)
5+
if [ $wzx -ne Verified ];then
6+
sed -i "$wzx/Verified" "$(cd $(dirname $0); pwd)"/v.txt
7+
touch build-log.log
8+
./s390x-build.sh > "$rundir"/build-log.log 2>&1
9+
exit
10+
fi
11+
if [ $wzx -eq Verified ];then
12+
rm -rf v.txt
13+
fi
214
echo ----------------------------------------------------------------脚本仅供个人使用----------------------------------------------------------------
315
echo 作者: jerjjj@github
416
echo 版本: 0.5
@@ -27,7 +39,7 @@ if [ $? -ne 0 ];then
2739
exit
2840
fi
2941
echo ----------------------------------------------------------------开始拉取python源码----------------------------------------------------------------
30-
cd s390x-build
42+
cd "$rundir"/s390x-build
3143
git clone https://github.com/python/cpython.git -b main
3244
if [ $? -ne 0 ];then
3345
echo 源码拉取失败
@@ -50,7 +62,7 @@ else
5062
((BS++))
5163
fi
5264
echo ----------------------------------------------------------------开始下载nodejs源码----------------------------------------------------------------
53-
cd ~/s390x-build/
65+
cd "$rundir"/s390x-build
5466
wget https://npmmirror.com/mirrors/node/v16.16.0/node-v16.16.0.tar.gz
5567
if [ $? -ne 0 ];then
5668
echo nodejs源码拉取失败
@@ -79,7 +91,7 @@ else
7991
((BS++))
8092
fi
8193
echo ----------------------------------------------------------------开始下载nginx源码----------------------------------------------------------------
82-
cd ~/s390x-build/
94+
cd "$rundir"s390x-build
8395
wget http://nginx.org/download/nginx-1.22.0.tar.gz
8496
if [ $? -ne 0 ];then
8597
echo nginx源码下载失败
@@ -110,7 +122,7 @@ else
110122
((BS++))
111123
fi
112124
echo ----------------------------------------------------------------开始下载PHP源码----------------------------------------------------------------
113-
cd ~/s390x-build/
125+
cd "$rundir"s390x-build
114126
wget https://www.php.net/distributions/php-8.1.8.tar.gz
115127
if [ $? -ne 0 ];then
116128
echo php源码下载失败
@@ -163,7 +175,7 @@ mv /usr/local/etc/php-fpm.d/www.conf.default /usr/local/etc/php-fpm.d/www.conf
163175
echo "pid = run/php-fpm.pid" >> /usr/local/etc/php-fpm.conf
164176
sed -i "s/listen = 127.0.0.1:9000/listen = var\/run\/php-fpm.sock\//" /usr/local/etc/php-fpm.d/www.conf
165177
echo ----------------------------------------------------------------开始下载MySQL源码----------------------------------------------------------------
166-
cd ~/s390x-build/
178+
cd "$rundir"/s390x-build
167179
wget https://downloads.mysql.com/archives/get/p/23/file/mysql-boost-5.7.38.tar.gz
168180
if [ $? -ne 0 ];then
169181
echo MySQL源码下载失败
@@ -205,10 +217,10 @@ if [ $? -ne 0 ];then
205217
echo MySQL安装失败
206218
((BF++))
207219
else
208-
echo ----------------------------------------------------------------MySQL安装完成(未初始化)----------------------------------------------------------------
220+
echo ----------------------------------------------------------------MySQL安装完成\(未初始化\)----------------------------------------------------------------
209221
((BS++))
210222
fi
211223
echo ----------------------------------------------------------------清理工作目录----------------------------------------------------------------
212-
cd
224+
cd "$rundir"
213225
rm -rf s390x-build
214-
echo ----------------------------------------------------------------脚本运行完成,计划编译$BA,编译成功$BS,编译失败$BF----------------------------------------------------------------
226+
echo ----------------------------------------------------------------脚本运行完成,计划编译"$BA",编译成功"$BS",编译失败"$BF",log位置"$rundir"/build-log.log----------------------------------------------------------------

0 commit comments

Comments
 (0)