Merge pull request #501 from fewtarius/dev
Add new mechanism to stop and start the UI for console apps.
This commit is contained in:
commit
53551c59f4
11 changed files with 75 additions and 53 deletions
|
@ -13,6 +13,8 @@ source /usr/bin/env.sh
|
|||
source /etc/profile
|
||||
rp_registerAllModules
|
||||
|
||||
stop_ui
|
||||
|
||||
joy2keyStart
|
||||
clear >/dev/console
|
||||
|
||||
|
@ -68,5 +70,5 @@ do
|
|||
done
|
||||
echo "Restarting EmulationStation...\n" >/dev/console
|
||||
echo "Restarting EmulationStation..." >> /tmp/logs/dosbox_scan.log
|
||||
systemctl restart ${UI_SERVICE}
|
||||
start_ui
|
||||
clear >/dev/console
|
||||
|
|
|
@ -25,6 +25,7 @@ SUPPORTED_GRP=(
|
|||
"PLATOONL.DAT"
|
||||
)
|
||||
|
||||
stop_ui
|
||||
clear >/dev/console
|
||||
echo "Scanning for games..." >/dev/console
|
||||
find_names=()
|
||||
|
@ -63,5 +64,5 @@ while read -r grp_file; do
|
|||
-- end --
|
||||
EOM
|
||||
done <<<"${grp_files}"
|
||||
systemctl restart ${UI_SERVICE}
|
||||
clear >/dev/console
|
||||
start_ui
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
# Copyright (C) 2020-present Fewtarius
|
||||
|
||||
. /etc/profile
|
||||
|
||||
stop_ui
|
||||
clear >/dev/console
|
||||
echo "Scanning for games..." >/dev/console
|
||||
bash /usr/bin/start_scummvm.sh add >/dev/console
|
||||
echo "Adding games..." >/dev/console
|
||||
bash /usr/bin/start_scummvm.sh create >/dev/console
|
||||
systemctl restart ${UI_SERVICE}
|
||||
clear >/dev/console
|
||||
start_ui
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
QUAKEPATH="/storage/roms/quake"
|
||||
|
||||
stop_ui
|
||||
clear >/dev/console
|
||||
echo "Scanning for games..." >/dev/console
|
||||
pak_files=$(find "${QUAKEPATH}" -mindepth 1 -type f -iname pak0.pak)
|
||||
|
@ -30,5 +31,5 @@ while read -r pak_file; do
|
|||
-- end --
|
||||
EOM
|
||||
done <<<"${pak_files}"
|
||||
systemctl restart ${UI_SERVICE}
|
||||
start_ui
|
||||
clear >/dev/console
|
||||
|
|
|
@ -4,15 +4,13 @@
|
|||
|
||||
. /etc/os-release
|
||||
|
||||
export PATH="$PATH:/usr/local/bin:/usr/bin:/storage/bin"
|
||||
export PATH="/usr/bin:/usr/local/bin:/storage/bin:${PATH}"
|
||||
export SDL_GAMECONTROLLERCONFIG_FILE="/storage/.config/SDL-GameControllerDB/gamecontrollerdb.txt"
|
||||
|
||||
J_DIR="/storage/.config/system"
|
||||
J_CONF="${J_DIR}/configs/system.cfg"
|
||||
ES_CONF="/storage/.emulationstation/es_settings.cfg"
|
||||
EE_DEVICE=${HW_DEVICE}
|
||||
|
||||
JSLISTENCONF="/storage/.config/system/configs/jslisten.cfg"
|
||||
JSLISTENCONF="${J_DIR}/configs/jslisten.cfg"
|
||||
|
||||
get_setting() {
|
||||
if [ ! -z "${3}" ]
|
||||
|
@ -62,42 +60,40 @@ set_audio() {
|
|||
}
|
||||
|
||||
get_es_setting() {
|
||||
echo $(sed -n "s|\s*<${1} name=\"${2}\" value=\"\(.*\)\" />|\1|p" ${ES_CONF})
|
||||
echo $(sed -n "s|\s*<${1} name=\"${2}\" value=\"\(.*\)\" />|\1|p" ${ES_CONF})
|
||||
}
|
||||
|
||||
check_bios() {
|
||||
PLATFORM="${1}"
|
||||
CORE="${2}"
|
||||
EMULATOR="${3}"
|
||||
ROMNAME="${4}"
|
||||
LOG="${5}"
|
||||
|
||||
PLATFORM="${1}"
|
||||
CORE="${2}"
|
||||
EMULATOR="${3}"
|
||||
ROMNAME="${4}"
|
||||
LOG="${5}"
|
||||
if [[ -z "$LOG" ]]; then
|
||||
LOG="/var/log/exec.log"
|
||||
cat /etc/motd > "$LOG"
|
||||
fi
|
||||
|
||||
if [[ -z "$LOG" ]]; then
|
||||
LOG="/var/log/exec.log"
|
||||
cat /etc/motd > "$LOG"
|
||||
fi
|
||||
MISSINGBIOS="$(batocera-systems --strictfilter ${PLATFORM})"
|
||||
if [ "$?" == "2" ]; then
|
||||
# formating so it looks nice :)
|
||||
PLATFORMNAME="${MISSINGBIOS##*>}" # read from -P onwards
|
||||
PLATFORMNAME="${PLATFORMNAME%%MISSING*}" # until a space is found
|
||||
PLATFORMNAME=$(echo $PLATFORMNAME | sed -e 's/\\n//g')
|
||||
|
||||
MISSINGBIOS="$(batocera-systems --strictfilter ${PLATFORM})"
|
||||
if [ "$?" == "2" ]; then
|
||||
if [[ -f "${LOG}" ]]; then
|
||||
echo "${CORE} ${EMULATOR} ${ROMNAME}" >> $LOG
|
||||
echo "${PLATFORMNAME} missing BIOS - Could not find all BIOS: " >> $LOG
|
||||
echo "please make sure you copied the files into the corresponding folder " >> $LOG
|
||||
echo "${MISSINGBIOS}" >> $LOG
|
||||
fi
|
||||
MISSINGBIOS=$(echo "$MISSINGBIOS" | sed -e 's/$/\\n/g')
|
||||
|
||||
# formating so it looks nice :)
|
||||
PLATFORMNAME="${MISSINGBIOS##*>}" # read from -P onwards
|
||||
PLATFORMNAME="${PLATFORMNAME%%MISSING*}" # until a space is found
|
||||
PLATFORMNAME=$(echo $PLATFORMNAME | sed -e 's/\\n//g')
|
||||
|
||||
if [[ -f "${LOG}" ]]; then
|
||||
echo "${CORE} ${EMULATOR} ${ROMNAME}" >> $LOG
|
||||
echo "${PLATFORMNAME} missing BIOS - Could not find all BIOS: " >> $LOG
|
||||
echo "please make sure you copied the files into the corresponding folder " >> $LOG
|
||||
echo "${MISSINGBIOS}" >> $LOG
|
||||
fi
|
||||
MISSINGBIOS=$(echo "$MISSINGBIOS" | sed -e 's/$/\\n/g')
|
||||
|
||||
/usr/bin/error.sh "${PLATFORMNAME} missing BIOS" "Could not find all BIOS/files in /storage/roms, the game may not work:\n\n ${MISSINGBIOS}\n\nPlease make sure you copied the files into the corresponding folder."
|
||||
error_process="$!"
|
||||
pkill -P $error_process
|
||||
fi
|
||||
/usr/bin/error.sh "${PLATFORMNAME} missing BIOS" "Could not find all BIOS/files in /storage/roms, the game may not work:\n\n ${MISSINGBIOS}\n\nPlease make sure you copied the files into the corresponding folder."
|
||||
error_process="$!"
|
||||
pkill -P $error_process
|
||||
fi
|
||||
}
|
||||
|
||||
# read config files from /storage/.config/profile.d
|
||||
|
@ -106,3 +102,21 @@ fi
|
|||
. $config
|
||||
fi
|
||||
done
|
||||
|
||||
stop_ui() {
|
||||
if [ "${UI_SERVICE}" = "weston.service" ]
|
||||
then
|
||||
chvt 2
|
||||
else
|
||||
systemctl stop ${UI_SERVICE}
|
||||
fi
|
||||
}
|
||||
|
||||
start_ui() {
|
||||
if [ "${UI_SERVICE}" = "weston.service" ]
|
||||
then
|
||||
chvt 1
|
||||
else
|
||||
systemctl start ${UI_SERVICE}
|
||||
fi
|
||||
}
|
||||
|
|
|
@ -69,6 +69,9 @@ done
|
|||
|
||||
### Safe to make changes below this line.
|
||||
|
||||
# Default modules need to be updated to use the new stop/start ui function.
|
||||
rsync -av /usr/config/modules/*sh /storage/.config/modules/
|
||||
|
||||
# Swap es_input back to a writeable file so external controller configuration works properly.
|
||||
if [ -L "/storage/.config/emulationstation/es_input.cfg" ]
|
||||
then
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
# Copyright (C) 2020-present Shanti Gilbert (https://github.com/shantigilbert)
|
||||
# Copyright (C) 2020 Fewtarius (https://github.com/fewtarius)
|
||||
|
||||
. /etc/profile
|
||||
|
||||
# NOTE: to customize your backups, create a backuptool.conf file in
|
||||
# /storage/.config like this:
|
||||
|
||||
|
@ -49,9 +51,9 @@ fi
|
|||
|
||||
case "${1}" in
|
||||
"restore")
|
||||
systemctl stop ${UI_SERVICE}
|
||||
stop_ui
|
||||
unzip -o ${BACKUPFILE} -d /
|
||||
systemctl start ${UI_SERVICE}
|
||||
start_ui
|
||||
;;
|
||||
"backup")
|
||||
if [ -f ${BACKUPFILE} ]
|
||||
|
@ -61,9 +63,9 @@ case "${1}" in
|
|||
mv ${BACKUPFILE} "${BACKUPFOLDER}/${ARCHIVEFILENAME}"
|
||||
fi
|
||||
[ -f "${BACKUPFILE}" ] && rm "${BACKUPFILE}"
|
||||
[ -z "$2" ] && systemctl stop ${UI_SERVICE}
|
||||
[ -z "$2" ] && stop_ui
|
||||
zip -9 -r ${BACKUPFILE} \
|
||||
${COMPRESSLOCATIONS[@]}
|
||||
[ -z "${2}" ] && systemctl start ${UI_SERVICE}
|
||||
[ -z "${2}" ] && start_ui
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -10,7 +10,7 @@ case "${1}" in
|
|||
cp -rf /usr/config/retroarch/retroarch.cfg /storage/.config/retroarch/retroarch.cfg
|
||||
;;
|
||||
"ALL")
|
||||
systemctl stop ${UI_SERVICE}
|
||||
stop_ui
|
||||
cd /
|
||||
find /storage -mindepth 1 \( ! -regex '^/storage/.update.*' -a ! -regex '^/storage/roms.*' \) -delete
|
||||
mkdir /storage/.config/
|
||||
|
|
|
@ -68,12 +68,11 @@ update_es_folders() {
|
|||
fi
|
||||
done
|
||||
}
|
||||
systemctl stop ${UI_SERVICE}
|
||||
stop_ui
|
||||
|
||||
# check the external folders first
|
||||
update_es_folders "external" "${EXT_ROM_FOLDERS}" "${ES_LIST}"
|
||||
# next check the local folders
|
||||
# if there are duplicate folders in EXTERNAL, LOCAL ones will take preference
|
||||
update_es_folders "local" "${LOCAL_ROM_FOLDERS}" "${ES_LIST}"
|
||||
|
||||
systemctl start ${UI_SERVICE}
|
||||
start_ui
|
||||
|
|
|
@ -48,12 +48,12 @@ check_space() {
|
|||
NEEDED=$(( (${REQUIRED} - ${MYSIZE} ) / 1024 ))
|
||||
echo -e "There is not enough free space available ${VOLNAME} to install this update. Free up an additional ${NEEDED}MB, or reflash the newer version." >/dev/console
|
||||
echo "Exiting in 5 seconds..." >/dev/console && sleep 5
|
||||
systemctl start ${UI_SERVICE} &
|
||||
start_ui
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
systemctl stop ${UI_SERVICE}
|
||||
stop_ui
|
||||
clear >/dev/console
|
||||
|
||||
ONLINE_STATUS=$(check_network)
|
||||
|
@ -61,7 +61,7 @@ if [ ! "${ONLINE_STATUS}" == true ]
|
|||
then
|
||||
echo "System not online, cannot continue..." >/dev/console
|
||||
echo "Exiting in 5 seconds..." >/dev/console && sleep 5
|
||||
systemctl start ${UI_SERVICE} &
|
||||
start_ui
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -78,7 +78,7 @@ if [ "${OS_VERSION}" -ge "${LATEST_RELEASE_TAG}" ] && [ ! "${FORCE}" = "1" ]
|
|||
then
|
||||
echo "No new updates are available..." >/dev/console
|
||||
echo "Exiting in 5 seconds..." >/dev/console && sleep 5
|
||||
systemctl start ${UI_SERVICE} &
|
||||
start_ui
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
@ -98,7 +98,7 @@ then
|
|||
rm -f ${UPDATE_PATH}/*
|
||||
sleep 5
|
||||
clear >/dev/console
|
||||
systemctl start ${UI_SERVICE}
|
||||
start_ui
|
||||
exit 1
|
||||
else
|
||||
echo "Verification successful..." >/dev/console
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
. /etc/profile
|
||||
source /usr/bin/env.sh
|
||||
clear >/dev/console
|
||||
systemctl stop ${UI_SERVICE}
|
||||
stop_ui
|
||||
echo "Cleaning ._ files from /storage/roms" >/dev/console
|
||||
find /storage/roms -iname '._*' -exec rm -rf {} \;
|
||||
clear >/dev/console
|
||||
systemctl start ${UI_SERVICE}
|
||||
start_ui
|
||||
|
|
Loading…
Reference in a new issue