mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-21 03:09:08 -05:00
feat: read Lakka's board for the install
Lakka's image writes the board in /etc/os-release: LIBREELEC_DEVICE when built for a device, LIBREELEC_PROJECT otherwise, the very names of our Lakka targets. The installer read the board on Batocera, Recalbox and ROCKNIX only, so a Lakka RPi4 installed 5.7 GB of every board's files where its own needs 4.0.
This commit is contained in:
1 parent
1c4351fe60
commit
31516c1f7c
5 files changed
+23
-7
No files matched your search
+1
-1
@@ -8,7 +8,7 @@ param(
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$defaultInstallUrl = "https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
|
||||
$defaultInstallSha256 = "16732df165f2f3cf971ae2049aea4b89c7b6a48925d395417c9a363e9bb57970"
|
||||
$defaultInstallSha256 = "9806af7e6f6686274f4eff644933e81ad384dd6a74ecc8ad1f82b59becf6c64e"
|
||||
$maximumInstallerBytes = 2MB
|
||||
$installerExit = 0
|
||||
$installer = if ($PSScriptRoot) { Join-Path $PSScriptRoot "install.py" } else { $null }
|
||||
|
||||
+7
-3
@@ -665,11 +665,14 @@ def _parse_bash_var(path: Path, key: str) -> str | None:
|
||||
# Where an embedded system names the board it was built for, in the words
|
||||
# of our target lists: batocera-system.mk writes BATOCERA_SYSTEM_ARCH,
|
||||
# recalbox-system.mk RECALBOX_SYSTEM_PLATFORM, ROCKNIX's scripts/image puts
|
||||
# HW_DEVICE in os-release (RK3326, our rk3326).
|
||||
# HW_DEVICE in os-release (RK3326, our rk3326). Lakka's scripts/image writes
|
||||
# LIBREELEC_DEVICE when the image is built for a device (RPi4) and always
|
||||
# LIBREELEC_PROJECT (Generic): the first one set is the board.
|
||||
_BOARD_SOURCES: dict[str, tuple[str, str]] = {
|
||||
"batocera": ("file", "/usr/share/batocera/batocera.arch"),
|
||||
"recalbox": ("file", "/recalbox/recalbox.arch"),
|
||||
"rocknix": ("os_release", "HW_DEVICE"),
|
||||
"lakka": ("os_release", "LIBREELEC_DEVICE|LIBREELEC_PROJECT"),
|
||||
}
|
||||
|
||||
|
||||
@@ -682,7 +685,8 @@ def detect_board(platform: str) -> str | None:
|
||||
except OSError:
|
||||
return None
|
||||
elif kind == "os_release":
|
||||
value = _parse_os_release().get(where, "")
|
||||
release = _parse_os_release()
|
||||
value = next((release[key] for key in where.split("|") if release.get(key)), "")
|
||||
else:
|
||||
return None
|
||||
return value.strip().lower() or None
|
||||
@@ -3476,7 +3480,7 @@ def main() -> None:
|
||||
parser.add_argument(
|
||||
"--target",
|
||||
help="hardware target for core filtering (switch, rpi4, ...); "
|
||||
"on Batocera, Recalbox and ROCKNIX the board is read from the system",
|
||||
"on Batocera, Recalbox, ROCKNIX and Lakka the board is read from the system",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--every-board",
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ esac
|
||||
TEMP_INSTALLER=""
|
||||
TEMP_DIRECTORY=""
|
||||
DEFAULT_INSTALL_URL="https://raw.githubusercontent.com/Abdess/retrobios/main/install.py"
|
||||
DEFAULT_INSTALL_SHA256="16732df165f2f3cf971ae2049aea4b89c7b6a48925d395417c9a363e9bb57970"
|
||||
DEFAULT_INSTALL_SHA256="9806af7e6f6686274f4eff644933e81ad384dd6a74ecc8ad1f82b59becf6c64e"
|
||||
MAX_INSTALLER_BYTES=2097152
|
||||
|
||||
cleanup() {
|
||||
|
||||
@@ -2399,6 +2399,18 @@ class TheBoardTheSystemNamesIsTheTarget(unittest.TestCase):
|
||||
self.assertEqual(install.detect_board("rocknix"), "rk3326")
|
||||
self.assertIsNone(install.detect_board("retroarch"))
|
||||
|
||||
def test_lakka_names_its_device_or_its_project(self):
|
||||
# An RPi4 Lakka installed 5.7 GB of every board's files: its board
|
||||
# was in os-release and never read.
|
||||
for release, board in (
|
||||
({"LIBREELEC_PROJECT": "RPi", "LIBREELEC_DEVICE": "RPi4"}, "rpi4"),
|
||||
({"LIBREELEC_PROJECT": "Generic"}, "generic"),
|
||||
):
|
||||
with self.subTest(board=board), unittest.mock.patch.object(
|
||||
install, "_parse_os_release", return_value=release
|
||||
):
|
||||
self.assertEqual(install.detect_board("lakka"), board)
|
||||
|
||||
def test_every_board_and_target_are_refused_together(self):
|
||||
result = subprocess.run(
|
||||
[sys.executable, str(REPO_ROOT / "install.py"), "--every-board",
|
||||
|
||||
+2
-2
@@ -212,7 +212,7 @@ what the options name, everything by default.
|
||||
|--------|--------|
|
||||
| `--platform NAME` | Install for this platform instead of the detected one. Unknown names are refused with the available list |
|
||||
| `--dest PATH` | Destination directory, overriding detection. With `--dest` alone the file list is RetroArch's |
|
||||
| `--target NAME` | Keep only the files the cores of that hardware target need, and the systems they emulate. An unknown target is refused rather than ignored, since carrying on would install everything. On Batocera, Recalbox and ROCKNIX the board is read from the system (`batocera.arch`, `recalbox.arch`, `HW_DEVICE`) and applied when no `--target` is given |
|
||||
| `--target NAME` | Keep only the files the cores of that hardware target need, and the systems they emulate. An unknown target is refused rather than ignored, since carrying on would install everything. On Batocera, Recalbox, ROCKNIX and Lakka the board is read from the system (`batocera.arch`, `recalbox.arch`, `HW_DEVICE`, `LIBREELEC_DEVICE` or `LIBREELEC_PROJECT`) and applied when no `--target` is given |
|
||||
| `--every-board` | Install the files of every board instead of the one the system names, for a card that moves between devices |
|
||||
| `--installed-cores` | Keep only what the cores already installed read (RetroArch, Lakka, RetroPie). See [Installed cores](#installed-cores) |
|
||||
| `--system NAMES` | Install only these systems. Comma-separated or repeated. `--list-systems` prints the names, `other` included |
|
||||
@@ -269,7 +269,7 @@ wins, since a machine is only one of them.
|
||||
| `/home/ark` and `/opt/system` | RetroArch | `/roms/bios` |
|
||||
| `/mnt/vendor/bin/dmenu.bin` | RetroArch | `/mnt/mmc/bios` |
|
||||
|
||||
Batocera, Recalbox and ROCKNIX also name the board they were built for, and
|
||||
Batocera, Recalbox, ROCKNIX and Lakka also name the board they were built for, and
|
||||
that board narrows the install unless `--target` or `--every-board` says
|
||||
otherwise (see the options above).
|
||||
|
||||
|
||||
Reference in new issue
Block a user