From 04570f0499ba0c174efb0c64cca728916976e4c6 Mon Sep 17 00:00:00 2001 From: Michel-FK Date: Sat, 19 Jun 2021 12:01:25 +0200 Subject: [PATCH] fix indentation Signed-off-by: Michel-FK --- .../usr/local/sbin/instant_play | 111 +++++++++--------- .../funkey/rootfs-overlay/usr/local/sbin/pid | 2 +- 2 files changed, 56 insertions(+), 57 deletions(-) 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 43a5b4e..b6185ba 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play @@ -23,83 +23,82 @@ fi case ${1} in load) - if [ ${#} -ne 1 ]; then - 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 - - # 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: " - cat "${INSTANT_PLAY_FILE}" - mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}" - source "${RESUME_PLAY_FILE}" - rm -f "${RESUME_PLAY_FILE}" - keymap default - termfix_all - fi - - # Unmount last OPK, if any - if [ -r "${LAST_OPK_FILE}" -a ! -f "${REBOOTING_FILE}" ]; then - umount /opk - rm "${LAST_OPK_FILE}" + if [ ${#} -ne 1 ]; then + 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 + + # 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: " + cat "${INSTANT_PLAY_FILE}" + mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}" + source "${RESUME_PLAY_FILE}" + rm -f "${RESUME_PLAY_FILE}" + keymap default + termfix_all + fi + + # Unmount last OPK, if any + if [ -r "${LAST_OPK_FILE}" -a ! -f "${REBOOTING_FILE}" ]; then + umount /opk + rm "${LAST_OPK_FILE}" + fi + ;; save) - if [ ${#} -lt 2 ]; then - usage - fi - shift + if [ ${#} -lt 2 ]; then + usage + fi + shift - # Write quick load file args - echo -n "" > "${INSTANT_PLAY_FILE}" - printf "'" >> "${INSTANT_PLAY_FILE}" - # First arg is prog name, forcing real path - bin=$(printf %s "$1" | sed "s/'/'\\\\''/g") + # Write quick load file args + echo -n "" > "${INSTANT_PLAY_FILE}" + printf "'" >> "${INSTANT_PLAY_FILE}" + # First arg is prog name, forcing real path + bin=$(printf %s "$1" | sed "s/'/'\\\\''/g") bin_name=$(basename "$bin") bin_path="$(cat $PID_PATH)"/"$bin_name" - echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}" + echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}" printf "' " >> "${INSTANT_PLAY_FILE}" shift - while [ "$#" != "0" ] - do + while [ "$#" != "0" ] + do printf "'" >> "${INSTANT_PLAY_FILE}" printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}" printf "' " >> "${INSTANT_PLAY_FILE}" shift - done + done - # Add the magic sauce to launch the process in background, - # record the PID into a file, wait for the process to - # terminate and erase the recorded PID - cat << EOF >> "${INSTANT_PLAY_FILE}" + # Add the magic sauce to launch the process in background, + # record the PID into a file, wait for the process to + # terminate and erase the recorded PID + cat << EOF >> "${INSTANT_PLAY_FILE}" & pid record \$! wait \$! pid erase EOF - # Now terminate gracefully - exec powerdown now - ;; + # Now terminate gracefully + exec powerdown now + ;; *) - usage - ;; + usage + ;; esac exit 0 - diff --git a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid index 19fca61..3d48b1c 100755 --- a/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid +++ b/FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid @@ -41,7 +41,7 @@ case "${1}" in erase_pid ;; - print) + print) cat "${PID_FILE}" ;;