busybox: create /etc/machine-id (symlink from /run/machine-id), used by systemd, dbus and replaces '$SYSTEMID'

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-07-12 23:44:12 +02:00
parent 8523c8f9da
commit 9715ae0aa5
2 changed files with 13 additions and 8 deletions

View File

@ -17,13 +17,13 @@
# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
# http://www.gnu.org/copyleft/gpl.html
################################################################################
# Attempts to generate a unique system ID based on one local MAC address
# SystemID SHOULD be the same between upgrades/reinstalls
# MAC is hashed so that it cant be reversed making it anonymous
# Used to help with global usage statistics
################################################################################
SYSTEMID="00000000000000000000000000000000"
# Attempts to generate a unique machine ID based on one local MAC address
# MACHINEID SHOULD be the same between upgrades/reinstalls
# MAC is hashed so that it cant be reversed making it anonymous
# Used to help with global usage statistics, also used for dbus and systemd
#
# runlevels: openelec, installer, textmode
if [ -e "/sys/class/net/eth0/address" ]; then
MAC_ADRESS=`cat /sys/class/net/eth0/address`
@ -32,7 +32,9 @@ elif [ -e "/sys/class/net/wlan0/address" ]; then
fi
if [ -n "$MAC_ADRESS" ]; then
SYSTEMID=`echo $MAC_ADRESS | md5sum | cut -f1 -d" "`
MACHINEID=`echo $MAC_ADRESS | md5sum | cut -f1 -d" "`
else
MACHINEID="00000000000000000000000000000000"
fi
export SYSTEMID
echo "$MACHINEID" > /run/machine-id

View File

@ -59,6 +59,9 @@ USER_PWD="`$ROOT/$TOOLCHAIN/bin/cryptpw -m sha512 $USER_PASSWORD`"
# /etc/fstab is needed by...
touch $INSTALL/etc/fstab
# /etc/machine-id, needed by systemd and dbus
ln -sf /run/machine-id $INSTALL/etc/machine-id
# /etc/hosts must be writeable
ln -sf /var/cache/hosts $INSTALL/etc/hosts