Skip to content

Commit 1c111b3

Browse files
kindle: allow UNPACK_DIR to be set externally
1 parent 896646b commit 1c111b3

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

platform/kindle/koreader.sh

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22

33
export LC_ALL="en_US.UTF-8"
44

5-
UNPACK_DIR='/mnt/us'
5+
if [ ! -n "${UNPACK_DIR+x}" ]; then
6+
UNPACK_DIR='/mnt/us'
7+
fi
68
# KOReader's working directory.
79
KOREADER_DIR="${UNPACK_DIR}/koreader"
810

@@ -260,9 +262,9 @@ if [ "${STOP_FRAMEWORK}" = "no" ] && [ "${INIT_TYPE}" = "upstart" ]; then
260262
# FIXME: There's apparently a nasty side-effect on FW >= 5.12.4 which somehow softlocks the UI on exit (despite wmctrl succeeding). Don't have the HW to investigate, so, just drop it. (#6117)
261263
if [ "$(version "${FW_VERSION}")" -lt "$(version "5.12.4")" ]; then
262264
logmsg "Hiding the title bar . . ."
263-
TITLEBAR_GEOMETRY="$(${KOREADER_DIR}/wmctrl -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')"
264-
${KOREADER_DIR}/wmctrl -r ":titleBar_ID:" -e "${TITLEBAR_GEOMETRY%,*},1"
265-
logmsg "Title bar geometry: '${TITLEBAR_GEOMETRY}' -> '$(${KOREADER_DIR}/wmctrl -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')'"
265+
TITLEBAR_GEOMETRY="$("${KOREADER_DIR}/wmctrl" -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')"
266+
"${KOREADER_DIR}/wmctrl" -r ":titleBar_ID:" -e "${TITLEBAR_GEOMETRY%,*},1"
267+
logmsg "Title bar geometry: '${TITLEBAR_GEOMETRY}' -> '$("${KOREADER_DIR}/wmctrl" -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')'"
266268
USED_WMCTRL="yes"
267269
fi
268270
if [ "${FROM_KUAL}" = "yes" ]; then
@@ -396,17 +398,17 @@ if [ "${STOP_FRAMEWORK}" = "no" ] && [ "${INIT_TYPE}" = "upstart" ]; then
396398
# NOTE: Wait and retry for a bit, because apparently there may be timing issues (c.f., #5990)?
397399
usleep 250000
398400
WMCTRL_COUNT=0
399-
until [ "$(${KOREADER_DIR}/wmctrl -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')" = "${TITLEBAR_GEOMETRY}" ]; do
401+
until [ "$("${KOREADER_DIR}/wmctrl" -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')" = "${TITLEBAR_GEOMETRY}" ]; do
400402
# Abort after 5s
401403
if [ ${WMCTRL_COUNT} -gt 20 ]; then
402404
log "Giving up on restoring the title bar geometry!"
403405
break
404406
fi
405-
${KOREADER_DIR}/wmctrl -r ":titleBar_ID:" -e "${TITLEBAR_GEOMETRY}"
407+
"${KOREADER_DIR}/wmctrl" -r ":titleBar_ID:" -e "${TITLEBAR_GEOMETRY}"
406408
usleep 250000
407409
WMCTRL_COUNT=$((WMCTRL_COUNT + 1))
408410
done
409-
logmsg "Title bar geometry restored to '$(${KOREADER_DIR}/wmctrl -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')' (ought to be: '${TITLEBAR_GEOMETRY}') [after ${WMCTRL_COUNT} attempts]"
411+
logmsg "Title bar geometry restored to '$("${KOREADER_DIR}/wmctrl" -l -G | grep ":titleBar_ID:" | awk '{print $2,$3,$4,$5,$6}' OFS=',')' (ought to be: '${TITLEBAR_GEOMETRY}') [after ${WMCTRL_COUNT} attempts]"
410412
fi
411413
fi
412414

0 commit comments

Comments
 (0)