You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
# KOReader's working directory
|
|
|
|
KOREADER_DIR="/mnt/us/koreader"
|
|
|
|
|
|
|
|
# We do NOT want to sleep during eips calls!
|
|
|
|
export EIPS_NO_SLEEP="true"
|
|
|
|
|
|
|
|
# Load our helper functions...
|
|
|
|
if [ -f "${KOREADER_DIR}/libkohelper.sh" ]; then
|
|
|
|
# shellcheck source=/dev/null
|
|
|
|
. "${KOREADER_DIR}/libkohelper.sh"
|
|
|
|
else
|
|
|
|
echo "Can't source helper functions, aborting!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
## First arg is the checkpoint number, and we get one every 200 checkpoints.
|
|
|
|
CHECKPOINT_NUM="${1}"
|
|
|
|
CHECKPOINT_GRANULARITY="200"
|
|
|
|
|
|
|
|
# Use that to build a progress bar
|
|
|
|
PROGRESS_AMOUNT="$((CHECKPOINT_NUM / CHECKPOINT_GRANULARITY))"
|
|
|
|
|
|
|
|
# Which text do we want to use?
|
|
|
|
case "${2}" in
|
|
|
|
"create")
|
|
|
|
PROGRESS_BASE_STRING="Preparing local OTA package"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
PROGRESS_BASE_STRING="Updating KOReader"
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# And start drawing the progress bar...
|
|
|
|
PROGRESS_STRING=""
|
|
|
|
for _ in $(seq 1 ${PROGRESS_AMOUNT}); do
|
|
|
|
# Fill the progress bar...
|
|
|
|
PROGRESS_STRING="${PROGRESS_STRING}."
|
|
|
|
done
|
|
|
|
|
|
|
|
# Print our progress :)
|
|
|
|
eips_print_bottom_centered "${PROGRESS_BASE_STRING}" 3
|
|
|
|
eips_print_bottom_centered "${PROGRESS_STRING}" 2
|