save last OPK for instant_play

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2021-06-08 22:22:00 +02:00
parent 50d83ed555
commit bc35b7e59c
3 changed files with 22 additions and 1 deletions

View File

@ -11,6 +11,7 @@ DISABLE_FRONTEND_FILE="/mnt/disable_frontend"
DEFAULT_FRONTEND=retrofe
LOCK_FILE="/var/lock/frontend.lock"
REBOOTING_FILE="/run/rebooting"
LAST_OPK_FILE="/mnt/last_opk"
# Convert old launcher file to new frontend
if [ -f "${LAUNCHER_FILE}" ]; then
@ -74,6 +75,11 @@ init_frontend() {
echo "${DISABLE_FRONTEND_FILE} file found, not starting frontend"
sleep 5
else
# Umount any remaining OPK, if any
umount /opk >/dev/null 2>&1
rm -f "${LAST_OPK_FILE}"
local frontend="$(get_frontend)"
case "${frontend}" in
gmenu2x|retrofe)

View File

@ -6,6 +6,7 @@
SELF="$(basename ${0})"
INSTANT_PLAY_FILE="/mnt/instant_play"
RESUME_PLAY_FILE="/mnt/resume_play"
LAST_OPK_FILE="/mnt/last_opk"
usage() {
>&2 echo "Usage: ${SELF} load"
@ -24,6 +25,15 @@ case ${1} in
usage
fi
# Umount any remaining OPK, if any
umount /opk >/dev/null 2>&1
# Mount last OPK, if any
if [ -r "${LAST_OPK_FILE}" ]; then
last_opk=$(cat "${LAST_OPK_FILE}")
mount -t squashfs "${last_opk}" /opk
fi
# Launch Previous Game if any
if [ -f "${INSTANT_PLAY_FILE}" ]; then
keymap resume
@ -33,6 +43,10 @@ case ${1} in
mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}"
source "${RESUME_PLAY_FILE}"
rm -f "${RESUME_PLAY_FILE}"
if [ -r "${LAST_OPK_FILE}" ]; then
umount /opk
rm "${LAST_OPK_FILE}"
fi
keymap default
termfix_all
fi

View File

@ -3,7 +3,8 @@
# libopk
#
#############################################################
LIBOPK_VERSION = 1396aaa
LIBOPK_VERSION = a4bbf06
LIBOPK_SITE_METHOD = git
LIBOPK_SITE = https://github.com/FunKey-Project/libopk.git