distribution/packages/games/tools/jelosaddons/sources/autostart/common/012-jelosaddons
2022-07-11 12:33:01 -07:00

43 lines
1.3 KiB
Bash

#!/bin/sh
# SPDX-License-Identifier: Apache-2.0
# Copyright (C) 2022-present BrooksyTech (https://github.com/brooksytech)
#If JelosAddOns does not exist copy JelosAddOns folder to roms/ports
if [ ! -e "/storage/roms/ports/JelosAddOns" ]
then
cp -r /usr/share/JelosAddOns /storage/roms/ports
chmod +x /storage/roms/ports/JelosAddOns -R
mv /storage/roms/ports/JelosAddOns/JelosAddOns.sh /storage/roms/ports/JelosAddOns.sh
fi
#Check if gamelist.xml exists, if not create gamelist.xml to hide JelosAddOns by default.
if [[ ! -e /storage/roms/ports/gamelist.xml ]];
then
touch /storage/roms/ports/gamelist.xml
cat > /storage/roms/ports/gamelist.xml <<EOF
<?xml version="1.0"?>
<gameList>
<game>
<path>/storage/roms/ports/JelosAddOns.sh</path>
<name>JelosAddOns</name>
<hidden>true</hidden>
</game>
</gameList>
EOF
#If gamelist.xml exists and no JelosAddOns entry exists then add JelosAddOns entry & set to hidden.
else
if ! grep -R "JelosAddOns" "/storage/roms/ports/gamelist.xml"
then
sed -i 's|<gameList>|& \
<game>\
<path>/storage/roms/ports/JelosAddOns.sh</path>\
<name>JelosAddOns</name>\
<hidden>true</hidden>\
</game>|' /storage/roms/ports/gamelist.xml
fi
fi
mv /storage/roms/ports/JelosAddOns/JelosAddOns.sh /storage/roms/ports/JelosAddOns.sh
chmod +x /storage/roms/ports/JelosAddOns/JelosAddOns.sh
chmod +x /storage/roms/ports/JelosAddOns -R