core: 对云镜像手动删除 machine-id

This commit is contained in:
bin456789 2023-11-12 17:29:16 +08:00
parent 58ff5f69f2
commit 27606cf239
No known key found for this signature in database
GPG Key ID: EE301B386DE6C11B

View File

@ -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 设置