From a0e320784666858198c014f060b1a9304ec27e62 Mon Sep 17 00:00:00 2001 From: MilhouseVH Date: Fri, 26 Aug 2016 17:14:35 +0100 Subject: [PATCH] init: mount per-client boot/disk if available & configured (#621) --- packages/sysutils/busybox/scripts/init | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/sysutils/busybox/scripts/init b/packages/sysutils/busybox/scripts/init index c3f439f4fa..e97c329b93 100755 --- a/packages/sysutils/busybox/scripts/init +++ b/packages/sysutils/busybox/scripts/init @@ -61,6 +61,10 @@ LIVE="no" + # Get a serial number if present (eg. RPi) otherwise use MAC address from eth0 + MACHINE_UID="$(cat /proc/cpuinfo | awk '/^Serial/{s=$3; gsub ("^0*","",s); print s}')" + [ -z "$MACHINE_UID" ] && MACHINE_UID="$(cat /sys/class/net/eth0/address 2>/dev/null | tr -d :)" + # hide kernel log messages on console echo '1 4 1 7' > /proc/sys/kernel/printk @@ -338,6 +342,10 @@ error "mount_part" "Unknown filesystem $1" ;; esac + + # Substitute unique identifier if available or remove placeholder + MOUNT_TARGET="${MOUNT_TARGET//@UID@/$MACHINE_UID}" + $MOUNT_CMD "$MOUNT_TARGET" "$2" "$3" "$4" } @@ -899,6 +907,8 @@ error "check arguments" "boot argument can't be FILE type..." fi + debug_msg "Unique identifier for this client: ${MACHINE_UID:-NOT AVAILABLE}" + # main boot sequence for BOOT_STEP in \ load_modules \