From d99bba29041932df7caeabd895f4eb5a95afa12c Mon Sep 17 00:00:00 2001 From: Christian Hesse Date: Mon, 29 Jun 2015 16:14:03 +0200 Subject: calculate hash from product id Some similar devices share big identical parts of product id... So calculate a hash and cut. --- hook/hostname | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'hook') diff --git a/hook/hostname b/hook/hostname index 07c8be6..e37e90c 100644 --- a/hook/hostname +++ b/hook/hostname @@ -8,8 +8,8 @@ run_latehook() { if [[ -n "${hostname}" ]]; then msg ":: Setting hostname for main system to '${hostname}'..." elif [[ -e /sys/class/dmi/id/product_uuid ]]; then - msg ":: Setting hostname to first bits of product uuid..." - hostname="$(cut -d- -f1 < /sys/class/dmi/id/product_uuid)" + msg ":: Setting hostname from product uuid..." + hostname="$(sha1sum < /sys/class/dmi/id/product_uuid | cut -c1-8)" else msg ":: Setting hostname to random string..." hostname="$(cut -d- -f1 < /proc/sys/kernel/random/boot_id)" -- cgit v1.2.3-70-g09d2