southoz / RetroOZ

RetroOZ Odroid Hardkernel Go Super and Powkiddy RGB 10 Max firmware
54 stars 6 forks source link

Openbor Symbolic Link Script #11

Closed southoz closed 3 years ago

southoz commented 3 years ago

Baco - https://forum.odroid.com/viewtopic.php?p=329727#p329727 A little optimization to launch OpenBOR games without the needed to copy it to the Packs folder. The script creates a link to the game.

The file is "/opt/openbor/openbor.sh"

#!/bin/sh

ROMNAME="$1"
BASEROMNAME="${ROMNAME##*/}"
OPENBOR_FOLDER="/opt/openbor"
LINK_FOR_PACK="$OPENBOR_FOLDER/Paks/$BASEROMNAME"
if [ ! -f "$LINK_FOR_PACK" ]; then
    ln -s "$ROMNAME" "$LINK_FOR_PACK"
fi

cd "$OPENBOR_FOLDER"
LD_LIBRARY_PATH=. ./OpenBOR
sudo rm -rf /opt/openbor/Paks/
sudo mkdir /opt/openbor/Paks/
sudo chown root:adm /opt/openbor/Paks
sudo chmod 775 /opt/openbor/Paks
JuanMiguelBG commented 3 years ago

Maybe a better script.

#!/bin/sh

ROMNAME="$1"
BASEROMNAME="${ROMNAME##*/}"
OPENBOR_FOLDER="/opt/openbor"
OPENBOR_PAKS_FOLDER="/opt/openbor/Paks"
LINK_FOR_PACK="$OPENBOR_PAKS_FOLDER/$BASEROMNAME"

# ensure a empty Packs folder
sudo rm -rf "$OPENBOR_PAKS_FOLDER"
sudo mkdir "$OPENBOR_PAKS_FOLDER"
sudo chown root:adm "$OPENBOR_PAKS_FOLDER"
sudo chmod 775 "$OPENBOR_PAKS_FOLDER"

ln -s "$ROMNAME" "$LINK_FOR_PACK"

cd "$OPENBOR_FOLDER"
LD_LIBRARY_PATH=. ./OpenBOR

# maybe innecesary
sudo rm -rf "$OPENBOR_PAKS_FOLDER"
sudo mkdir "$OPENBOR_PAKS_FOLDER"
sudo chown root:adm "$OPENBOR_PAKS_FOLDER"
sudo chmod 775 "$OPENBOR_PAKS_FOLDER"
southoz commented 3 years ago

The reason the entire folder is deleted recursively as people were running roms from Paks/ and they were not being deleted. Space on the Linux partition is an issue I am working through on the rebuild.