distribution/packages/apps/portmaster/scripts/start_portmaster.sh
2023-10-24 13:59:09 +00:00

56 lines
1.7 KiB
Bash

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2022-present - The JELOS Project (https://github.com/JustEnoughLinuxOS)
. /etc/profile
#Make sure PortMaster exists in .config/PortMaster
if [ ! -d "/storage/.config/PortMaster" ]; then
mkdir -p "/storage/.config/ports/PortMaster"
cp -r "/usr/config/PortMaster" "/storage/.config/"
fi
cd /storage/.config/PortMaster
#Grab the latest PortMaster.sh script
cp /usr/config/PortMaster/PortMaster.sh PortMaster.sh
cp /usr/config/PortMaster/control.txt control.txt
#Use our gamecontrollerdb.txt
rm gamecontrollerdb.txt
ln -sf /usr/config/SDL-GameControllerDB/gamecontrollerdb.txt gamecontrollerdb.txt
#Use our gptokeyb
rm gptokeyb
ln -sf /usr/bin/gptokeyb gptokeyb
cp /usr/config/PortMaster/portmaster.gptk portmaster.gptk
#Use our wget
ln -sf /usr/bin/wget wget
#Make sure roms/ports/PortMaster folder exists
if [ ! -d "/storage/roms/ports/PortMaster" ]; then
mkdir -p "/storage/roms/ports/PortMaster"
fi
#Make sure libs the folder exists
if [ ! -d "/storage/roms/ports/PortMaster/libs" ]; then
mkdir -p "/storage/roms/ports/PortMaster/libs"
fi
#Copy over required files for ports
cp /storage/.config/PortMaster/control.txt /storage/roms/ports/PortMaster/control.txt
cp /storage/.config/PortMaster/gptokeyb /storage/roms/ports/PortMaster/gptokeyb
cp /storage/.config/PortMaster/gamecontrollerdb.txt /storage/roms/ports/PortMaster/gamecontrollerdb.txt
cp /usr/bin/oga_controls* /storage/roms/ports/PortMaster/
#Delete and refrence to PortMaster.sh, we only want to use ours.
find /storage/roms/ports -type f -name "PortMaster.sh" -delete
#Start PortMaster
run ./PortMaster.sh 2>/dev/null
#Kill gptokeyb at exit
pkill -9 gptokeyb