2018-04-08 20:39:52 +00:00
|
|
|
#!/bin/sh
|
|
|
|
export LC_ALL="en_US.UTF-8"
|
|
|
|
|
|
|
|
# working directory of koreader
|
|
|
|
KOREADER_DIR="${0%/*}"
|
|
|
|
|
|
|
|
# we're always starting from our working directory
|
|
|
|
cd "${KOREADER_DIR}" || exit
|
|
|
|
|
2019-01-17 14:28:18 +00:00
|
|
|
# export load library path
|
2020-02-02 19:35:21 +00:00
|
|
|
export LD_LIBRARY_PATH=${KOREADER_DIR}/libs:${LD_LIBRARY_PATH}
|
2018-04-08 20:39:52 +00:00
|
|
|
|
|
|
|
RETURN_VALUE=85
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
# no arguments
|
2018-04-12 14:06:03 +00:00
|
|
|
if [ -n "${XDG_DOCUMENTS_DIR+x}" ]; then
|
2020-02-02 19:35:21 +00:00
|
|
|
start_path=${XDG_DOCUMENTS_DIR}
|
2018-04-12 14:06:03 +00:00
|
|
|
else
|
|
|
|
start_path=$(pwd)
|
|
|
|
fi
|
2018-04-08 20:39:52 +00:00
|
|
|
else
|
|
|
|
start_path="$*"
|
|
|
|
fi
|
|
|
|
|
2020-02-02 19:35:21 +00:00
|
|
|
while [ ${RETURN_VALUE} -eq 85 ]; do
|
|
|
|
./reader.lua "${start_path}"
|
2018-04-08 20:39:52 +00:00
|
|
|
RETURN_VALUE=$?
|
|
|
|
done
|
|
|
|
|
2020-02-02 19:35:21 +00:00
|
|
|
exit ${RETURN_VALUE}
|