Skip to content

Commit 04570f0

Browse files
committed
fix indentation
Signed-off-by: Michel-FK <[email protected]>
1 parent 29f5f5b commit 04570f0

File tree

2 files changed

+51
-52
lines changed

2 files changed

+51
-52
lines changed

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/instant_play

Lines changed: 50 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -23,83 +23,82 @@ fi
2323

2424
case ${1} in
2525
load)
26-
if [ ${#} -ne 1 ]; then
27-
usage
28-
fi
26+
if [ ${#} -ne 1 ]; then
27+
usage
28+
fi
29+
30+
# Umount any remaining OPK, if any
31+
umount /opk >/dev/null 2>&1
2932

30-
# Umount any remaining OPK, if any
31-
umount /opk >/dev/null 2>&1
33+
# Mount last OPK, if any
34+
if [ -r "${LAST_OPK_FILE}" ]; then
35+
last_opk=$(cat "${LAST_OPK_FILE}")
36+
mount -t squashfs "${last_opk}" /opk
37+
fi
3238

33-
# Mount last OPK, if any
34-
if [ -r "${LAST_OPK_FILE}" ]; then
35-
last_opk=$(cat "${LAST_OPK_FILE}")
36-
mount -t squashfs "${last_opk}" /opk
37-
fi
39+
# Remove unnecessary files
40+
rm -f "${RESUME_PLAY_FILE}"
3841

39-
# Remove unnecessary files
42+
# Launch Previous Game if any
43+
if [ -f "${INSTANT_PLAY_FILE}" ]; then
44+
keymap resume
45+
echo -n "Found Instant Play file, restarting previous game with command: "
46+
cat "${INSTANT_PLAY_FILE}"
47+
mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}"
48+
source "${RESUME_PLAY_FILE}"
4049
rm -f "${RESUME_PLAY_FILE}"
50+
keymap default
51+
termfix_all
52+
fi
4153

42-
# Launch Previous Game if any
43-
if [ -f "${INSTANT_PLAY_FILE}" ]; then
44-
keymap resume
45-
echo -n "Found Instant Play file, restarting previous game with command: "
46-
cat "${INSTANT_PLAY_FILE}"
47-
mv "${INSTANT_PLAY_FILE}" "${RESUME_PLAY_FILE}"
48-
source "${RESUME_PLAY_FILE}"
49-
rm -f "${RESUME_PLAY_FILE}"
50-
keymap default
51-
termfix_all
52-
fi
53-
54-
# Unmount last OPK, if any
54+
# Unmount last OPK, if any
5555
if [ -r "${LAST_OPK_FILE}" -a ! -f "${REBOOTING_FILE}" ]; then
56-
umount /opk
57-
rm "${LAST_OPK_FILE}"
56+
umount /opk
57+
rm "${LAST_OPK_FILE}"
5858
fi
59-
;;
59+
;;
6060

6161
save)
62-
if [ ${#} -lt 2 ]; then
63-
usage
64-
fi
65-
shift
66-
67-
# Write quick load file args
68-
echo -n "" > "${INSTANT_PLAY_FILE}"
69-
printf "'" >> "${INSTANT_PLAY_FILE}"
70-
# First arg is prog name, forcing real path
71-
bin=$(printf %s "$1" | sed "s/'/'\\\\''/g")
62+
if [ ${#} -lt 2 ]; then
63+
usage
64+
fi
65+
shift
66+
67+
# Write quick load file args
68+
echo -n "" > "${INSTANT_PLAY_FILE}"
69+
printf "'" >> "${INSTANT_PLAY_FILE}"
70+
# First arg is prog name, forcing real path
71+
bin=$(printf %s "$1" | sed "s/'/'\\\\''/g")
7272
bin_name=$(basename "$bin")
7373
bin_path="$(cat $PID_PATH)"/"$bin_name"
74-
echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}"
74+
echo -n "$bin_path" >> "${INSTANT_PLAY_FILE}"
7575
printf "' " >> "${INSTANT_PLAY_FILE}"
7676
shift
7777

78-
while [ "$#" != "0" ]
79-
do
78+
while [ "$#" != "0" ]
79+
do
8080
printf "'" >> "${INSTANT_PLAY_FILE}"
8181
printf %s "$1" | sed "s/'/'\\\\''/g" >> "${INSTANT_PLAY_FILE}"
8282
printf "' " >> "${INSTANT_PLAY_FILE}"
8383
shift
84-
done
84+
done
8585

86-
# Add the magic sauce to launch the process in background,
87-
# record the PID into a file, wait for the process to
88-
# terminate and erase the recorded PID
89-
cat << EOF >> "${INSTANT_PLAY_FILE}"
86+
# Add the magic sauce to launch the process in background,
87+
# record the PID into a file, wait for the process to
88+
# terminate and erase the recorded PID
89+
cat << EOF >> "${INSTANT_PLAY_FILE}"
9090
&
9191
pid record \$!
9292
wait \$!
9393
pid erase
9494
EOF
9595

96-
# Now terminate gracefully
97-
exec powerdown now
98-
;;
96+
# Now terminate gracefully
97+
exec powerdown now
98+
;;
9999

100100
*)
101-
usage
102-
;;
101+
usage
102+
;;
103103
esac
104104
exit 0
105-

FunKey/board/funkey/rootfs-overlay/usr/local/sbin/pid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ case "${1}" in
4141
erase_pid
4242
;;
4343

44-
print)
44+
print)
4545
cat "${PID_FILE}"
4646
;;
4747

0 commit comments

Comments
 (0)