From a6a2b3d6a3ea03448bc27f31071b1ca48230edaf Mon Sep 17 00:00:00 2001 From: NiLuJe Date: Mon, 27 Apr 2015 13:15:02 +0200 Subject: [PATCH] Try to get the Kobo codename from the env first My batch of startup script tweaks should ensure PRODUCT is always exported. Leave the fallback in place, to avoid blowing up in weird corner-cases I haven't thought about. --- frontend/device/kobo/device.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/device/kobo/device.lua b/frontend/device/kobo/device.lua index e2529a908..49a135f67 100644 --- a/frontend/device/kobo/device.lua +++ b/frontend/device/kobo/device.lua @@ -108,9 +108,14 @@ function Kobo:init() end function Kobo:getCodeName() - local std_out = io.popen("/bin/kobo_config.sh 2>/dev/null", "r") - local codename = std_out:read() - std_out:close() + -- Try to get it from the env first + local codename = os.getenv("PRODUCT") + -- If that fails, run the script ourselves + if not codename then + local std_out = io.popen("/bin/kobo_config.sh 2>/dev/null", "r") + codename = std_out:read() + std_out:close() + end return codename end