diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play index ed45436..0a99312 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play @@ -34,22 +34,26 @@ load) mount -t squashfs "${last_opk}" /opk fi + # Remove unnecessary files + rm -f "${RESUME_PLAY_FILE}" + # Launch Previous Game if any if [ -f "${INSTANT_PLAY_FILE}" ]; then keymap resume echo -n "Found Instant Play file, restarting previous game with command: " - echo $(head -n 1 "${INSTANT_PLAY_FILE}") - rm -f "${RESUME_PLAY_FILE}" + cat "${INSTANT_PLAY_FILE}" 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 + + # Unmount last OPK, if any + if [ -r "${LAST_OPK_FILE}" ]; then + umount /opk + rm "${LAST_OPK_FILE}" + fi ;; save) @@ -60,13 +64,22 @@ save) # Write quick load file args echo -n "" > "${INSTANT_PLAY_FILE}" + # First arg is prog name, forcing real path + printf "'" >> "${INSTANT_PLAY_FILE}" + bin_name=$(printf %s "$1" | sed "s/'/'\\\\''/g") + bin_path="$(pwd)"/"$(basename "$bin_name")" + echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}" + shift + case $# in 0) break; esac + printf "' " >> "${INSTANT_PLAY_FILE}" + while : do - printf "'" >> "${INSTANT_PLAY_FILE}" - printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}" - shift - case $# in 0) break; esac - printf "' " >> "${INSTANT_PLAY_FILE}" + printf "'" >> "${INSTANT_PLAY_FILE}" + printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}" + shift + case $# in 0) break; esac + printf "' " >> "${INSTANT_PLAY_FILE}" done printf "'\n" >> "${INSTANT_PLAY_FILE}" @@ -89,3 +102,4 @@ EOF ;; esac exit 0 + diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown index ac48edd..067fc8a 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/powerdown @@ -57,10 +57,10 @@ powerdown_now() { action="${1:-now}" case "${action}" in schedule) - if [ ${#} != 2 -o "${2}" -eq 0 ]; then + if [ ${#} != 2 -o "${2}" == "0" ]; then usage fi - schedule_powerdown + schedule_powerdown ${2} ;; handle)