init: mount per-client boot/disk if available & configured (#621)

This commit is contained in:
MilhouseVH 2016-08-26 17:14:35 +01:00 committed by Christian Hewitt
parent b4277bf0de
commit a0e3207846

View File

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