
On Mon, Oct 12, 2020 at 02:30:07PM +0800, Xiao Shenwei wrote:
diff --git a/container/osimage/centos/bin/lib b/container/osimage/centos/bin/lib new file mode 100755 index 0000000..b4a59e2 --- /dev/null +++ b/container/osimage/centos/bin/lib @@ -0,0 +1,41 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +DIR="$(pwd)"
use pwd not a good way, you can use DIR=$(dirname $(realpath $0)) to get current path
这个方法尝试过了,因为用户执行的命令不是$realpth ,而是$CCI_SRC/container/osimage/centos/run的一个链接 $CCI_SRC/rootfs/initramfs/centos/aarch64/7/build, 所以"realpath $0" 显示的路径其实是 $CCI_SRC/container/osimage/centos 后续的$name以及$version 都会出错。 Thanks, Chenglong
diff --git a/container/osimage/centos/run b/container/osimage/centos/run new file mode 100755 index 0000000..47817b9 --- /dev/null +++ b/container/osimage/centos/run @@ -0,0 +1,27 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +. ${CCI_SRC}/container/osimage/centos/bin/lib +. ${CCI_SRC}/container/defconfig.sh + +check_passwd_file "$root_pwd_file" + +DIR=$(dirname $(realpath $0)) +cmd=( + docker run + --name init_docker + -v $DIR/bin/:/root/bin + -v /srv/initrd/modules/:/root/modules:ro + -e ROOT_NEW_PASSWD=$ROOT_NEW_PASSWD + -e image_name=$image_name + $image + /root/bin/create-image +) + +pull_docker_image +${cmd[@]} +cp_package +docker_rm init_docker &> /dev/null +echo "build finished"
blank line should be del
Thanks, Shenwei
+ -- 2.23.0