mirror of
https://github.com/LibreELEC/LibreELEC.tv.git
synced 2025-07-28 05:06:43 +00:00
Merge pull request #276 from chewitt/statsfix
systemd: fix machine-id uniqueness
This commit is contained in:
commit
0d6902cd49
@ -184,7 +184,7 @@ makeinstall_target() {
|
|||||||
touch $INSTALL/etc/fstab
|
touch $INSTALL/etc/fstab
|
||||||
|
|
||||||
# /etc/machine-id, needed by systemd and dbus
|
# /etc/machine-id, needed by systemd and dbus
|
||||||
ln -sf /run/machine-id $INSTALL/etc/machine-id
|
ln -sf /storage/.cache/machine-id $INSTALL/etc/machine-id
|
||||||
|
|
||||||
# /etc/mtab is needed by udisks etc...
|
# /etc/mtab is needed by udisks etc...
|
||||||
ln -sf /proc/self/mounts $INSTALL/etc/mtab
|
ln -sf /proc/self/mounts $INSTALL/etc/mtab
|
||||||
|
@ -17,21 +17,25 @@
|
|||||||
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
# along with OpenELEC. If not, see <http://www.gnu.org/licenses/>.
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
||||||
# Attempts to generate a unique machine ID based on one local MAC address
|
# Creates a unique machine-id based on a local MAC address which persists over
|
||||||
# MACHINEID SHOULD be the same between upgrades/reinstalls
|
# reboots, upgrades and reinstallation. For systems with slow loading network
|
||||||
# MAC is hashed so that it cant be reversed making it anonymous
|
# drivers (no MAC's available) dbus-uuidgen is used which persists over reboot
|
||||||
# Used to help with global usage statistics, also used for dbus and systemd
|
# and upgrades but not reinstallation. If a MAC is used it is hashed to make it
|
||||||
|
# anonymous. The machine-id is used by dbus and systemd, and to collect basic
|
||||||
|
# active-installation statistics on LibreELEC users.
|
||||||
|
|
||||||
# creating machine-id, systemd otherwise does this automatically if not present.
|
if [ -e "/storage/.cache/machine-id" ]; then
|
||||||
# this we want to avoid to have the same machine-id over reboot, fallback
|
MACHINEID=`cat /storage/.cache/machine-id`
|
||||||
# to systemd's solution if this dont work here
|
elif [ -e "/sys/class/net/eth0/address" ]; then
|
||||||
|
MAC_ADDRESS=`cat /sys/class/net/eth0/address`
|
||||||
if [ -e "/sys/class/net/eth0/address" ]; then
|
|
||||||
MAC_ADRESS=`cat /sys/class/net/eth0/address`
|
|
||||||
elif [ -e "/sys/class/net/wlan0/address" ]; then
|
elif [ -e "/sys/class/net/wlan0/address" ]; then
|
||||||
MAC_ADRESS=`cat /sys/class/net/wlan0/address`
|
MAC_ADDRESS=`cat /sys/class/net/wlan0/address`
|
||||||
|
else
|
||||||
|
MAC_ADDRESS=`/usr/bin/dbus-uuidgen`
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MACHINEID=`echo $MAC_ADRESS | md5sum | cut -f1 -d" "`
|
if [ -z "$MACHINEID" ]; then
|
||||||
|
MACHINEID=`echo $MAC_ADDRESS | md5sum | cut -f1 -d" "`
|
||||||
|
fi
|
||||||
|
|
||||||
echo "$MACHINEID" > /run/machine-id
|
echo "$MACHINEID" > /storage/.cache/machine-id
|
||||||
|
Loading…
x
Reference in New Issue
Block a user