Fix serial for rockpro64

This commit is contained in:
Taylor Helsper 2020-07-09 22:57:17 -05:00
parent 724b8cf212
commit 769f499c96
3 changed files with 14 additions and 9 deletions

View 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

View File

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

View File

@ -225,12 +225,8 @@ 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 = subprocess.check_output("mynode-get-device-serial", 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 = serial.strip()
cached_data["serial"] = serial
return serial