Skip to content

Commit bfed994

Browse files
committed
fixed little regression when handling previous prevent_launcher file
1 parent b2847c1 commit bfed994

File tree

3 files changed

+66
-65
lines changed

3 files changed

+66
-65
lines changed

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

Lines changed: 56 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fi
2121

2222
# Convert old prevent launcher file to new frontend disable file
2323
if [ -f "${PREVENT_LAUNCHER_FILE}" ]; then
24-
mv "${PREVENT_LAUNCHER_FILE}" "{DISABLE_FRONTEND_FILE}"
24+
mv "${PREVENT_LAUNCHER_FILE}" "${DISABLE_FRONTEND_FILE}"
2525
fi
2626

2727
usage() {
@@ -37,12 +37,12 @@ set_frontend() {
3737
local new_frontend="${1}"
3838
echo "Setting frontend: ${new_frontend}"
3939
if [ "${new_frontend}" = "none" ]; then
40-
touch "${DISABLE_FRONTEND_FILE}"
40+
touch "${DISABLE_FRONTEND_FILE}"
4141
else
42-
rm -f "${DISABLE_FRONTEND_FILE}"
42+
rm -f "${DISABLE_FRONTEND_FILE}"
4343
fi
4444
if [ "${frontend}" != "none" ]; then
45-
pkill "${frontend}"
45+
pkill "${frontend}"
4646
fi
4747
echo "${new_frontend}" > "${FRONTEND_FILE}"
4848
}
@@ -52,8 +52,8 @@ get_frontend() {
5252

5353
# Check if not empty
5454
if [ "x${frontend}" = "x" ]; then
55-
frontend="${DEFAULT_FRONTEND}"
56-
echo "${frontend}" > "${FRONTEND_FILE}"
55+
frontend="${DEFAULT_FRONTEND}"
56+
echo "${frontend}" > "${FRONTEND_FILE}"
5757
fi
5858

5959
# Return frontend name
@@ -62,62 +62,63 @@ get_frontend() {
6262

6363
init_frontend() {
6464
if [ -f "${LOCK_FILE}" ]; then
65-
>&2 echo "${LOCK_FILE} already exists"
66-
exit 1
65+
>&2 echo "${LOCK_FILE} already exists"
66+
exit 1
6767
fi
6868
touch "${LOCK_FILE}"
6969

7070
# Then loop to launch the frontend indefinitely
7171
while true; do
7272

73-
# Check if frontend disable file is present
74-
if [ -f "${DISBALE_FRONTEND_FILE}" ]; then
75-
echo "${DISABLE_FRONTEND_FILE} file found, not starting frontend"
76-
sleep 5
77-
else
78-
79-
# Umount any remaining OPK, if any
80-
umount /opk >/dev/null 2>&1
81-
rm -f "${LAST_OPK_FILE}"
82-
83-
local frontend="$(get_frontend)"
84-
case "${frontend}" in
85-
gmenu2x|retrofe)
86-
"${frontend}"&
87-
;;
88-
89-
none)
90-
echo "no frontend"
73+
# Check if frontend disable file is present
74+
if [ -f "${DISABLE_FRONTEND_FILE}" ]; then
75+
echo "${DISABLE_FRONTEND_FILE} file found, not starting frontend"
9176
sleep 5
92-
;;
93-
94-
*)
95-
DEFAULT_FRONTEND=retrofe
96-
echo "Unrecognized frontend: $frontend, setting $DEFAULT_FRONTEND"
97-
set_frontend "${DEFAULT_FRONTEND}"
98-
;;
99-
esac
100-
101-
# Record the PID into a file, wait for the process to
102-
# terminate and erase the recorded PID
103-
pid record $!
104-
wait $!
105-
pid erase
106-
107-
# In case retrofe/opkrun quits with errors, clear graphic VT
108-
termfix_all
109-
110-
# In case retrofe/opkrun quits with errors, reset default key mapping
111-
keymap default
112-
fi
113-
114-
# Prevent 100% CPU usage
115-
sleep 0.5
116-
117-
# Exit if console rebooting
118-
if [ -f "${REBOOTING_FILE}" ]; then
119-
break
120-
fi
77+
else
78+
79+
# Umount any remaining OPK, if any
80+
umount /opk >/dev/null 2>&1
81+
rm -f "${LAST_OPK_FILE}"
82+
83+
# Launch selected frontend
84+
local frontend="$(get_frontend)"
85+
case "${frontend}" in
86+
gmenu2x|retrofe)
87+
"${frontend}"&
88+
;;
89+
90+
none)
91+
echo "no frontend"
92+
sleep 5
93+
;;
94+
95+
*)
96+
DEFAULT_FRONTEND=retrofe
97+
echo "Unrecognized frontend: $frontend, setting $DEFAULT_FRONTEND"
98+
set_frontend "${DEFAULT_FRONTEND}"
99+
;;
100+
esac
101+
102+
# Record the PID into a file, wait for the process to
103+
# terminate and erase the recorded PID
104+
pid record $!
105+
wait $!
106+
pid erase
107+
108+
# In case retrofe/opkrun quits with errors, clear graphic VT
109+
termfix_all
110+
111+
# In case retrofe/opkrun quits with errors, reset default key mapping
112+
keymap default
113+
fi
114+
115+
# Prevent 100% CPU usage
116+
sleep 0.5
117+
118+
# Exit if console rebooting
119+
if [ -f "${REBOOTING_FILE}" ]; then
120+
break
121+
fi
121122
done
122123

