From d7202e2df68645185fd37a5e6201adc70c648143 Mon Sep 17 00:00:00 2001 From: Xargon Date: Wed, 18 May 2022 23:10:32 +0900 Subject: [PATCH 1/5] VERSIONING: added versioning and CLI parameters --- .github/workflows/cooker.yml | 16 ++++++------- net.retrodeck.retrodeck.yml | 10 +++++++- retrodeck.sh | 44 ++++++++++++++++++++++++++++++++---- 3 files changed, 57 insertions(+), 13 deletions(-) diff --git a/.github/workflows/cooker.yml b/.github/workflows/cooker.yml index 2a29289a..8e8812c9 100644 --- a/.github/workflows/cooker.yml +++ b/.github/workflows/cooker.yml @@ -108,19 +108,19 @@ jobs: sudo flatpak-builder --user --force-clean --repo=$GITHUB_WORKSPACE/local retrodeck-flatpak-cooker net.retrodeck.retrodeck.yml sudo flatpak build-bundle $GITHUB_WORKSPACE/local RetroDECK.flatpak net.retrodeck.retrodeck - - name: Get date for artifacts - id: date - run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M')" + # - name: Get date for artifacts + # id: date + # run: echo "::set-output name=date::$(date +'%Y%m%d_%H%M')" - - name: Extract branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch + # - name: Extract branch name + # shell: bash + # run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + # id: extract_branch - name: Publish the flatpak in a new cooker release uses: ncipollo/release-action@v1 with: - tag: "${{ steps.extract_branch.outputs.branch }}-${{ steps.date.outputs.date }}" + tag: "$(flatpak run net.retrodeck.retrodeck -v)" body: | # Release Notes (Cooker) This is a cooker snapshot based on the commit: ${{ github.event.repository.full_name }}@${{github.sha}}. diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 2b004530..199e96c9 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -60,6 +60,15 @@ cleanup-commands: modules: + - name: version-initialization + sources: + - type: shell + commands: + - mkdir -p ${FLATPAK_DEST}/retrodeck/ + - VERSION="cooker" # REMEMBER TO CHANGE THE VERSION BEFORE PUBLISHING (AND UPDATE THE APPDATA) + - if [ $VERSION == "cooker" ]; then VERSION=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')-$(date +'%Y%m%d_%H%M'); fi + - $VERSION >> ${FLATPAK_DEST}/retrodeck/version + - name: xmlstarlet config-opts: - --disable-static-libs @@ -963,7 +972,6 @@ modules: - rm -rf /app/share/emulationstation/resources/systems/unix/es_systems.xml - cp es_systems.xml /app/share/emulationstation/resources/systems/unix/ # These must be put in home folder, managed by retrodeck.sh - - mkdir -p ${FLATPAK_DEST}/retrodeck/ - cp es_settings.xml ${FLATPAK_DEST}/retrodeck/es_settings.xml # Logo, res diff --git a/retrodeck.sh b/retrodeck.sh index 5b00a034..a8416931 100755 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -3,15 +3,51 @@ # Steam Deck SD path: /run/media/mmcblk0p1 # Create log -exec 3>&1 4>&2 -trap 'exec 2>&4 1>&3' 0 1 2 3 -echo "$(date) : RetroDECK started" >&3 -exec 1>~/retrodeck/.retrodeck.log 2>&1 +# exec 3>&1 4>&2 +# trap 'exec 2>&4 1>&3' 0 1 2 3 +# echo "$(date) : RetroDECK started" >&3 +# exec 1>~/retrodeck/.retrodeck.log 2>&1 is_mounted() { mount | awk -v DIR="$1" '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}' } +for i in "$@"; do + case $i in + -h*|--help*) + echo "RetroDECK v"$(cat /var/config/retrodeck/version) + echo " + Usage: +flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS] + +Arguments: + -h, --help Print this help + -v, --version Print RetroDECK version + --reset Starts the initial RetroDECK installer (backup your data first!) + +For flatpak run specific options please run: flatpak run -h + +https://retrodeck.net +" + exit + ;; + --version*|-v*) + cat /var/config/retrodeck/version + exit + ;; + --reset) + rm -f ~/retrodeck/.lock + shift # past argument with no value + ;; + -*|--*) + echo "Unknown option $i" + exit 1 + ;; + *) + ;; + esac +done + # if we got the .lock file it means that it's not a first run if [ ! -f ~/retrodeck/.lock ] then From be386b190be0d1633f2b87449aecc7b63a167f74 Mon Sep 17 00:00:00 2001 From: Xargon Date: Wed, 18 May 2022 23:26:50 +0900 Subject: [PATCH 2/5] VERSIONING: ES-DE menu now reads the versiion from file --- net.retrodeck.retrodeck.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 199e96c9..748e0cff 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -147,7 +147,7 @@ modules: - type: shell commands: - sed -i 's/QUIT EMULATIONSTATION/QUIT RETRODECK/g' es-app/src/guis/GuiMenu.cpp - - sed -i 's/"EMULATIONSTATION-DE V" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/"RetroDECK v0.4.0b, ES-DE v" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/g' es-app/src/guis/GuiMenu.cpp + - sed -i 's/"EMULATIONSTATION-DE V" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/"RetroDECK v$(cat ${FLATPAK_DEST}/retrodeck/version), ES-DE v" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/g' es-app/src/guis/GuiMenu.cpp # ES-DE - END From 2eff0b66b05e2434d7a706474ef139708ac875c0 Mon Sep 17 00:00:00 2001 From: Xargon Date: Wed, 18 May 2022 23:43:19 +0900 Subject: [PATCH 3/5] VERSIONING: module version-initialization - fix1 --- net.retrodeck.retrodeck.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 748e0cff..bca58e52 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -61,6 +61,7 @@ cleanup-commands: modules: - name: version-initialization + buildsystem: simple sources: - type: shell commands: From af56a4c7345c147df7df6d276b91fb279ffb4b8c Mon Sep 17 00:00:00 2001 From: Xargon Date: Thu, 19 May 2022 12:03:43 +0900 Subject: [PATCH 4/5] VERSIONING: fixed module --- net.retrodeck.retrodeck.yml | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index bca58e52..9a236756 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -28,11 +28,11 @@ finish-args: - --talk-name=org.freedesktop.login1 - --filesystem=xdg-run/app/com.discordapp.Discord:create # Yuzu - - --filesystem=home:ro + # - --filesystem=home:ro # This may break Yuzu, let's see # - --filesystem=/run/media:ro # Dolphin - --allow=bluetooth - #- --env=QT_QPA_PLATFORM=xcb not sure if this will break something + #- --env=QT_QPA_PLATFORM=xcb #not sure if this will break something # rpcs3 - --socket=fallback-x11 @@ -60,15 +60,22 @@ cleanup-commands: modules: + # This module is used to define the RetroDECK version + # If the version is set as cooker it will automatically generate the version tag based on the date + # else it will just put what is written, "v" is not needed + # The version number is stored in /var/conf/retrodeck/version + # + # UPDATE STEPS FOR MAIN: + # [ ] Update the VERSION variable + # [ ] Update the appdata.xml with the version number and notes + # - name: version-initialization buildsystem: simple - sources: - - type: shell - commands: - - mkdir -p ${FLATPAK_DEST}/retrodeck/ - - VERSION="cooker" # REMEMBER TO CHANGE THE VERSION BEFORE PUBLISHING (AND UPDATE THE APPDATA) - - if [ $VERSION == "cooker" ]; then VERSION=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')-$(date +'%Y%m%d_%H%M'); fi - - $VERSION >> ${FLATPAK_DEST}/retrodeck/version + build-commands: + - mkdir -p ${FLATPAK_DEST}/retrodeck/ + - VERSION="cooker" + - if [ $VERSION == "cooker" ]; then VERSION=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/\1/')-$(date +'%Y%m%d_%H%M'); fi + - $VERSION >> ${FLATPAK_DEST}/retrodeck/version - name: xmlstarlet config-opts: @@ -1019,8 +1026,6 @@ modules: - mkdir -p ${FLATPAK_DEST}/share/appdata - cp net.retrodeck.retrodeck.appdata.xml ${FLATPAK_DEST}/share/appdata - - #cleanup: ['*'] sources: - type: file path: es_find_rules.xml From 1fc295666863e4d4cc9544870cfe042dd4beeebf Mon Sep 17 00:00:00 2001 From: Xargon Date: Thu, 19 May 2022 23:30:43 +0900 Subject: [PATCH 5/5] WRAPPER: complete rewrite, removed kdialog in favor of zenity --- net.retrodeck.retrodeck.yml | 11 +- retrodeck.sh | 391 +++++++++++++++++++++++------------- 2 files changed, 253 insertions(+), 149 deletions(-) mode change 100755 => 100644 retrodeck.sh diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 9a236756..3d75e032 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -94,13 +94,6 @@ modules: - ln -s "xml" "${FLATPAK_DEST}/bin/xmlstarlet" ||: cleanup: ["*"] - - name: kdialog - buildsystem: cmake-ninja - sources: - - type: git - url: https://github.com/KDE/kdialog.git - tag: v22.03.80 - # ES-DE - name: ffmpeg @@ -154,8 +147,8 @@ modules: branch: d89cedd25f1bbb9a38c1f66bca18b74d5332cad1 - type: shell commands: - - sed -i 's/QUIT EMULATIONSTATION/QUIT RETRODECK/g' es-app/src/guis/GuiMenu.cpp - - sed -i 's/"EMULATIONSTATION-DE V" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/"RetroDECK v$(cat ${FLATPAK_DEST}/retrodeck/version), ES-DE v" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/g' es-app/src/guis/GuiMenu.cpp + - sed -i "s/QUIT EMULATIONSTATION/QUIT RETRODECK/g" es-app/src/guis/GuiMenu.cpp + - sed -i "s/"EMULATIONSTATION-DE V" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/"RetroDECK v$(cat ${FLATPAK_DEST}/retrodeck/version), ES-DE v" + Utils::String::toUpper(PROGRAM_VERSION_STRING)/g" es-app/src/guis/GuiMenu.cpp # ES-DE - END diff --git a/retrodeck.sh b/retrodeck.sh old mode 100755 new mode 100644 index a8416931..80969825 --- a/retrodeck.sh +++ b/retrodeck.sh @@ -1,29 +1,237 @@ #!/bin/bash -# Steam Deck SD path: /run/media/mmcblk0p1 +lockfile="$HOME/retrodeck/.lock" # where the lockfile is located +version="$(cat /app/retrodeck/version)" # version info taken from the version file +rdhome="$HOME/retrodeck" # the retrodeck home, aka ~/retrodecck +emuconfigs="/app/retrodeck/emu-configs" # folder with all the default emulator configs +sdcard="/run/media/mmcblk0p1" # Steam Deck SD default path -# Create log -# exec 3>&1 4>&2 -# trap 'exec 2>&4 1>&3' 0 1 2 3 -# echo "$(date) : RetroDECK started" >&3 -# exec 1>~/retrodeck/.retrodeck.log 2>&1 +# Functions area + +dir_prep() { + # This script is creating a symlink preserving old folder contents and moving them in the new one + + # Call me with: + # dir prep "real dir" "symlink location" + real="$1" + symlink="$2" + + echo -e "\nDIR PREP: Moving $symlink in $real" #DEBUG + + # if the dest dir exists we want to backup it + if [ -d "$symlink" ]; + then + echo "$symlink found" #DEBUG + mv -fv "$symlink" "$symlink.old" + fi + + # if the real dir doesn't exist we create it + if [ ! -d "$real" ]; + then + echo "$real not found, creating it" #DEBUG + mkdir -pv "$real" + fi + + # creating the symlink + echo "linking $real in $symlink" #DEBUG + mkdir -pv "$symlink" # creating the full path... + previous_dir=$PWD + cd "$symlink" + cd .. + echo "We are in $PWD" #DEBUG + ls -ln #DEBUG + rmdir -v "$symlink" + ln -sv "$real" . + echo "We are in $PWD" #DEBUG + ls -ln #DEBUG + cd $previous_dir + + # moving everything from the old folder to the new one, delete the old one + if [ -d "$symlink.old" ]; + then + echo "Moving the data from $symlink.old to $real" #DEBUG + mv -fv "$symlink.old/*" "$real" + echo "Removing $symlink.old" #DEBUG + rm -rf "$symlink.old" + fi + + #DEBUG + previous_dir=$PWD + cd $real + cd .. + echo "We are in $PWD" #DEBUG + ls -ln + cd $previous_dir + #DEBUG + + echo $symlink is now $real +} is_mounted() { + # This script checks if the provided path in $1 is mounted mount | awk -v DIR="$1" '{if ($3 == DIR) { exit 0}} ENDFILE{exit -1}' } +tools_init() { + rm -rfv /var/config/retrodeck/tools/ + mkdir -pv /var/config/retrodeck/tools/ + cp -r /app/retrodeck/tools/* /var/config/retrodeck/tools/ + mkdir -pv /var/config/emulationstation/.emulationstation/custom_systems/tools/ + cp /app/retrodeck/tools-gamelist.xml /var/config/retrodeck/tools/gamelist.xml +} + +standalones_init() { + # This script is configuring the standalone emulators with the default files present in emuconfigs folder + + echo "Initializing standalone emulators" + + # Yuzu + # removing dead symlinks as they were present in a past version + if [ -d $rdhome/bios/switch ]; then + find $rdhome/bios/switch -xtype l -exec rm {} \; + fi + # initializing the keys folder + dir_prep "$rdhome/bios/switch/keys" "/var/data/yuzu/keys" + # initializing the firmware folder + dir_prep "$rdhome/bios/switch/registered" "/var/data/yuzu/nand/system/Contents/registered/" + # configuring Yuzu + mkdir -pv /var/config/yuzu/ + cp -fv $emuconfigs/yuzu-qt-config.ini /var/config/yuzu/qt-config.ini + + # Dolphin + mkdir -pv /var/config/dolphin-emu/ + cp -fv $emuconfigs/Dolphin.ini /var/config/dolphin-emu/ + + # pcsx2 + mkdir -pv /var/config/PCSX2/inis/ + cp -fv $emuconfigs/PCSX2_ui.ini /var/config/PCSX2/inis/ + + # MelonDS + mkdir -pv /var/config/melonDS/ + dir_prep "$rdhome/bios" "/var/config/melonDS/bios" + cp -fv $emuconfigs/melonDS.ini /var/config/melonDS/ + + # CITRA + mkdir -pv /var/config/citra-emu/ + cp -fv $emuconfigs/citra-qt-config.ini /var/config/citra-emu/qt-config.ini + + # RPCS3 + mkdir -pv /var/config/rpcs3/ + cp -fv $emuconfigs/config.yml /var/config/rpcs3/ + + # PICO-8 + mkdir -pv $roms_folder/pico-8 + +} + +ra_init() { + dir_prep "$rdhome/bios" "/var/config/retroarch/system" + mkdir -pv /var/config/retroarch/cores/ + cp /app/share/libretro/cores/* /var/config/retroarch/cores/ + cp -f $emuconfigs/retroarch.cfg /var/config/retroarch/ + #rm -rf $rdhome/bios/bios # in some situations a double bios symlink is created +} + +create_lock() { + # creating RetroDECK's lock file and writing the version number in it + echo "$version" > "$lockfile" +} + +post_update() { + # post update script + echo "Executing post-update script" + + # Doing the dir prep as we don know from which version we came + dir_prep "$rdhome/.downloaded_media" "/var/config/emulationstation/.emulationstation/downloaded_media" + dir_prep "$rdhome/.themes" "/var/config/emulationstation/.emulationstation/themes" + ra_init + standalones_init + tools_init + + create_lock +} + +start_retrodeck() { + # normal startup + echo "Starting RetroDECK v$version" + emulationstation --home /var/config/emulationstation +} + +finit() { + # Force/First init, depending on the situation + + echo "Executing finit" + + # Internal or SD Card? + zenity --question --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --ok-label "Internal" --cancel-label "SD Card" --text="Welcome to the first configuration of RetroDECK.\nThe setup will be quick but please READ CAREFULLY each message in order to avoid misconfigurations.\n\nWhere do you want your roms folder to be located?" + if [ $? == 0 ] #yes - Internal + then + roms_folder="$rdhome/roms" + else #no - SD Card + if [ is_mounted "$sdcard" ]; + then + roms_folder="$sdcard/retrodeck/roms" + else + zenity --error --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="SD Card is not readable.\nPlease check if it's inserted or mounted correctly and run RetroDECK again." + exit 0 + fi + fi + + mkdir -pv $roms_folder + + # TODO: after the next update of ES-DE this will not be needed + zenity --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="EmulationStation will now initialize the system.\nPlease DON'T EDIT THE ROMS LOCATION, just select:\n\nCREATE DIRECTORIES\nYES\nOK\nQUIT\n\nRetroDECK will manage the rest." + + # Recreating the folder + /var/config/retrodeck/tools/ + mkdir -pv /var/config/emulationstation/ + # Initializing ES-DE + # TODO: after the next update of ES-DE this will not be needed + start_retrodeck + + zenity --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="RetroDECK will now install the needed files.\nPlease wait up to one minute,\nanother message will notify when the process will be finished.\n\nPress OK to continue." + + # Initializing ROMs folder - Original in retrodeck home (or SD Card) + dir_prep $roms_folder "/var/config/emulationstation/ROMs" + + mkdir -pv $rdhome/saves + mkdir -pv $rdhome/states + mkdir -pv $rdhome/screenshots + mkdir -pv $rdhome/bios/pico-8 + + # XMLSTARLET HERE + cp -f /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml + + # ES-DE preparing themes and scraped folders + dir_prep "$rdhome/.downloaded_media" "/var/config/emulationstation/.emulationstation/downloaded_media" + dir_prep "$rdhome/.themes" "/var/config/emulationstation/.emulationstation/themes" + + ra_init + standalones_init + tools_init + create_lock + + zenity --info --no-wrap --window-icon="/app/share/icons/hicolor/scalable/apps/net.retrodeck.retrodeck.svg" --title "RetroDECK" --text="Initialization completed.\nplease put your roms in:\n\n$roms_folder\n\nand your bioses in\n\n$rdhome/bios\n\nThen start the program again.\nIf you wish to change the roms location, you may use the tool located the tools section of RetroDECK.\n\nIt's suggested to add RetroDECK to your Steam Library for a quick access." + # TODO: Replace the stuff above with BoilR code when ready +} + +# Arguments section + for i in "$@"; do case $i in -h*|--help*) - echo "RetroDECK v"$(cat /var/config/retrodeck/version) + echo "RetroDECK v""$(cat /var/config/retrodeck/version)" echo " Usage: flatpak run [FLATPAK-RUN-OPTION] net.retrodeck-retrodeck [ARGUMENTS] Arguments: - -h, --help Print this help - -v, --version Print RetroDECK version - --reset Starts the initial RetroDECK installer (backup your data first!) + -h, --help Print this help + -v, --version Print RetroDECK version + --reset Starts the initial RetroDECK installer (backup your data first!) + --reset-ra Resets RetroArch's config to the default values + --reset-sa Reset standalone emulator configs to the default values + --reset-tools Recreate the tools section For flatpak run specific options please run: flatpak run -h @@ -35,8 +243,20 @@ https://retrodeck.net cat /var/config/retrodeck/version exit ;; - --reset) - rm -f ~/retrodeck/.lock + --reset*) + rm -f "$lockfile" + shift # past argument with no value + ;; + --reset-ra*) + ra_init + shift # past argument with no value + ;; + --reset-sa*) + standalones_init + shift # past argument with no value + ;; + --reset-tools*) + tools_init shift # past argument with no value ;; -*|--*) @@ -48,133 +268,24 @@ https://retrodeck.net esac done -# if we got the .lock file it means that it's not a first run -if [ ! -f ~/retrodeck/.lock ] +# UPDATE TRIGGERED +# if lockfile exists but the version doesn't match +if [ -f "$lockfile" ] && [ "$(cat "$lockfile")" != "$version" ]; then - kdialog --title "RetroDECK" --yes-label "Yes" --no-label "Quit" --yesno "Welcome to the first configuration of RetroDECK.\n\nBefore starting, are you in Desktop Mode?\nIf not the program will quit as the first setup MUST be done in Desktop Mode." - if [ $? == 1 ] #quit - then - exit 0 - fi - kdialog --title "RetroDECK" --yes-label "Internal" --no-label "SD Card" --yesno "Where do you want your roms folder to be located?" - if [ $? == 0 ] #yes - Internal - then - roms_folder=~/retrodeck/roms - else #no - SD Card - if is_mounted "/run/media/mmcblk0p1" - then - roms_folder=/run/media/mmcblk0p1/retrodeck/roms - else - kdialog --title "RetroDECK" --error "SD Card is not readable, please check if it inserted or mounted correctly and run RetroDECK again." - exit 0 - fi - fi - - mkdir -p $roms_folder - - # initializing ES-DE - - mkdir -p /var/config/retrodeck/tools - - # Cleaning - rm -rf /var/config/emulationstation/ - rm /var/config/retrodeck/tools/* - rm -f /var/config/yuzu/qt-config.ini - - kdialog --title "RetroDECK" --msgbox "EmulationStation will now initialize the system, please don't edit the roms location, just select:\n\nCREATE DIRECTORIES, YES, QUIT\n\nRetroDECK will manage the rest." - - mkdir -p /var/config/emulationstation/ - - emulationstation --home /var/config/emulationstation - - kdialog --title "RetroDECK" --msgbox "RetroDECK will now install the needed files, please wait one minute, another message will notify when the process will be finished.\n\nPress OK to continue." - - # Initializing ROMs folder - Original in ~/retrodeck (or SD Card) - mv -f /var/config/emulationstation/ROMs /var/config/emulationstation/ROMs.bak - ln -s $roms_folder /var/config/emulationstation/ROMs - mv -f /var/config/emulationstation/ROMs.bak/* $roms_folder/ - rm -rf /var/config/emulationstation/ROMs.bak - - # XMLSTARLET HERE - cp /app/retrodeck/es_settings.xml /var/config/emulationstation/.emulationstation/es_settings.xml - - mkdir -p ~/retrodeck/saves - mkdir -p ~/retrodeck/states - mkdir -p ~/retrodeck/screenshots - mkdir -p ~/retrodeck/bios/pico-8 - - # TODO: write a function for these stuff below - - # ES-DE - cp -r /app/retrodeck/tools/* /var/config/retrodeck/tools/ - mkdir -p /var/config/emulationstation/.emulationstation/custom_systems/tools/ - cp /app/retrodeck/tools-gamelist.xml /var/config/retrodeck/tools/gamelist.xml - # ES-DE scraped folder - Original in ~/retrodeck - mv -f /var/config/emulationstation/.emulationstation/downloaded_media /var/config/emulationstation/.emulationstation/downloaded_media.old - mkdir ~/retrodeck/.downloaded_media - ln -s ~/retrodeck/.downloaded_media /var/config/emulationstation/.emulationstation/downloaded_media - mv -f /var/config/emulationstation/.emulationstation/downloaded_media.old/* ~/retrodeck/.downloaded_media - rm -rf /var/config/emulationstation/.emulationstation/downloaded_media.old - # ES-DE themes folder - Original in ~/retrodeck - mv -f /var/config/emulationstation/.emulationstation/themes /var/config/emulationstation/.emulationstation/themes.old - mkdir ~/retrodeck/.themes - ln -s ~/retrodeck/.themes /var/config/emulationstation/.emulationstation/themes - mv -f /var/config/emulationstation/.emulationstation/themes.old/* ~/retrodeck/.themes - rm -rf /var/config/emulationstation/.emulationstation/themes.old - - # Initializing emulators configs - emuconfigs=/app/retrodeck/emu-configs/ - - # RetroArch - mkdir -p /var/config/retroarch/cores/ - rm -rf /var/config/retroarch/system - ln -s ~/retrodeck/bios /var/config/retroarch/system - cp /app/share/libretro/cores/* /var/config/retroarch/cores/ - cp $emuconfigs/retroarch.cfg /var/config/retroarch/ - rm -f ~/retrodeck/bios/bios # in some situations a double bios link is created - - # Yuzu - find ~/retrodeck/bios/switch -xtype l -exec rm {} \; # removing dead symlinks - # initializing the keys folder - mkdir -p ~/retrodeck/bios/switch/keys - rm -rf /var/data/yuzu/keys - ln -s ~/retrodeck/bios/switch/keys /var/data/yuzu/keys - # initializing the firmware folder - mkdir -p ~/retrodeck/bios/switch/registered - rm -rf /var/data/yuzu/nand/system/Contents/registered/ - ln -s ~/retrodeck/bios/switch/registered /var/data/yuzu/nand/system/Contents/registered/ - # configuring Yuzu - cp $emuconfigs/yuzu-qt-config.ini /var/config/yuzu/qt-config.ini - - # Dolphin - mkdir -p /var/config/dolphin-emu/ - cp $emuconfigs/Dolphin.ini /var/config/dolphin-emu/ - - # pcsx2 - mkdir -p /var/config/PCSX2/inis/ - cp $emuconfigs/PCSX2_ui.ini /var/config/PCSX2/inis/ - - # MelonDS - mkdir -p /var/config/melonDS/ - ln -s ~/retrodeck/bios /var/config/melonDS/bios - cp $emuconfigs/melonDS.ini /var/config/melonDS/ - - # CITRA - mkdir -p /var/config/citra-emu/ - cp $emuconfigs/citra-qt-config.ini /var/config/citra-emu/qt-config.ini - - # RPCS3 - mkdir -p /var/config/rpcs3/ - cp $emuconfigs/config.yml /var/config/rpcs3/ - - # PICO-8 - mkdir -p $roms_folder/pico-8 - - - # Locking RetroDECK - touch ~/retrodeck/.lock - - kdialog --title "RetroDECK" --msgbox "Initialization completed.\nplease put your roms in:\n\n$roms_folder\n\nand your bioses in\n\n~/retrodeck/bios\n\nThen start the program again.\nIf you wish to change the roms location, you may use the tool located the tools section of RetroDECK.\n\nIt's suggested to add RetroDECK to your Steam Library for a quick access." -else - emulationstation --home /var/config/emulationstation + echo "Lockfile version is "$(cat "$lockfile")" but the actual version is $version" + post_update + start_retrodeck + exit 0 fi + +# LOCKFILE REMOVED +# if the lock file doesn't exist at all means that it's a fresh install or a triggered reset +if [ ! -f "$lockfile" ]; +then + echo "Lockfile not found" + finit + exit 0 +fi + +# Normal Startup +start_retrodeck \ No newline at end of file