fixed little regression when handling previous prevent_launcher file
This commit is contained in:
parent
b2847c1cd4
commit
bfed99494e
|
@ -21,7 +21,7 @@ fi
|
|||
|
||||
# Convert old prevent launcher file to new frontend disable file
|
||||
if [ -f "${PREVENT_LAUNCHER_FILE}" ]; then
|
||||
mv "${PREVENT_LAUNCHER_FILE}" "{DISABLE_FRONTEND_FILE}"
|
||||
mv "${PREVENT_LAUNCHER_FILE}" "${DISABLE_FRONTEND_FILE}"
|
||||
fi
|
||||
|
||||
usage() {
|
||||
|
@ -37,12 +37,12 @@ set_frontend() {
|
|||
local new_frontend="${1}"
|
||||
echo "Setting frontend: ${new_frontend}"
|
||||
if [ "${new_frontend}" = "none" ]; then
|
||||
touch "${DISABLE_FRONTEND_FILE}"
|
||||
touch "${DISABLE_FRONTEND_FILE}"
|
||||
else
|
||||
rm -f "${DISABLE_FRONTEND_FILE}"
|
||||
rm -f "${DISABLE_FRONTEND_FILE}"
|
||||
fi
|
||||
if [ "${frontend}" != "none" ]; then
|
||||
pkill "${frontend}"
|
||||
pkill "${frontend}"
|
||||
fi
|
||||
echo "${new_frontend}" > "${FRONTEND_FILE}"
|
||||
}
|
||||
|
@ -52,8 +52,8 @@ get_frontend() {
|
|||
|
||||
# Check if not empty
|
||||
if [ "x${frontend}" = "x" ]; then
|
||||
frontend="${DEFAULT_FRONTEND}"
|
||||
echo "${frontend}" > "${FRONTEND_FILE}"
|
||||
frontend="${DEFAULT_FRONTEND}"
|
||||
echo "${frontend}" > "${FRONTEND_FILE}"
|
||||
fi
|
||||
|
||||
# Return frontend name
|
||||
|
@ -62,62 +62,63 @@ get_frontend() {
|
|||
|
||||
init_frontend() {
|
||||
if [ -f "${LOCK_FILE}" ]; then
|
||||
>&2 echo "${LOCK_FILE} already exists"
|
||||
exit 1
|
||||
>&2 echo "${LOCK_FILE} already exists"
|
||||
exit 1
|
||||
fi
|
||||
touch "${LOCK_FILE}"
|
||||
|
||||
# Then loop to launch the frontend indefinitely
|
||||
while true; do
|
||||
|
||||
# Check if frontend disable file is present
|
||||
if [ -f "${DISBALE_FRONTEND_FILE}" ]; then
|
||||
echo "${DISABLE_FRONTEND_FILE} file found, not starting frontend"
|
||||
sleep 5
|
||||
else
|
||||
|
||||
# Umount any remaining OPK, if any
|
||||
umount /opk >/dev/null 2>&1
|
||||
rm -f "${LAST_OPK_FILE}"
|
||||
|
||||
local frontend="$(get_frontend)"
|
||||
case "${frontend}" in
|
||||
gmenu2x|retrofe)
|
||||
"${frontend}"&
|
||||
;;
|
||||
|
||||
none)
|
||||
echo "no frontend"
|
||||
# Check if frontend disable file is present
|
||||
if [ -f "${DISABLE_FRONTEND_FILE}" ]; then
|
||||
echo "${DISABLE_FRONTEND_FILE} file found, not starting frontend"
|
||||
sleep 5
|
||||
;;
|
||||
else
|
||||
|
||||
*)
|
||||
DEFAULT_FRONTEND=retrofe
|
||||
echo "Unrecognized frontend: $frontend, setting $DEFAULT_FRONTEND"
|
||||
set_frontend "${DEFAULT_FRONTEND}"
|
||||
;;
|
||||
esac
|
||||
# Umount any remaining OPK, if any
|
||||
umount /opk >/dev/null 2>&1
|
||||
rm -f "${LAST_OPK_FILE}"
|
||||
|
||||
# Record the PID into a file, wait for the process to
|
||||
# terminate and erase the recorded PID
|
||||
pid record $!
|
||||
wait $!
|
||||
pid erase
|
||||
# Launch selected frontend
|
||||
local frontend="$(get_frontend)"
|
||||
case "${frontend}" in
|
||||
gmenu2x|retrofe)
|
||||
"${frontend}"&
|
||||
;;
|
||||
|
||||
# In case retrofe/opkrun quits with errors, clear graphic VT
|
||||
termfix_all
|
||||
none)
|
||||
echo "no frontend"
|
||||
sleep 5
|
||||
;;
|
||||
|
||||
# In case retrofe/opkrun quits with errors, reset default key mapping
|
||||
keymap default
|
||||
fi
|
||||
*)
|
||||
DEFAULT_FRONTEND=retrofe
|
||||
echo "Unrecognized frontend: $frontend, setting $DEFAULT_FRONTEND"
|
||||
set_frontend "${DEFAULT_FRONTEND}"
|
||||
;;
|
||||
esac
|
||||
|
||||
# Prevent 100% CPU usage
|
||||
sleep 0.5
|
||||
# Record the PID into a file, wait for the process to
|
||||
# terminate and erase the recorded PID
|
||||
pid record $!
|
||||
wait $!
|
||||
pid erase
|
||||
|
||||
# Exit if console rebooting
|
||||
if [ -f "${REBOOTING_FILE}" ]; then
|
||||
break
|
||||
fi
|
||||
# In case retrofe/opkrun quits with errors, clear graphic VT
|
||||
termfix_all
|
||||
|
||||
# In case retrofe/opkrun quits with errors, reset default key mapping
|
||||
keymap default
|
||||
fi
|
||||
|
||||
# Prevent 100% CPU usage
|
||||
sleep 0.5
|
||||
|
||||
# Exit if console rebooting
|
||||
if [ -f "${REBOOTING_FILE}" ]; then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
# Remove lock file and exit
|
||||
|
|
|
@ -20,7 +20,7 @@ if [ ${#} -lt 1 ]; then
|
|||
fi
|
||||
|
||||
case ${1} in
|
||||
load)
|
||||
load)
|
||||
if [ ${#} -ne 1 ]; then
|
||||
usage
|
||||
fi
|
||||
|
@ -52,7 +52,7 @@ case ${1} in
|
|||
fi
|
||||
;;
|
||||
|
||||
save)
|
||||
save)
|
||||
if [ ${#} -lt 2 ]; then
|
||||
usage
|
||||
fi
|
||||
|
@ -80,7 +80,7 @@ EOF
|
|||
exec powerdown now
|
||||
;;
|
||||
|
||||
*)
|
||||
*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
|
|
|
@ -24,12 +24,12 @@ increase_volume() {
|
|||
local new_volume=0
|
||||
let new_volume=${current_volume}+${VOLUME_STEP}
|
||||
if [ ${new_volume} -gt 100 ]; then
|
||||
new_volume=100
|
||||
new_volume=100
|
||||
fi
|
||||
|
||||
# Change volume
|
||||
if [ ${new_volume} -ne ${current_volume} ]; then
|
||||
set_volume ${new_volume}
|
||||
set_volume ${new_volume}
|
||||
fi
|
||||
|
||||
# Notif
|
||||
|
@ -44,12 +44,12 @@ decrease_volume() {
|
|||
# Compute new volume value
|
||||
local new_volume=0
|
||||
if [ ${current_volume} -gt ${VOLUME_STEP} ]; then
|
||||
let new_volume=${current_volume}-${VOLUME_STEP}
|
||||
let new_volume=${current_volume}-${VOLUME_STEP}
|
||||
fi
|
||||
|
||||
# Change volume
|
||||
if [ ${new_volume} -ne ${current_volume} ]; then
|
||||
set_volume ${new_volume}
|
||||
set_volume ${new_volume}
|
||||
fi
|
||||
|
||||
# Notif
|
||||
|
@ -77,14 +77,14 @@ set_volume() {
|
|||
|
||||
# Set the new volume value in a bootloader variable
|
||||
if [ ${?} -eq 0 -a ${current_volume} -ne ${new_volume} ]; then
|
||||
fw_setenv volume ${new_volume}
|
||||
fw_setenv volume ${new_volume}
|
||||
fi
|
||||
|
||||
# Turn on/off audio amplifier if necessary
|
||||
if [ ${new_volume} -eq 0 ]; then
|
||||
audio_amp off
|
||||
audio_amp off
|
||||
else
|
||||
audio_amp on
|
||||
audio_amp on
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue