Install packages, set rootfs, pack images package and other actions in docker.
Signed-off-by: Wang Chenglong 18509160991@163.com --- container/osimage/openeuler/create-image | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 container/osimage/openeuler/create-image
diff --git a/container/osimage/openeuler/create-image b/container/osimage/openeuler/create-image new file mode 100755 index 0000000..58fe0b1 --- /dev/null +++ b/container/osimage/openeuler/create-image @@ -0,0 +1,40 @@ +#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved. + +install_packages() +{ + yum repolist + yum -y install --skip-broken $(</tmp/packages-to-install) + yum clean all +} + +setup_rootfs() +{ + ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime + rm -f /etc/machine-id + rm -f /var/lib/dbus/machine-id + systemd-machine-id-setup +} + + +setup_login() { + [ -n "$ROOT_PASSWD" ] || return + echo "Changing root password" + passwd_md5=$(openssl passwd -1 "$ROOT_PASSWD") + sed -i -r "s/^root:[^:]*:(.*)/root:${passwd_md5////\/}:\1/" "$ROOTFS_DIR/etc/shadow" + + sed -i 's/[# ]PermitRootLogin.*/PermitRootLogin yes/' "$ROOTFS_DIR/etc/ssh/sshd_config" +} + +pack_cgz() +{ + echo "Packing package. Please wait." + find / ! -path "/tmp/${IMAGE_NAME}" | grep -vf /tmp/files-to-exclude | cpio -o -Hnewc | gzip -9 > /tmp/${IMAGE_NAME} + chmod 644 /tmp/${IMAGE_NAME} +} + +install_packages +setup_rootfs +setup_login +pack_cgz
On Thu, Nov 26, 2020 at 09:27:52AM +0800, Wang Chenglong wrote:
Install packages, set rootfs, pack images package and other actions in docker.
Signed-off-by: Wang Chenglong 18509160991@163.com
container/osimage/openeuler/create-image | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 container/osimage/openeuler/create-image
diff --git a/container/osimage/openeuler/create-image b/container/osimage/openeuler/create-image new file mode 100755 index 0000000..58fe0b1 --- /dev/null +++ b/container/osimage/openeuler/create-image @@ -0,0 +1,40 @@
+#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+install_packages() +{
- yum repolist
unnecessary operation
- yum -y install --skip-broken $(</tmp/packages-to-install)
- yum clean all
+}
+setup_rootfs() +{
- ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
add blank line
- rm -f /etc/machine-id
- rm -f /var/lib/dbus/machine-id
rm -f /etc/machine-id /var/lib/dbus/machine-id
Thanks, Wang Yong
On Thu, Nov 26, 2020 at 09:55:59AM +0800, Wang Yong wrote:
On Thu, Nov 26, 2020 at 09:27:52AM +0800, Wang Chenglong wrote:
Install packages, set rootfs, pack images package and other actions in docker.
Signed-off-by: Wang Chenglong 18509160991@163.com
container/osimage/openeuler/create-image | 40 ++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 container/osimage/openeuler/create-image
diff --git a/container/osimage/openeuler/create-image b/container/osimage/openeuler/create-image new file mode 100755 index 0000000..58fe0b1 --- /dev/null +++ b/container/osimage/openeuler/create-image @@ -0,0 +1,40 @@
+#!/bin/bash +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+install_packages() +{
- yum repolist
unnecessary operation
Good.
- yum -y install --skip-broken $(</tmp/packages-to-install)
- yum clean all
+}
+setup_rootfs() +{
- ln -fs /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
add blank line
Good.
- rm -f /etc/machine-id
- rm -f /var/lib/dbus/machine-id
rm -f /etc/machine-id /var/lib/dbus/machine-id
Good.
Thanks, Chenglong
Thanks, Wang Yong