Feature: Use overlayfs to merge internal and external storage into /storage/roms.
* Creates a new directory structure for games: * Internal Storage (or tf1): /storage/games-internal * External MicroSD: /storage/games-external * Combined Path: /storage/roms * Games copied to /storage/roms will be saved to /storage/games-internal. * Samba has been updated to present both volumes for network access. * EmulationStation now has an eject option under System Settings -> Hardware /Storage. * When a compatible microsd is inserted, JELOS will automatically add it to the overlay, making the content available to ES after a gamelist update or an ES restart. * Udevil will no longer mount microsd cards to /run/media, however it will still handle mounting all other external storage. * After the update, JELOS will automatically migrate your current roms directory once. * Additionally the hotkey management feature has moved from System Settings to Controller and Bluetooth Settings. * The rom split tool is now deprecated as it is no longer needed.
This commit is contained in:
parent
5dfbcfe170
commit
73b7b358e8
16 changed files with 86 additions and 90 deletions
|
@ -13,5 +13,5 @@ DEVICE_VOLUME="100"
|
|||
DEVICE_BATTERY_LED_STATUS="true"
|
||||
DEVICE_PWR_LED_GPIO="77"
|
||||
DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp"
|
||||
|
||||
DEVICE_MMC_EJECT="false"
|
||||
EOF
|
||||
|
|
|
@ -10,4 +10,5 @@ DEVICE_SW_HP_SWITCH="true"
|
|||
DEVICE_PLAYBACK_PATH_SPK="SPK"
|
||||
DEVICE_PLAYBACK_PATH_HP="HP"
|
||||
DEVICE_BRIGHTNESS="128"
|
||||
DEVICE_MMC_EJECT="false"
|
||||
EOF
|
||||
|
|
|
@ -14,5 +14,5 @@ DEVICE_VOLUME="100"
|
|||
DEVICE_BATTERY_LED_STATUS="true"
|
||||
DEVICE_PWR_LED_GPIO="77"
|
||||
DEVICE_TEMP_SENSOR="/sys/devices/virtual/thermal/thermal_zone0/temp"
|
||||
|
||||
DEVICE_MMC_EJECT="false"
|
||||
EOF
|
||||
|
|
|
@ -9,4 +9,5 @@ DEVICE_POWER_LED="false"
|
|||
DEVICE_PLAYBACK_PATH_SPK="SPK"
|
||||
DEVICE_PLAYBACK_PATH_HP="HP"
|
||||
DEVICE_BRIGHTNESS="128"
|
||||
DEVICE_MMC_EJECT="false"
|
||||
EOF
|
||||
|
|
|
@ -26,6 +26,7 @@ export SLOW_CORES \
|
|||
DEVICE_KEY_VOLUMEUP \
|
||||
DEVICE_LED_BRIGHTNESS \
|
||||
DEVICE_LED_CONTROL \
|
||||
DEVICE_MMC_EJECT \
|
||||
DEVICE_PIPEWIRE_PROFILE \
|
||||
DEVICE_PWR_LED_CONTROL \
|
||||
DEVICE_PWR_LED_GPIO \
|
||||
|
|
|
@ -73,6 +73,26 @@ sed -i 's~"pulse"~"alsathread"~g' /storage/.config/retroarch/retroarch.cfg
|
|||
### 20231114 - Update hosts.conf
|
||||
grep "127.0.0.1" /storage/.config/hosts.conf >/dev/null 2>&1 || cp /usr/config/hosts.conf /storage/.config/
|
||||
|
||||
### 20231127 - Migrate games to overlayfs
|
||||
systemctl stop storage-roms.mount
|
||||
GAMECOUNT=$(find /storage/roms -type f | wc -l)
|
||||
if [ "${GAMECOUNT}" -gt 20 ] && \
|
||||
[ ! -e "/storage/.migrated_games" ]
|
||||
then
|
||||
echo "Migrating games to overlayfs" >>${LOG}
|
||||
if [ -d "/storage/games-internal" ]
|
||||
then
|
||||
echo "Backing up games-internal" >>${LOG}
|
||||
mv /storage/games-internal /storage/games-internal.backup
|
||||
fi
|
||||
mv /storage/roms /storage/games-internal
|
||||
mkdir /storage/roms
|
||||
touch /storage/.migrated_games
|
||||
else
|
||||
echo "Game weight too low (${GAMECOUNT}) or content already migrated." >>${LOG}
|
||||
fi
|
||||
systemctl start storage-roms.mount
|
||||
|
||||
### Items below this line should not be removed.
|
||||
tocon "Update complete, rebooting..."
|
||||
reboot
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
UPDATE_ROOT="/storage/.update"
|
||||
MOUNT_GAMES=$(get_setting system.automount)
|
||||
GAMES_DEVICE=$(get_setting system.gamesdevice)
|
||||
MOUNT_PATH="/storage/games-external"
|
||||
|
||||
if [[ ! "${MOUNT_GAMES}" =~ [0-9] ]]
|
||||
then
|
||||
|
@ -38,17 +39,17 @@ mount_games() {
|
|||
umount /var/media/*
|
||||
log $0 "FSCK ${1}"
|
||||
fsck -Mly ${1}
|
||||
log $0 "Mounting ${1} on /storage/roms"
|
||||
/usr/bin/busybox mount ${1} /storage/roms >/dev/null 2>&1
|
||||
log $0 "Mounting ${1} on ${MOUNT_PATH}"
|
||||
/usr/bin/busybox mount ${1} ${MOUNT_PATH} >/dev/null 2>&1
|
||||
/usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/JELOS-system-dirs.conf >/dev/null 2>&1
|
||||
fi
|
||||
}
|
||||
|
||||
find_games() {
|
||||
if /usr/bin/busybox mountpoint -q /storage ; then
|
||||
if [ ! -d "/storage/roms" ]
|
||||
if [ ! -d "${MOUNT_PATH}" ]
|
||||
then
|
||||
/usr/bin/busybox mkdir -p /storage/roms >/dev/null 2>&1
|
||||
/usr/bin/busybox mkdir -p ${MOUNT_PATH} >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
for DEV in $(for dev in mmcblk[0-9] sd[a-z] nvme[0-9]; do blkid | grep ${dev} | awk 'BEGIN {FS=":"}; /ext4/ || /fat/ {print $1}' | sort -r; done)
|
||||
|
|
|
@ -1,76 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# rom_system_split: split your roms across your local and external storage
|
||||
|
||||
# prerequesites:
|
||||
# - local roms must be stored in "/storage/roms_local"
|
||||
# - external roms must be stored in "/storage/roms"
|
||||
# - you cannot spread the same system files across multiple locations
|
||||
# NOTE: if duplicate systems are found, local folders will take preference
|
||||
|
||||
LOCAL_FOLDER_NAME="roms_local"
|
||||
EXT_FOLDER_NAME="roms"
|
||||
|
||||
LOCAL_ROM_FOLDERS=$(
|
||||
ls -d ${LOCAL_FOLDER_NAME}/*/ |
|
||||
sed -e "s/${LOCAL_FOLDER_NAME}//g"
|
||||
)
|
||||
EXT_ROM_FOLDERS=$(
|
||||
ls -d ${EXT_FOLDER_NAME}/*/ |
|
||||
sed -e "s/${EXT_FOLDER_NAME}//g"
|
||||
)
|
||||
|
||||
ES_SYSTEMS="/storage/.emulationstation/es_systems.cfg"
|
||||
|
||||
ES_LIST=$(
|
||||
cat ${ES_SYSTEMS} |
|
||||
grep "<path>" |
|
||||
sed -e "s/<path>//g" -e "s/<\/path>//g" -e "s/\/storage\///g"
|
||||
)
|
||||
|
||||
|
||||
echo "LOCAL_FOLDER_NAME: ${LOCAL_FOLDER_NAME}"
|
||||
echo "EXT_FOLDER_NAME: ${EXT_FOLDER_NAME}"
|
||||
echo "EXT_STORAGE: ${EXT_STORAGE}"
|
||||
echo "EXTERNAL: ${EXTERNAL}"
|
||||
echo "LOCAL_ROM_FOLDERS: $LOCAL_ROM_FOLDERS{}"
|
||||
echo "EXT_ROM_FOLDERS: ${EXT_ROM_FOLDERS}"
|
||||
echo "ES_SYSTEMS: ${ES_SYSTEMS}"
|
||||
echo "ES_LIST: ${ES_LIST}"
|
||||
|
||||
|
||||
# required paramaters: local/external, rom folder list, es folder list
|
||||
update_es_folders() {
|
||||
folder_name=${LOCAL_FOLDER_NAME}
|
||||
orig_folder_name=${EXT_FOLDER_NAME}
|
||||
if [[ $1 == "external" ]]
|
||||
then
|
||||
folder_name=${EXT_FOLDER_NAME}
|
||||
orig_folder_name=${LOCAL_FOLDER_NAME}
|
||||
fi
|
||||
folder_array=( $2 )
|
||||
for folder in ${folder_array[@]}
|
||||
do
|
||||
system=${folder%?}
|
||||
# check that the system exists in ES
|
||||
if [[ $3 == *"${system}"* ]]
|
||||
then
|
||||
# skip if there are no files in the folder
|
||||
if [ -z "$(ls -A /storage/${folder_name}${system})" ]
|
||||
then
|
||||
continue
|
||||
fi
|
||||
# if the folder doesn't exist in ES, update the original
|
||||
if [[ $3 != *"${folder_name}${system}"* ]]
|
||||
then
|
||||
sed -i -e "s|<path>/storage/${orig_folder_name}${system}</path>|<path>/storage/${folder_name}${system}</path>|g" ${ES_SYSTEMS}
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# check the external folders first
|
||||
update_es_folders "external" "${EXT_ROM_FOLDERS}" "${ES_LIST}"
|
||||
# next check the local folders
|
||||
# if there are duplicate folders in EXTERNAL, LOCAL ones will take preference
|
||||
update_es_folders "local" "${LOCAL_ROM_FOLDERS}" "${ES_LIST}"
|
|
@ -55,8 +55,14 @@
|
|||
browseable = yes
|
||||
writeable = yes
|
||||
|
||||
[roms]
|
||||
path = /storage/roms
|
||||
[games-internal]
|
||||
path = /storage/games-internal
|
||||
available = yes
|
||||
browseable = yes
|
||||
writeable = yes
|
||||
|
||||
[games-external]
|
||||
path = /storage/games-external
|
||||
available = yes
|
||||
browseable = yes
|
||||
writeable = yes
|
||||
|
|
|
@ -119,7 +119,7 @@ allowed_media_dirs = /var/media, /media, /run/media/$USER
|
|||
# allowed_devices = /dev/*
|
||||
# WARNING: ALLOWING USERS TO MOUNT DEVICES OUTSIDE OF /dev CAN CAUSE SERIOUS
|
||||
# SECURITY PROBLEMS. DO NOT ALLOW DEVICES IN /dev/shm
|
||||
allowed_devices = /dev/*
|
||||
allowed_devices = /dev/sd* /dev/nvme*
|
||||
|
||||
|
||||
# allowed_internal_devices causes udevil to treat any listed block devices as
|
||||
|
|
|
@ -2,15 +2,15 @@
|
|||
IMPORT{cmdline}="installer"
|
||||
ENV{installer}=="1", GOTO="exit"
|
||||
|
||||
# check for blockdevices, /dev/sd*, /dev/sr* and /dev/mmc*
|
||||
SUBSYSTEM!="block", KERNEL!="sd*|sr*|mmc*", GOTO="exit"
|
||||
# check for blockdevices, /dev/sd*, /dev/sr*
|
||||
SUBSYSTEM!="block", KERNEL!="sd*|sr*", GOTO="exit"
|
||||
|
||||
# check for special partitions we dont want mount
|
||||
IMPORT{builtin}="blkid"
|
||||
ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit"
|
||||
|
||||
# /dev/sd* and /dev/mmc* ith partitions/disk and filesystems only and /dev/sr* disks only
|
||||
KERNEL=="sd*|mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
|
||||
# /dev/sd* with partitions/disk and filesystems only and /dev/sr* disks only
|
||||
KERNEL=="sd*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
|
||||
KERNEL=="sr*", ENV{DEVTYPE}=="disk", GOTO="optical"
|
||||
GOTO="exit"
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
||||
|
||||
PKG_NAME="emulationstation"
|
||||
PKG_VERSION="6c712ff"
|
||||
PKG_VERSION="0dffaea"
|
||||
PKG_GIT_CLONE_BRANCH="main"
|
||||
PKG_REV="1"
|
||||
PKG_ARCH="any"
|
||||
|
|
|
@ -1235,3 +1235,7 @@ makeinstall_target() {
|
|||
cp ${PKG_DIR}/autostart/* ${INSTALL}/usr/lib/autostart/common
|
||||
chmod 0755 ${INSTALL}/usr/lib/autostart/common/*
|
||||
}
|
||||
|
||||
post_install() {
|
||||
enable_service storage-roms.mount
|
||||
}
|
||||
|
|
14
packages/virtual/emulators/system.d/storage-roms.mount
Normal file
14
packages/virtual/emulators/system.d/storage-roms.mount
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Overlays directory
|
||||
After=systemd-tmpfiles-setup.service
|
||||
Before=jelos-automount.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Mount]
|
||||
What=none
|
||||
Where=/storage/roms
|
||||
Type=overlay
|
||||
Options=lowerdir=/storage/games-external,upperdir=/storage/games-internal,workdir=/storage/.tmp/games-workdir
|
||||
|
||||
[Install]
|
||||
WantedBy=jelos.target
|
|
@ -2,5 +2,8 @@
|
|||
# Copyright (C) 2021-present 351ELEC (https://github.com/351ELEC)
|
||||
# Copyright (C) 2023 JELOS (https://github.com/JustEnoughLinuxOS)
|
||||
|
||||
d /storage/.tmp/games-workdir 0777 root root - -
|
||||
d /storage/games-internal 0777 root root - -
|
||||
d /storage/games-external 0777 root root - -
|
||||
d /storage/roms 0777 root root - -
|
||||
d /tmp/cache 0777 root root - -
|
||||
|
|
21
packages/virtual/emulators/udev.d/99-automount.rules
Normal file
21
packages/virtual/emulators/udev.d/99-automount.rules
Normal file
|
@ -0,0 +1,21 @@
|
|||
# dont run in "installer" mode
|
||||
IMPORT{cmdline}="installer"
|
||||
ENV{installer}=="1", GOTO="exit"
|
||||
|
||||
SUBSYSTEM!="block", KERNEL!="mmc*", GOTO="exit"
|
||||
|
||||
# check for special partitions we dont want mount
|
||||
IMPORT{builtin}="blkid"
|
||||
ENV{ID_FS_LABEL}=="EFI|BOOT|Recovery|RECOVERY|SETTINGS|boot|root0|share0", GOTO="exit"
|
||||
|
||||
# /dev/mmc* partitions/disk and filesystems only
|
||||
KERNEL=="mmc*", ENV{DEVTYPE}=="partition|disk", ENV{ID_FS_USAGE}=="filesystem", GOTO="harddisk"
|
||||
GOTO="exit"
|
||||
|
||||
# mount or umount for hdds
|
||||
LABEL="harddisk"
|
||||
ACTION=="add", PROGRAM="/usr/bin/sh -c '/usr/bin/grep -E ^/dev/%k\ /proc/mounts || true'", RESULT=="", RUN+="/usr/bin/systemctl stop storage-roms.mount", RUN+="/usr/bin/systemctl restart jelos-automount.service", RUN+="/usr/bin/systemctl start storage-roms.mount"
|
||||
GOTO="exit"
|
||||
|
||||
# Exit
|
||||
LABEL="exit"
|
Loading…
Reference in a new issue