More robust way to detect our own path on Kobo (#6283)

* More robust way to detect our own path on Kobo

Should take care of all the weird and interesting ways people manage to
find to break it...

NOTE: "$(dirname $(realpath "${0}"))" works, too, but I'm not sure if
really old devices ship with the realpath applet...

* Abort early if KOREADER_DIR is null
reviewable/pr6286/r1
NiLuJe 4 years ago committed by GitHub
parent a9d4e97115
commit 416c1c7356
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,11 +1,11 @@
#!/bin/sh
export LC_ALL="en_US.UTF-8"
# working directory of koreader
KOREADER_DIR="${0%/*}"
# Compute our working directory in an extremely defensive manner
KOREADER_DIR="$(CDPATH='' cd -- "$(dirname -- "$0")" && pwd -P)"
# we're always starting from our working directory
cd "${KOREADER_DIR}" || exit
# We rely on starting from our working directory, and it needs to be set, sane and absolute.
cd "${KOREADER_DIR:-/dev/null}" || exit
# Attempt to switch to a sensible CPUFreq governor when that's not already the case...
IFS= read -r current_cpufreq_gov <"/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor"

Loading…
Cancel
Save