123124
# Remove lock file and exit

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ if [ ${#} -lt 1 ]; then
2020
fi
2121

2222
case ${1} in
23-
load)
23+
load)
2424
if [ ${#} -ne 1 ]; then
2525
usage
2626
fi
@@ -52,7 +52,7 @@ case ${1} in
5252
fi
5353
;;
5454

55-
save)
55+
save)
5656
if [ ${#} -lt 2 ]; then
5757
usage
5858
fi
@@ -80,7 +80,7 @@ EOF
8080
exec powerdown now
8181
;;
8282

83-
*)
83+
*)
8484
usage
8585
;;
8686
esac

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ increase_volume() {
2424
local new_volume=0
2525
let new_volume=${current_volume}+${VOLUME_STEP}
2626
if [ ${new_volume} -gt 100 ]; then
27-
new_volume=100
27+
new_volume=100
2828
fi
2929

3030
# Change volume
3131
if [ ${new_volume} -ne ${current_volume} ]; then
32-
set_volume ${new_volume}
32+
set_volume ${new_volume}
3333
fi
3434

3535
# Notif
@@ -44,12 +44,12 @@ decrease_volume() {
4444
# Compute new volume value
4545
local new_volume=0
4646
if [ ${current_volume} -gt ${VOLUME_STEP} ]; then
47-
let new_volume=${current_volume}-${VOLUME_STEP}
47+
let new_volume=${current_volume}-${VOLUME_STEP}
4848
fi
4949

5050
# Change volume
5151
if [ ${new_volume} -ne ${current_volume} ]; then
52-
set_volume ${new_volume}
52+
set_volume ${new_volume}
5353
fi
5454

5555
# Notif
@@ -77,14 +77,14 @@ set_volume() {
7777

7878
# Set the new volume value in a bootloader variable
7979
if [ ${?} -eq 0 -a ${current_volume} -ne ${new_volume} ]; then
80-
fw_setenv volume ${new_volume}
80+
fw_setenv volume ${new_volume}
8181
fi
8282

8383
# Turn on/off audio amplifier if necessary
8484
if [ ${new_volume} -eq 0 ]; then
85-
audio_amp off
85+
audio_amp off
8686
else
87-
audio_amp on
87+
audio_amp on
8888
fi
8989
}
9090

0 commit comments

Comments
 (0)