Skip to content

Commit

Permalink
Merge pull request #142 from kloptops/main
Browse files Browse the repository at this point in the history
Added muOS sdcard selection, fixed ports with ext4 fs on muOS.
  • Loading branch information
kloptops authored Jun 9, 2024
2 parents 482184b + e758291 commit 66d21ad
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 9 deletions.
2 changes: 1 addition & 1 deletion PortMaster/harbourmaster
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def do_device_info(hm, argv):
website_data[device_name] = {}

for cfw_name in device_data['cfw']:
info = {'name': cfw_name.lower(), 'version': 'N/A', 'device': device_data['device']}
info = {'name': cfw_name.lower(), 'version': 'N/A', 'device': device_data['device'], 'manufacturer': device_data['manufacturer']}
harbourmaster.expand_info(info, use_old_cpu_info=True)

website_data[device_name][cfw_name] = info
Expand Down
8 changes: 5 additions & 3 deletions PortMaster/pylibs/harbourmaster/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@

################################################################################
## The following code is a simplification of the PortMaster toolsloc and whichsd code.
HM_DEFAULT_PORTS_DIR = Path("/roms/ports")
HM_DEFAULT_PORTS_DIR = Path("/roms/ports")
HM_DEFAULT_SCRIPTS_DIR = Path("/roms/ports")
HM_DEFAULT_TOOLS_DIR = Path("/roms/ports")
HM_DEFAULT_TOOLS_DIR = Path("/roms/ports")

if 'XDG_DATA_HOME' not in os.environ:
os.environ['XDG_DATA_HOME'] = str(Path().home() / '.local' / 'share')
Expand Down Expand Up @@ -62,7 +62,9 @@
HM_DEFAULT_PORTS_DIR = Path("/mnt/mmc/ports")
HM_DEFAULT_SCRIPTS_DIR = Path("/mnt/mmc/ROMS/Ports")

if '/mnt/sdcard' in subprocess.getoutput(['df']):
MUOS_MMC_TOGGLE = Path('/mnt/mmc/MUOS/PortMaster/config/muos_mmc_master_race.txt')

if not MUOS_MMC_TOGGLE.is_file() and '/mnt/sdcard' in subprocess.getoutput(['df']):
HM_DEFAULT_PORTS_DIR = Path("/mnt/sdcard/ports")
HM_DEFAULT_SCRIPTS_DIR = Path("/mnt/sdcard/ROMS/Ports")

Expand Down
3 changes: 3 additions & 0 deletions PortMaster/pylibs/harbourmaster/harbour.py
Original file line number Diff line number Diff line change
Expand Up @@ -1552,6 +1552,9 @@ def _install_port(self, download_info):

self._fix_permissions()

if self.ports_dir != self.scripts_dir:
self._fix_permissions(self.scripts_dir)

# logger.debug(port_info)
if port_info['attr'].get('runtime', None) is not None:
runtime_name = runtime_nicename(port_info['attr']['runtime'])
Expand Down
3 changes: 2 additions & 1 deletion PortMaster/pylibs/harbourmaster/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"Anbernic RG552": {"device": "rg552", "manufacturer": "Anbernic", "cfw": ["AmberELEC", "JELOS", "ROCKNIX"]},
"Anbernic RG35XX PLUS": {"device": "rg35xx-plus", "manufacturer": "Anbernic", "cfw": ["muOS", "Batocera"]},
"Anbernic RG35XX H": {"device": "rg35xx-h", "manufacturer": "Anbernic", "cfw": ["muOS", "Batocera"]},
"Anbernic RG35XX SP": {"device": "rg35xx-sp", "manufacturer": "Anbernic", "cfw": ["muOS", "Batocera"]},
"Anbernic RG351P/M": {"device": "rg351p", "manufacturer": "Anbernic", "cfw": ["ArkOS (Wummle)", "AmberELEC", "JELOS", "ROCKNIX"]},
"Anbernic RG351V": {"device": "rg351v", "manufacturer": "Anbernic", "cfw": ["ArkOS", "AmberELEC", "JELOS", "ROCKNIX"]},

