diff --git a/installer/distro-setup.sh b/installer/distro-setup.sh index 9cfc9881..5eff787d 100755 --- a/installer/distro-setup.sh +++ b/installer/distro-setup.sh @@ -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 diff --git a/tools/mk-base-image b/tools/mk-base-image index 56a8bcbc..933c70a6 100755 --- a/tools/mk-base-image +++ b/tools/mk-base-image @@ -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