Add intial serial number check logic

This commit is contained in:
rocknix
2025-10-02 21:33:53 +00:00
parent 5a98f2e945
commit 28385e1913
4 changed files with 41 additions and 2 deletions

View File

@@ -0,0 +1,8 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
cat <<EOF >/storage/.config/profile.d/009-serial-number-path
DEVICE_SERIAL_NUMBER_PATH=("/sys/devices/soc0/serial_number")
EOF

View File

@@ -46,6 +46,7 @@ export OS_VERSION \
DEVICE_PWM_FAN \
DEVICE_PWM_MOTOR \
DEVICE_ROTATED_SDL \
DEVICE_SERIAL_NUMBER_PATH \
DEVICE_SLEEP_DPMS \
DEVICE_SW_HP_SWITCH \
DEVICE_TDP_RANGE \

View File

@@ -2,7 +2,7 @@
# Copyright (C) 2024-present ROCKNIX (https://github.com/ROCKNIX)
PKG_NAME="emulationstation"
PKG_VERSION="a08f44d24cdbb048b0bce9222b5ceb880298436f"
PKG_VERSION="a081efb94a734fb788bb9286f071647a7765d80b"
PKG_GIT_CLONE_BRANCH="master"
PKG_LICENSE="GPL"
PKG_SITE="https://github.com/ROCKNIX/emulationstation-next"
@@ -55,13 +55,16 @@ makeinstall_target() {
cp -rf ${PKG_BUILD}/resources/* ${INSTALL}/usr/config/emulationstation/resources/
rm -rf ${INSTALL}/usr/config/emulationstation/resources/logo.png
mkdir -p ${INSTALL}/usr/bin
mkdir -p ${INSTALL}/usr/bin
cp ${PKG_BUILD}/es_settings ${INSTALL}/usr/bin
chmod 0755 ${INSTALL}/usr/bin/es_settings
cp ${PKG_BUILD}/start_es.sh ${INSTALL}/usr/bin
chmod 0755 ${INSTALL}/usr/bin/start_es.sh
cp ${PKG_BUILD}/serial_number_check ${INSTALL}/usr/bin
chmod 0755 ${INSTALL}/usr/bin/serial_number_check
mkdir -p ${INSTALL}/usr/lib/${PKG_PYTHON_VERSION}
cp -rf ${PKG_DIR}/bluez/* ${INSTALL}/usr/lib/${PKG_PYTHON_VERSION}

View File

@@ -0,0 +1,27 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2025-present ROCKNIX (https://github.com/ROCKNIX)
. /etc/profile
if [ -z "${DEVICE_SERIAL_NUMBER_PATH}" ]; then
log $0 "SERIAL NUMBER CHECK: This device has no unique serial number to check, skipping and continue to Emulation Station"
exit 0
else
DEVICE_SERIAL_NUMBER="$(cat ${DEVICE_SERIAL_NUMBER_PATH})"
log $0 "SERIAL NUMBER CHECK: DEVICE SERIAL NUMBER: ${DEVICE_SERIAL_NUMBER}"
fi
STORED_SERIAL_NUMBER=$(get_setting "device.serial.number")
if [ ! -n "${STORED_SERIAL_NUMBER}" ]; then
set_setting "device.serial.number" "${DEVICE_SERIAL_NUMBER}"
echo 1 > "/storage/serial_number_check_status"
log $0 "SERIAL NUMBER CHECK: No storted serial number found, saving SOC serial number to system.cfg and show warning."
elif [ ! "${STORED_SERIAL_NUMBER}" == "${DEVICE_SERIAL_NUMBER}" ]; then
set_setting "device.serial.number" "${DEVICE_SERIAL_NUMBER}"
echo 1 > "/storage/serial_number_check_status"
log $0 "SERIAL NUMBER CHECK: Device and stored serial numbers do not match, show warning."
else
log $0 "SERIAL NUMBER CHECK: Device and stored serial numbers match, continue to Emulation Station."
fi