Fix serial for rockpro64
This commit is contained in:
parent
724b8cf212
commit
769f499c96
12
rootfs/standard/usr/bin/mynode-get-device-serial
Executable file
12
rootfs/standard/usr/bin/mynode-get-device-serial
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
SERIAL_NUM=$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2)
|
||||
if [[ "$SERIAL_NUM" == "" ]]; then
|
||||
SERIAL_NUM=$(sudo dmidecode | grep UUID | cut -d ' ' -f 2)
|
||||
elif [[ "$SERIAL_NUM" == "0000000000000000" ]]; then
|
||||
# RockPro64 returns 0s, so use eth0 mac
|
||||
MAC=$(cat /sys/class/net/eth0/address)
|
||||
SERIAL_NUM=$(echo "${MAC//:}")
|
||||
fi
|
||||
|
||||
echo $SERIAL_NUM
|
|
@ -39,10 +39,7 @@ fi
|
|||
|
||||
TOTAL_RAM_GB=$(free --giga | grep Mem | awk '{print $2}')
|
||||
|
||||
SERIAL_NUM=$(cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2)
|
||||
if [[ "$SERIAL_NUM" == "" ]]; then
|
||||
SERIAL_NUM=$(sudo dmidecode | grep UUID | cut -d ' ' -f 2)
|
||||
fi
|
||||
SERIAL_NUM=$(mynode-get-device-serial)
|
||||
|
||||
# Set all default / standard bash config settings
|
||||
MYNODE_DIR=/mnt/hdd/mynode
|
||||
|
|
|
@ -225,11 +225,7 @@ def get_device_serial():
|
|||
if "serial" in cached_data:
|
||||
return cached_data["serial"]
|
||||
|
||||
serial = subprocess.check_output("cat /proc/cpuinfo | grep Serial | cut -d ' ' -f 2", shell=True)
|
||||
serial = serial.strip()
|
||||
if serial == "":
|
||||
# For VMs, use the UUID
|
||||
serial = subprocess.check_output("sudo dmidecode | grep UUID | cut -d ' ' -f 2", shell=True)
|
||||
serial = subprocess.check_output("mynode-get-device-serial", shell=True)
|
||||
serial = serial.strip()
|
||||
|
||||
cached_data["serial"] = serial
|
||||
|
|
Loading…
Reference in New Issue
Block a user