1
0
mirror of https://github.com/libretro/Lakka-LibreELEC.git synced 2024-11-24 13:46:18 +00:00
Lakka-LibreELEC/projects/L4T/packages/systemd/scripts/systemd-machine-id-setup
2022-04-23 21:36:57 +02:00

21 lines
804 B
Bash
Executable File

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2014 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
# remove old machine-id file
[[ -f "/storage/.cache/machine-id" ]] && rm /storage/.cache/machine-id
# test systemd-machine-id exists and is 32 hex chars or generate a new uuid
MACHINEID="$(cat /storage/.cache/systemd-machine-id 2>/dev/null)"
[ "${#MACHINEID}" != "32" ] && MACHINEID=
[[ "${MACHINEID//[a-f0-9]/}" != "" ]] && MACHINEID=
[ -z "${MACHINEID}" ] && MACHINEID=$(/usr/bin/dbus-uuidgen)
# For first boot detection systemd may have overmounted the file
umount /storage/.cache/systemd-machine-id >/dev/null 2>&1
# persist uuid
mkdir -p /storage/.cache
echo "$MACHINEID" > /storage/.cache/systemd-machine-id