Browse Source

save last OPK for instant_play

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
Michel-FK 2 years ago
parent
commit
bc35b7e59c

+ 6 - 0
FunKey/board/funkey/rootfs-overlay/usr/local/sbin/frontend

@@ -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)

+ 14 - 0
FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play

@@ -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

+ 2 - 1
FunKey/package/libopk/libopk.mk

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