bugfix:TSG-13377:修改同一台设备使用固定machine-id

This commit is contained in:
fumingwei
2023-01-10 19:47:28 +08:00
committed by 付明卫
parent 44c8cbd692
commit f7a041c96c
2 changed files with 13 additions and 1 deletions

View File

@@ -66,6 +66,17 @@ cp -a /var/lib/rpm /data/var/lib/
#
rm -rf /data/var/lib/docker
rm -rf /data/overlay/rootfs_etc/rw/ld.so.conf.d
# generate machine-id if /data/overlay/rootfs_etc/rw/persistent-machine-id not exsit
mkdir -p /data/var/lib/tsg-os
cat /dev/null > /etc/machine-id
PATH_PERSISTENT_MACHINE_ID="/data/var/lib/tsg-os/persistent-machine-id"
if [ -f "$PATH_PERSISTENT_MACHINE_ID" ]; then
cat $PATH_PERSISTENT_MACHINE_ID > /etc/machine-id
else
/usr/bin/systemd-machine-id-setup
cat /etc/machine-id > $PATH_PERSISTENT_MACHINE_ID
fi
# copy k3s image tar file to air-gap dir
air_gap_image_dir="/var/lib/rancher/k3s/agent/images"
if [ -d "$air_gap_image_dir" ]; then

View File

@@ -70,7 +70,6 @@ yum -c "$yum_config" --installroot="$target" -y makecache
yum -c "$yum_config" --installroot="$target" -y --setopt=$setopt install $base_package_to_install
yum -c "$yum_config" --installroot="$target" -y --setopt=$setopt install $append_package_to_install
#if [ $profile_id == "TSG-X-NXR620G40-R01-P0804" ];then
# kernel_version=$(ls $target/boot/vmlinuz-*.x86_64 | grep -oP "^$target/boot/vmlinuz-\K.*")
#fi
@@ -152,6 +151,8 @@ yum -c "$yum_config" --installroot="$target" -y --setopt=$setopt clean all
rm -rf $target/tmp/*
rm -rf $target/core.*
#rm -rf $target/etc/machine-id
#cat /dev/null > $target/etc/machine-id
# tar --numeric-owner -c -C centos_mkroot/ . | pbzip2 -p9 > input/centos-7-chroot.tar.bz2