* fix cvi_base deadlock2

This commit is contained in:
lxowalle
2025-01-04 14:12:46 +08:00
parent d3b91ff1fd
commit c4bd8d00cc
2 changed files with 15 additions and 2 deletions

View File

@@ -2,6 +2,11 @@
if [ "$1" = "start" ]
then
# Cache uid to prevent deadlock during cvi_base operation
if [ ! -e /boot/cvi_base_uid ]; then
$(cat /sys/class/cvi-base/base_uid > /boot/cvi_base_uid)
fi
str_value=$(cat /sys/class/cvi-base/base_uid | awk '{print $2}')
first_uint=$(echo $str_value | cut -d'_' -f1)
second_uint=$(echo $str_value | cut -d'_' -f2)

View File

@@ -19,7 +19,11 @@ then
prefix=$(cat /boot/hostname.prefix)
fi
old_hostname=$(cat /etc/hostname)
new_hostname=${prefix}-$(sha512sum /sys/class/cvi-base/base_uid | head -c 4)
if [ -e /boot/cvi_base_uid ]; then
new_hostname=${prefix}-$(sha512sum /boot/cvi_base_uid | head -c 4)
else
new_hostname=${prefix}-$(sha512sum /sys/class/cvi-base/base_uid | head -c 4)
fi
if [ -e /boot/hostname ]
then
@@ -38,7 +42,11 @@ then
then
new_ethmac=$(cat /boot/ethmac)
else
new_ethmac=$(hex2mac 48da356f$(sha512sum /sys/class/cvi-base/base_uid | head -c 4))
if [ -e /boot/cvi_base_uid ]; then
new_ethmac=$(hex2mac 48da356f$(sha512sum /boot/cvi_base_uid | head -c 4))
else
new_ethmac=$(hex2mac 48da356f$(sha512sum /sys/class/cvi-base/base_uid | head -c 4))
fi
fi
ifconfig eth0 down