2
0
mirror of https://github.com/koreader/koreader synced 2024-11-13 19:11:25 +00:00
koreader/platform/kindle/kotar_cpoint
Frans de Jonge e8c01274f4 Travis: enforce shellscript coding style
* enormous coding style update

* update luajit-launcher

All changes are formatting only except for:

* new more correct pushd/popd style
	* keeps useful indentation
	* prevents execution of commands when pushd failed (cf. https://github.com/koalaman/shellcheck/wiki/SC2164 and https://github.com/koalaman/shellcheck/issues/863)

```
pushd some_dir && {
    command1
    command2
} || exit
popd
```
2017-04-11 15:30:23 +02:00

32 lines
873 B
Bash
Executable File

#!/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 chekpoint number, and we get one every 200 checkpoints.
CHECKPOINT_NUM="${1}"
CHECKPOINT_GRANULARITY="200"
# Use that to build a poor man's progress bar, with dots.
PROGRESS_AMOUNT="$((CHECKPOINT_NUM / CHECKPOINT_GRANULARITY))"
PROGRESS_STRING="Updating koreader "
for _ in $(seq 1 ${PROGRESS_AMOUNT}); do
# Append a dot until we hit the needed amount
PROGRESS_STRING="${PROGRESS_STRING}."
done
# Print our progress :)
eips_print_bottom_centered "${PROGRESS_STRING}" 1