运行在docker中完成所有生成iso的动作

This commit is contained in:
fslongjin 2022-07-25 20:34:57 +08:00
parent 63c40fec13
commit b1f7845520
2 changed files with 66 additions and 45 deletions

23
run.sh
View File

@ -4,6 +4,8 @@
# echo "请以sudo权限运行"
# exit
#fi
GENERATE_ISO=0
IN_DOCKER=0
# 第一个参数如果是--notbuild 那就不构建,直接运行
if [ ! "$1" == "--nobuild" ]; then
@ -11,9 +13,18 @@ if [ ! "$1" == "--nobuild" ]; then
if [ "$1" == "--docker" ]; then
echo "使用docker构建"
sudo bash tools/build_in_docker.sh
else
GENERATE_ISO=0
elif [ "$1" == "--current_in_docker" ]; then
echo "运行在docker内"
IN_DOCKER=1
make all -j 16
make clean
GENERATE_ISO=1
else
make all -j 16
make clean
GENERATE_ISO=1
fi
fi
@ -29,6 +40,9 @@ iso='./DragonOS.iso'
iso_folder='./iso/'
root_folder="$(pwd)"
if [ "${GENERATE_ISO}" == "1" ]; then
echo "开始生成iso..."
# toolchain
OS=`uname -s`
if [ "${OS}" == "Linux" ]; then
@ -83,6 +97,13 @@ fi
${GRUB_PATH}/grub-mkrescue -o ${iso} ${iso_folder}
rm -rf ${iso_folder}
if [ "${IN_DOCKER}" == "1" ]; then
echo "运行在docker中, 构建结束"
exit 0
fi
fi
# 进行启动前检查
flag_can_run=0

View File

@ -3,5 +3,5 @@ p=`pwd`
cpu_count=$(cat /proc/cpuinfo |grep "processor"|wc -l)
docker run -v $p:/data --name dragonos-build -i dragonos-dev:v1.0 bash << EOF
cd /data
make -j ${cpu_count}
bash run.sh --current_in_docker
EOF