feat: use dmi data to generate machine id

This commit is contained in:
wpetit 2023-03-09 15:09:43 +01:00
parent 78cffa1c12
commit 55b49679f1
2 changed files with 4 additions and 3 deletions

View File

@ -12,13 +12,13 @@ main() {
# Accumulate data to create unique machine id
local mac_addresses=$(cat /sys/class/net/*/address | uniq | sort)
local device_model=$(cat /sys/firmware/devicetree/base/model)
local device_uuid=$(dmidecode | grep UUID)
# Ensure destination directory
mkdir -p "$(dirname "$machine_id_file")"
# Generate SHA256 hash of data and save it to $machine_id_file
echo "$mac_adresses $device_model" | sha256sum | cut -d ' ' -f1 > "$machine_id_file"
echo "$mac_adresses $device_uuid" | sha256sum | cut -d ' ' -f1 > "$machine_id_file"
}
main

View File

@ -1,3 +1,4 @@
luci
openssh-server
openssh-sftp-server
openssh-sftp-server
dmidecode