diff --git a/packages/sysutils/systemd/package.mk b/packages/sysutils/systemd/package.mk index fdfed9ac2d..1af3daa34f 100644 --- a/packages/sysutils/systemd/package.mk +++ b/packages/sysutils/systemd/package.mk @@ -98,6 +98,11 @@ pre_make_target() { } post_makeinstall_target() { + # replace systemd-machine-id-setup with ours + mkdir -p $INSTALL/bin + rm -rf $INSTALL/bin/systemd-machine-id-setup + cp $PKG_DIR/scripts/systemd-machine-id-setup $INSTALL/bin + # provide 'halt', 'shutdown', 'reboot' & co. mkdir -p $INSTALL/sbin ln -sf /bin/systemctl $INSTALL/sbin/halt @@ -148,4 +153,6 @@ post_install() { add_group tty 5 add_group video 39 add_group utmp 22 + + enable_service machine-id.service } diff --git a/packages/sysutils/busybox/init.d/03_systemid b/packages/sysutils/systemd/scripts/systemd-machine-id-setup old mode 100644 new mode 100755 similarity index 88% rename from packages/sysutils/busybox/init.d/03_systemid rename to packages/sysutils/systemd/scripts/systemd-machine-id-setup index 9a9b680f0d..0d45f5a29e --- a/packages/sysutils/busybox/init.d/03_systemid +++ b/packages/sysutils/systemd/scripts/systemd-machine-id-setup @@ -1,3 +1,4 @@ +#!/bin/sh ################################################################################ # This file is part of OpenELEC - http://www.openelec.tv # Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) @@ -22,8 +23,10 @@ # 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 + +# creating machine-id, systemd otherwise does this automatically if not present. +# this we want to avoid to have the same machine-id over reboot, fallback +# to systemd's solution if this dont work here if [ -e "/sys/class/net/eth0/address" ]; then MAC_ADRESS=`cat /sys/class/net/eth0/address` @@ -33,8 +36,6 @@ fi if [ -n "$MAC_ADRESS" ]; then MACHINEID=`echo $MAC_ADRESS | md5sum | cut -f1 -d" "` -else - MACHINEID="00000000000000000000000000000000" fi echo "$MACHINEID" > /run/machine-id diff --git a/packages/sysutils/systemd/system.d/machine-id.service b/packages/sysutils/systemd/system.d/machine-id.service new file mode 100644 index 0000000000..4e92ad9df2 --- /dev/null +++ b/packages/sysutils/systemd/system.d/machine-id.service @@ -0,0 +1,12 @@ +[Unit] +Description=Setup machine-id +DefaultDependencies=no +After=local-fs.target + +[Service] +Type=oneshot +ExecStart=/bin/systemd-machine-id-setup +RemainAfterExit=yes + +[Install] +WantedBy=sysinit.target