mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
33 lines
1.4 KiB
Bash
Executable File
33 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
################################################################################
|
|
# This file is part of LibreELEC - https://libreelec.tv
|
|
# Copyright (C) 2018-present Team LibreELEC
|
|
# Copyright (C) 2009-2014 Stephan Raue
|
|
#
|
|
# LibreELEC is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# LibreELEC is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with LibreELEC. If not, see <http://www.gnu.org/licenses/>.
|
|
################################################################################
|
|
|
|
# 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)
|
|
|
|
# persist uuid
|
|
mkdir -p /storage/.cache
|
|
echo "$MACHINEID" > /storage/.cache/systemd-machine-id
|