From c30432f824971a2ad1cbb76f86232197e813081b Mon Sep 17 00:00:00 2001 From: fewtarius Date: Fri, 14 Oct 2022 16:51:45 -0400 Subject: [PATCH] Move automount to a systemd service so dependencies are managed correctly. --- .github/workflows/build-dev.yaml | 2 ++ .github/workflows/build-main.yaml | 2 ++ README.md | 1 + .../sources/autostart/common/011-portmaster | 1 - packages/jelos/package.mk | 2 ++ packages/jelos/sources/post-update | 6 ++++++ .../common/003-mount_games => scripts/automount} | 12 +++++------- packages/jelos/system.d/jelos-automount.service | 13 +++++++++++++ .../sysutils/jslisten}/system.d/jslisten.service | 0 .../sysutils/jslisten}/system.d/jslisten.target | 0 packages/ui/emulationstation/sources/es_settings | 5 ----- packages/ui/emulationstation/sources/start_es.sh | 5 ----- 12 files changed, 31 insertions(+), 18 deletions(-) rename packages/jelos/sources/{autostart/common/003-mount_games => scripts/automount} (87%) create mode 100644 packages/jelos/system.d/jelos-automount.service rename packages/{jelos => tools/sysutils/jslisten}/system.d/jslisten.service (100%) rename packages/{jelos => tools/sysutils/jslisten}/system.d/jslisten.target (100%) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index d0000edfe..cef75d09c 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -102,6 +102,8 @@ jobs: Download: [[Win600/x86_64](https://github.com/JustEnoughLinuxOS/distribution-dev/releases/download/JELOS-handheld.x86_64-${{ steps.version.outputs.version }}.img.gz)] [[RG353V/RG353P](https://github.com/JustEnoughLinuxOS/distribution-dev/releases/download/JELOS-RG353P.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG503](https://github.com/JustEnoughLinuxOS/distribution-dev/releases/download/JELOS-RG503.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG552](https://github.com/JustEnoughLinuxOS/distribution-dev/releases/download/JELOS-RG552.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG351P](https://github.com/JustEnoughLinuxOS/distribution-dev/releases/download/JELOS-RG351P.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG351V](https://github.com/JustEnoughLinuxOS/distribution-dev/releases/download/JELOS-RG351V.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG351MP](https://github.com/JustEnoughLinuxOS/distribution-dev/releases/download/JELOS-RG351MP.aarch64-${{ steps.version.outputs.version }}.img.gz)] + > RG353V users, enable "DEVICE IS RG353V" in the system settings menu after flashing. + ## Upgrading * Download and install the update online via the System Settings menu. * If you are unable to update online diff --git a/.github/workflows/build-main.yaml b/.github/workflows/build-main.yaml index a54bf1403..2ada6b635 100644 --- a/.github/workflows/build-main.yaml +++ b/.github/workflows/build-main.yaml @@ -99,6 +99,8 @@ jobs: Download: [[Win600/x86_64](https://github.com/JustEnoughLinuxOS/distribution/releases/download/${{ steps.version.outputs.version }}/JELOS-handheld.x86_64-${{ steps.version.outputs.version }}.img.gz)] [[RG353V/RG353P](https://github.com/JustEnoughLinuxOS/distribution/releases/download/${{ steps.version.outputs.version }}/JELOS-RG353P.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG503](https://github.com/JustEnoughLinuxOS/distribution/releases/download/${{ steps.version.outputs.version }}/JELOS-RG503.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG552](https://github.com/JustEnoughLinuxOS/distribution/releases/download/${{ steps.version.outputs.version }}/JELOS-RG552.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG351P](https://github.com/JustEnoughLinuxOS/distribution/releases/download/${{ steps.version.outputs.version }}/JELOS-RG351P.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG351V](https://github.com/JustEnoughLinuxOS/distribution/releases/download/${{ steps.version.outputs.version }}/JELOS-RG351V.aarch64-${{ steps.version.outputs.version }}.img.gz)] [[RG351MP](https://github.com/JustEnoughLinuxOS/distribution/releases/download/${{ steps.version.outputs.version }}/JELOS-RG351MP.aarch64-${{ steps.version.outputs.version }}.img.gz)] + > RG353V users, enable "DEVICE IS RG353V" in the system settings menu after flashing. + ## Upgrading * Download and install the update online via the System Settings menu. ## Upgrading diff --git a/README.md b/README.md index 8e6e49ac1..7628be57d 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ limitations under the License. ## Installation * x86_64 versions of JELOS include an installation tool. This tool may be run from the boot menu or from within JELOS by switching to desktop mode and running "installer" in a terminal. +* RG353V users should use the RG353P image, and select "DEVICE IS RG353V" from the system settings menu in EmulationStation. ## Upgrading * Download and install the update online via the System Settings menu. diff --git a/packages/games/tools/portmaster/sources/autostart/common/011-portmaster b/packages/games/tools/portmaster/sources/autostart/common/011-portmaster index 6818c9921..5a4848058 100755 --- a/packages/games/tools/portmaster/sources/autostart/common/011-portmaster +++ b/packages/games/tools/portmaster/sources/autostart/common/011-portmaster @@ -3,7 +3,6 @@ # Copyright (C) 2021-present Fewtarius (https://github.com/fewtarius) # Copyright (C) 2022-present BrooksyTech (https://github.com/brooksytech) - if [ ! -d "/storage/roms/ports/PortMaster" ] then mkdir -p /storage/roms/ports/PortMaster diff --git a/packages/jelos/package.mk b/packages/jelos/package.mk index e59f0c990..35099d54d 100644 --- a/packages/jelos/package.mk +++ b/packages/jelos/package.mk @@ -125,6 +125,7 @@ post_install() { EOF cp ${PKG_DIR}/sources/scripts/* ${INSTALL}/usr/bin + enable_service jelos-automount.service if [ -d "${PKG_DIR}/sources/asound/${DEVICE}" ] then @@ -171,4 +172,5 @@ EOF then sed -i "s#ssh.enabled=0#ssh.enabled=1#g" ${INSTALL}/usr/config/system/configs/system.cfg fi + } diff --git a/packages/jelos/sources/post-update b/packages/jelos/sources/post-update index ce160ac79..750901c43 100644 --- a/packages/jelos/sources/post-update +++ b/packages/jelos/sources/post-update @@ -117,3 +117,9 @@ if [ ! -e "/storage/.config/smb.conf" ] then cp -f /usr/config/smb.conf /storage/.config fi + +# Merge alsa configs on 353P/V +if [[ "${HW_DEVICE}" =~ RG353P ]] +then + cp /usr/config/asound.conf /storage/.config +fi diff --git a/packages/jelos/sources/autostart/common/003-mount_games b/packages/jelos/sources/scripts/automount similarity index 87% rename from packages/jelos/sources/autostart/common/003-mount_games rename to packages/jelos/sources/scripts/automount index 047bef261..49e87b8c9 100755 --- a/packages/jelos/sources/autostart/common/003-mount_games +++ b/packages/jelos/sources/scripts/automount @@ -9,14 +9,11 @@ UPDATE_ROOT="/storage/.update" MOUNT_GAMES=$(get_setting system.automount) GAMES_DEVICE=$(get_setting system.gamesdevice) -touch /storage/.mounting - if [[ ! "${MOUNT_GAMES}" =~ [0-9] ]] then set_setting system.automount 1 elif [[ "${MOUNT_GAMES}" == "0" ]] then - rm /storage/.mounting exit 0 fi @@ -26,6 +23,7 @@ mount_games() { [ -e "${1}" ] && \ [ ! -e "/storage/.please_resize_me" ] then + echo "Mounting ${1} on /storage/roms" mount ${1} /storage/roms >/dev/null 2>&1 /usr/bin/systemd-tmpfiles --create /usr/lib/tmpfiles.d/jelos-dirs.conf >/dev/null 2>&1 fi @@ -41,14 +39,16 @@ find_games() { for DEV in $(blkid | awk 'BEGIN {FS=":"}; /ext4/ || /fat/ {print $1}' | sort -r) do ROOTDEV=$(echo ${DEV} | sed -e "s#^/.*/##g" -e "s#p[0-9].*\$##g") - SIZE=$(awk '/'${ROOTDEV}'/ {print $3}' /proc/partitions) - if [ "${SIZE}" -le "8388608" ] + SIZE=$(awk '/'${ROOTDEV}'$/ {print $3}' /proc/partitions) + if (( ${SIZE} <= 8388608 )) then + echo "Device ${ROOTDEV} is too small, ignoring." # We don't want to mount partitions smaller than ~8GB. continue fi if [ -L "/sys/class/block/${ROOTDEV}boot0" ] then + echo "Device ${ROOTDEV} might be Android, ignoring." # Assume this is an android boot device and ignore it. continue fi @@ -72,5 +72,3 @@ then else find_games fi -i -rm /storage/.mounting diff --git a/packages/jelos/system.d/jelos-automount.service b/packages/jelos/system.d/jelos-automount.service new file mode 100644 index 000000000..b3b1b7e2e --- /dev/null +++ b/packages/jelos/system.d/jelos-automount.service @@ -0,0 +1,13 @@ +[Unit] +Description=JELOS user autostart script +Before=autostart.service +After=systemd-tmpfiles-setup.service + +[Service] +Type=oneshot +Environment=HOME=/storage +ExecStart=-/bin/sh -c ". /etc/profile; exec /bin/sh /usr/bin/automount" +RemainAfterExit=yes + +[Install] +WantedBy=jelos.target diff --git a/packages/jelos/system.d/jslisten.service b/packages/tools/sysutils/jslisten/system.d/jslisten.service similarity index 100% rename from packages/jelos/system.d/jslisten.service rename to packages/tools/sysutils/jslisten/system.d/jslisten.service diff --git a/packages/jelos/system.d/jslisten.target b/packages/tools/sysutils/jslisten/system.d/jslisten.target similarity index 100% rename from packages/jelos/system.d/jslisten.target rename to packages/tools/sysutils/jslisten/system.d/jslisten.target diff --git a/packages/ui/emulationstation/sources/es_settings b/packages/ui/emulationstation/sources/es_settings index 9ec98f7fc..81c5699d2 100755 --- a/packages/ui/emulationstation/sources/es_settings +++ b/packages/ui/emulationstation/sources/es_settings @@ -9,11 +9,6 @@ set_audio alsa export SDL_AUDIODRIVER=alsa -while [ -e "/storage/.mounting" ] -do - sleep .5 -done - TZ=$(get_setting system.timezone) echo -n "TIMEZONE=${TZ}" > /storage/.cache/timezone echo -n "${TZ}" >/storage/.cache/system_timezone diff --git a/packages/ui/emulationstation/sources/start_es.sh b/packages/ui/emulationstation/sources/start_es.sh index 0d9a4c65e..fca77d0d3 100755 --- a/packages/ui/emulationstation/sources/start_es.sh +++ b/packages/ui/emulationstation/sources/start_es.sh @@ -9,11 +9,6 @@ set_audio alsa export SDL_AUDIODRIVER=alsa -while [ -e "/storage/.mounting" ] -do - sleep .5 -done - TZ=$(get_setting system.timezone) echo -n "TIMEZONE=${TZ}" > /storage/.cache/timezone echo -n "${TZ}" >/storage/.cache/system_timezone