mirror of https://github.com/koreader/koreader
Koreader Ubuntu-touch port
Currently only tested on Ubuntu-touch emulator with framework ubuntu-sdk-14.10 for armhf. The ubuntu-touch port is binary compatible with the Kobo port major changes in this PR are: 1. rename the emulator device to sdl device since both the emulator and the ubuntu-touch target use libsdl to handle input/output. 2. ubuntu-touch app has no write access to the installation dir so all write-outs should be in a seperate dir definded in `datastorage`.pull/1660/head
parent
c44d9fa595
commit
a60544b1ad
@ -1,14 +1,38 @@
|
||||
-- need low-level mechnism to detect android to avoid recursive dependency
|
||||
local isAndroid = pcall(require, "android")
|
||||
local lfs = require("libs/libkoreader-lfs")
|
||||
|
||||
local DataStorage = {}
|
||||
|
||||
function DataStorage:getDataDir()
|
||||
local data_dir
|
||||
if isAndroid then
|
||||
return "/sdcard/koreader/"
|
||||
data_dir = "/sdcard/koreader/"
|
||||
elseif os.getenv("UBUNTU_APPLICATION_ISOLATION") then
|
||||
local app_id = os.getenv("APP_ID")
|
||||
local package_name = app_id:match("^(.-)_")
|
||||
-- confinded ubuntu app has write access to this dir
|
||||
data_dir = os.getenv("XDG_DATA_HOME") .. "/" .. package_name
|
||||
else
|
||||
return "./"
|
||||
data_dir = "./"
|
||||
end
|
||||
if lfs.attributes(data_dir, "mode") ~= "directory" then
|
||||
lfs.mkdir(data_dir)
|
||||
end
|
||||
return data_dir
|
||||
end
|
||||
|
||||
local function initDataDir()
|
||||
local data_dir = DataStorage:getDataDir()
|
||||
local sub_data_dirs = {"cache", "clipboard", "data", "history", "ota", "screenshots"}
|
||||
for _, dir in ipairs(sub_data_dirs) do
|
||||
local sub_data_dir = data_dir .. "/" .. dir
|
||||
if lfs.attributes(sub_data_dir, "mode") ~= "directory" then
|
||||
lfs.mkdir(sub_data_dir)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
initDataDir()
|
||||
|
||||
return DataStorage
|
||||
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"policy_groups": [
|
||||
"networking"
|
||||
],
|
||||
"read_path": [
|
||||
"@{HOME}/",
|
||||
"/media/*/*/[Dd][Oo][Cc][Uu][Mm][Ee][Nn][Tt][Ss]/",
|
||||
"@{PROC}/*/mounts",
|
||||
"/dev/disk/by-label/"
|
||||
],
|
||||
"write_path": [
|
||||
"@{HOME}/"
|
||||
],
|
||||
"policy_version": 1.2
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
[Desktop Entry]
|
||||
Name=Koreader
|
||||
Comment=Koreader for Ubuntu touch
|
||||
Exec=koreader.sh
|
||||
Icon=koreader.png
|
||||
Terminal=false
|
||||
Type=Application
|
||||
MimeType=application/pdf;application/epub+zip
|
||||
X-Ubuntu-Touch=true
|
||||
X-Ubuntu-Supported-Orientations=portrait
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
@ -0,0 +1,31 @@
|
||||
#!/bin/sh
|
||||
export LC_ALL="en_US.UTF-8"
|
||||
|
||||
# working directory of koreader
|
||||
KOREADER_DIR="${0%/*}"
|
||||
|
||||
# update to new version from OTA directory
|
||||
NEWUPDATE="${KOREADER_DIR}/ota/koreader.updated.tar"
|
||||
INSTALLED="${KOREADER_DIR}/ota/koreader.installed.tar"
|
||||
if [ -f $NEWUPDATE ]; then
|
||||
# TODO: any graphic indication for the updating progress?
|
||||
cd .. && tar xf $NEWUPDATE && mv $NEWUPDATE $INSTALLED
|
||||
fi
|
||||
|
||||
# we're always starting from our working directory
|
||||
cd $KOREADER_DIR
|
||||
|
||||
# export load library path for some old firmware
|
||||
export LD_LIBRARY_PATH=${KOREADER_DIR}/libs:$LD_LIBRARY_PATH
|
||||
|
||||
# export trained OCR data directory
|
||||
export TESSDATA_PREFIX="data"
|
||||
|
||||
# export external font directory
|
||||
export EXT_FONT_DIR="~/fonts"
|
||||
|
||||
# set fullscreen mode
|
||||
export SDL_FULLSCREEN=1
|
||||
|
||||
./reader.lua -d ~/Documents
|
||||
|
@ -0,0 +1,15 @@
|
||||
{
|
||||
"architecture": "armhf",
|
||||
"description": "An ebook reader application supports PDF, DJVU, EPUB, FB2 and much more, running on Kindle, Kobo, PocketBook, Ubuntu touch and Android devices",
|
||||
"framework": "ubuntu-sdk-14.10",
|
||||
"hooks": {
|
||||
"koreader": {
|
||||
"apparmor": "koreader.apparmor",
|
||||
"desktop": "koreader.desktop"
|
||||
}
|
||||
},
|
||||
"maintainer": "Huang Xin <chrox.huang@gmail.com>",
|
||||
"name": "org.koreader.koreader",
|
||||
"title": "Koreader for Ubuntu touch",
|
||||
"version": "0.0.1"
|
||||
}
|
@ -0,0 +1 @@
|
||||
Subproject commit 1d0cd7583c27025a69e340ac77cab3c53cdef8ba
|
Loading…
Reference in New Issue