Merge pull request #1947 from ROCKNIX/rockbox

tools: introduce rockbox
This commit is contained in:
spycat88
2025-11-02 22:54:05 +00:00
committed by GitHub
2 changed files with 10 additions and 113 deletions

View File

@@ -8,11 +8,6 @@ export XDG_RUNTIME_DIR=/var/run/0-runtime-dir
export PATH="/usr/bin:/usr/local/bin:/storage/bin:${PATH}"
export SDL_GAMECONTROLLERCONFIG_FILE="/storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt"
J_DIR="/storage/.config/system"
J_CONF="${J_DIR}/configs/system.cfg"
J_CONF_LOCK="/tmp/.system.cfg.lock"
ES_CONF="/storage/.emulationstation/es_settings.cfg"
function tocon() {
echo -ne "\033[1000H\033[2K==> ${*}" >/dev/console
}
@@ -25,87 +20,6 @@ function log() {
echo "$(date) ${SOURCE}: ${MESSAGE}" >>/var/log/messages
}
function get_setting() {
if [ -n "${3}" ]
then
### Test to see if we have a game setting.
VAR="$2\[\"$(echo ${3} | sed -E "s~'~\\\x27~g"';s~[()&]~\\&~g')\"\]\.$1"
OUTPUT=$(awk 'BEGIN {FS="="} /^'"${VAR}"'/ {print $NF}' ${J_CONF})
if [ ! -z "${OUTPUT}" ]
then
echo ${OUTPUT}
return
else
### If not, check to see if we have a system setting.
LOCAL=$(awk -F: '/^'"${2}.${1}"'=/ { st = index($0,"=");print substr($0,st+1);exit}' ${J_CONF})
if [ ! -z "${LOCAL}" ]
then
echo ${LOCAL}
return
fi
fi
fi
if [ -z "${3}" ] && [ -n "${2}" ]
then
### Check to see if we have a global setting.
LOCAL=$(awk -F: '/^'"${2}.${1}"'=/ { st = index($0,"=");print substr($0,st+1);exit}' ${J_CONF})
if [ ! -z "${LOCAL}" ]
then
echo ${LOCAL}
return
fi
fi
### Check to see if we have a "system." global setting.
SYSTEM=$(awk -F: '/^system.'"${1}"='/ { st = index($0,"=");print substr($0,st+1);exit}' ${J_CONF})
if [ -n "${SYSTEM}" ]
then
echo ${SYSTEM}
return
fi
### Check to see if we have a "global." global setting."
LOCAL=$(awk -F: '/^'"${1}"='/ { st = index($0,"=");print substr($0,st+1);exit}' ${J_CONF})
if [ -z "${LOCAL}" ]
then
awk -F: '/^global.'"${1}"='/ { st = index($0,"=");print substr($0,st+1);exit}' ${J_CONF}
return
else
echo ${LOCAL}
fi
return
}
function wait_lock() {
while true
do
if (set -o noclobber; echo "$$" > "${J_CONF_LOCK}") 2>/dev/null
then
trap 'rm -f "$lockfile"; exit $?' INT TERM EXIT
break
else
sleep 1
fi
done
}
function del_setting() {
wait_lock
if [[ "${1}" =~ ^[[:alnum:]] ]]
then
sed -i "/^${1}=/d" "${J_CONF}"
fi
rm -f "${J_CONF_LOCK}"
}
function sort_settings() {
wait_lock
cat "${J_CONF}" | grep ^[a-z0-9] | sort >"${J_CONF}.tmp"
mv "${J_CONF}.tmp" "${J_CONF}"
rm -f "${J_CONF_LOCK}"
}
function set_kill() {
if [ "${1}" = "set" ]
then
@@ -121,37 +35,10 @@ EOF
fi
}
function set_setting() {
if [ ! -d "/storage/.config/system/configs" ]
then
mkdir -p /storage/.config/system/configs
fi
if [ ! -e "/storage/.config/system/configs/system.cfg" ]
then
cp -f /usr/config/system/configs/system.cfg /storage/.config/system/configs/system.cfg
fi
if [[ "${1}" =~ ^[[:alnum:]] ]]
then
del_setting "${1}"
if [ ! "${2}" = "default" ]
then
wait_lock
echo "${1}=${2}" >> "${J_CONF}"
rm -f "${J_CONF_LOCK}"
fi
fi
}
function battery_percent() {
awk 'BEGIN {FS="="} /POWER_SUPPLY_CAPACITY=/ {print $2}' /sys/class/power_supply/[Bb][Aa][Tt]*/uevent 2>/dev/null
}
function get_es_setting() {
echo $(sed -n "s|\s*<${1} name=\"${2}\" value=\"\(.*\)\" />|\1|p" ${ES_CONF})
}
function fbwidth() {
local ORIENTATION=$(</sys/devices/virtual/graphics/fbcon/rotate)
if [ "${ORIENTATION}" = "0" ]

View File

@@ -0,0 +1,10 @@
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2025 ROCKNIX (https://github.com/ROCKNIX)
PKG_NAME="rockbox"
PKG_VERSION="f303f2e06f4da751d9c4543685e7a70ca204e114"
PKG_LICENSE="Proprietary"
PKG_SITE="https://rocknix.org"
PKG_URL="https://github.com/ROCKNIX/${PKG_NAME}/archive/${PKG_VERSION}.tar.gz"
PKG_DEPENDS_INIT="toolchain"
PKG_LONGDESC="ROCKBOX application"