From 27606cf2398fe5eb7c77a2743a25a8ee2b8e7154 Mon Sep 17 00:00:00 2001 From: bin456789 Date: Sun, 12 Nov 2023 17:29:16 +0800 Subject: [PATCH] =?UTF-8?q?core:=20=E5=AF=B9=E4=BA=91=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E5=88=A0=E9=99=A4=20machine-id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- trans.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/trans.sh b/trans.sh index b9ff7ec..d4288bb 100644 --- a/trans.sh +++ b/trans.sh @@ -892,6 +892,12 @@ create_cloud_init_network_config() { fi } +truncate_machine_id() { + os_dir=$1 + + truncate -s 0 $os_dir/etc/machine-id +} + download_cloud_init_config() { os_dir=$1 @@ -1031,6 +1037,8 @@ modify_linux() { download_cloud_init_config $os_dir + truncate_machine_id $os_dir + # 为红帽系禁用 selinux kdump if [ -f $os_dir/etc/redhat-release ]; then find_and_mount /boot @@ -1284,6 +1292,9 @@ install_qcow_el() { # cloud-init download_cloud_init_config /os + # 部分镜像例如 centos7 要手动删除 machine-id + truncate_machine_id /os + # 为 centos 7 ci 安装 NetworkManager # 1. 能够自动配置 onlink 网关 # 2. 解决 cloud-init 关闭了 ra,因为 nm 无视内核 ra 设置