fix indentation

Signed-off-by: Michel-FK <michel.stempin@funkey-project.com>
This commit is contained in:
Michel-FK 2021-06-19 12:01:25 +02:00
parent 29f5f5b3f3
commit 04570f0499
2 changed files with 56 additions and 57 deletions

View File

@ -23,83 +23,82 @@ fi
case ${1} in case ${1} in
load) load)
if [ ${#} -ne 1 ]; then if [ ${#} -ne 1 ]; then
usage 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 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) save)
if [ ${#} -lt 2 ]; then if [ ${#} -lt 2 ]; then
usage usage
fi fi
shift shift
# Write quick load file args # Write quick load file args
echo -n "" > "${INSTANT_PLAY_FILE}" echo -n "" > "${INSTANT_PLAY_FILE}"
printf "'" >> "${INSTANT_PLAY_FILE}" printf "'" >> "${INSTANT_PLAY_FILE}"
# First arg is prog name, forcing real path # First arg is prog name, forcing real path
bin=$(printf %s "$1" | sed "s/'/'\\\\''/g") bin=$(printf %s "$1" | sed "s/'/'\\\\''/g")
bin_name=$(basename "$bin") bin_name=$(basename "$bin")
bin_path="$(cat $PID_PATH)"/"$bin_name" 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}" printf "' " >> "${INSTANT_PLAY_FILE}"
shift shift
while [ "$#" != "0" ] while [ "$#" != "0" ]
do do
printf "'" >> "${INSTANT_PLAY_FILE}" printf "'" >> "${INSTANT_PLAY_FILE}"
printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}" printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}"
printf "' " >> "${INSTANT_PLAY_FILE}" printf "' " >> "${INSTANT_PLAY_FILE}"
shift shift
done done
# Add the magic sauce to launch the process in background, # Add the magic sauce to launch the process in background,
# record the PID into a file, wait for the process to # record the PID into a file, wait for the process to
# terminate and erase the recorded PID # terminate and erase the recorded PID
cat << EOF >> "${INSTANT_PLAY_FILE}" cat << EOF >> "${INSTANT_PLAY_FILE}"
& &
pid record \$! pid record \$!
wait \$! wait \$!
pid erase pid erase
EOF EOF
# Now terminate gracefully # Now terminate gracefully
exec powerdown now exec powerdown now
;; ;;
*) *)
usage usage
;; ;;
esac esac
exit 0 exit 0

View File

@ -41,7 +41,7 @@ case "${1}" in
erase_pid erase_pid
;; ;;
print) print)
cat "${PID_FILE}" cat "${PID_FILE}"
;; ;;