busybox: port machine-id script setup to systemd

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-08-08 03:43:08 +02:00
parent 05029fcaf7
commit 85c9783459
3 changed files with 24 additions and 4 deletions

View File

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

View File

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

View File

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