mynode/rootfs/standard/usr/bin/mynode-get-device-serial
2021-02-25 23:24:56 -06:00

17 lines
548 B
Bash
Executable File

#!/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
if [ -f /home/bitcoin/.mynode/mynode_serial ]; then
SERIAL_NUM=$(cat /home/bitcoin/.mynode/mynode_serial)
else
# Backup, use eth0 mac (some are duplicate?)
MAC=$(cat /sys/class/net/eth0/address)
SERIAL_NUM=$(echo "${MAC//:}")
fi
fi
echo $SERIAL_NUM