Expand Down Expand Up @@ -148,7 +149,7 @@
"rk3588": {"capabilities": ["armhf", "aarch64"], "primary_arch": "aarch64"},
"h700-batocera": {"capabilities": ["aarch64"], "primary_arch": "aarch64"},
"h700-muos": {"capabilities": ["armhf", "aarch64"], "primary_arch": "aarch64"},
"h700": {"capabilities": ["armhf"], "primary_arch": "armhf"},
"h700": {"capabilities": ["armhf", "aarch64"], "primary_arch": "aarch64"},
"a133plus": {"capabilities": ["aarch64"], "primary_arch": "aarch64"},
"x86_64": {"capabilities": ["x86_64"], "primary_arch": "x86_64"},
"s922x": {"capabilities": ["aarch64"], "primary_arch": "aarch64"},
Expand Down
41 changes: 41 additions & 0 deletions PortMaster/pylibs/pugscene.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,17 @@
import gettext
import json
import os
import pathlib
import shutil
import subprocess

import sdl2
import sdl2.ext

import harbourmaster
import pySDL2gui

from pathlib import Path
from loguru import logger


Expand Down Expand Up @@ -557,6 +560,15 @@ def __init__(self, gui):
_("Ports Location: ") + (self.gui.hm.cfg_data.get('trimui-port-mode', 'roms') == 'roms' and _("Roms section") or _("Ports tab")),
description=_("Location where ports should be installed to."))

if self.gui.hm.device['name'] == 'muOS':
if '/mnt/sdcard' in subprocess.getoutput(['df']):
MUOS_MMC_TOGGLE = Path('/mnt/mmc/MUOS/PortMaster/config/muos_mmc_master_race.txt')

self.tags['option_list'].add_option(
'muos-port-mode-toggle',
_("Ports Location: ") + (MUOS_MMC_TOGGLE.is_file() and _("SD 1") or _("SD 2")),
description=_("Location where ports should be installed to."))

self.tags['option_list'].add_option(None, _("System"))

self.tags['option_list'].add_option(
Expand Down Expand Up @@ -844,6 +856,35 @@ def do_update(self, events):

self.gui.hm.platform.do_move_ports()

if selected_option == 'muos-port-mode-toggle':
if '/mnt/sdcard' in subprocess.getoutput(['df']):
MUOS_MMC_TOGGLE = Path('/mnt/mmc/MUOS/PortMaster/config/muos_mmc_master_race.txt')

language_map = {
True: _('SDCARD 1'),
False: _('SDCARD 2'),
}

if self.gui.message_box(
_("Are you sure you want to manage and install ports on {to_loc}?\n\nAlready installed ports will not be moved.\nPortMaster will restart for this to take effect.").format(
to_loc=language_map[(not MUOS_MMC_TOGGLE.is_file())]),
want_cancel=True):

self.gui.events.running = False

if MUOS_MMC_TOGGLE.is_file():
MUOS_MMC_TOGGLE.unlink()

else:
MUOS_MMC_TOGGLE.touch(0o644)

if not harbourmaster.HM_TESTING:
reboot_file = (harbourmaster.HM_TOOLS_DIR / "PortMaster" / ".pugwash-reboot")
if not reboot_file.is_file():
reboot_file.touch(0o644)

return True

if selected_option == 'runtime-manager':
self.gui.push_scene('runtime-manager', RuntimesScene(self.gui))
return True
Expand Down
8 changes: 4 additions & 4 deletions PortMaster/trimui/update.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash

LASTPWD="$PWD"
cd /mnt/SDCARD/

if [ -d "Data/ports" ]; then
if [ -d "/mnt/SDCARD/Data/ports" ]; then
exit 0
fi

LASTPWD="$PWD"
cd /mnt/SDCARD/

# Function to get the name of a directory with its original case sensitivity
directory_name() {
local dir="$1"
Expand Down

0 comments on commit 66d21ad

Please sign in to comment.