11-01-2017, 06:40 AM | #61 | |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Quote:
file1="/mnt/onboard/wikipedia/library/library.xml" to minimize errors with the libraries. New folder structure, so that the path in library.xml must not be changed: \wikipedia\content\gutenberg_de.zim \wikipedia\content\rezeptewiki_de.zim \wikipedia\library\library.xml and if fulltext search is wished:: \wikipedia\index\rezeptewiki_de.zim.idx\some_index _files_here but I'm waiting for editing privileges on https://www.e-reader-forum.de/ebook-...anderen-kobos/ |
|
11-01-2017, 07:47 AM | #62 | |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
One problem I see is that the server is run from the user partition, which can be dangerous when connecting to the pc via usb. I guess, KSM refuses to connect via usb, after you start the server. Moving kiwix-serve to the system partition might also be a problem, since space is very limited. (I guess the ifconfig provided of the package is not necessary, the onboard version will do.) For the time being I would start and kill ("killall kiwix-serve") manually. |
|
Advert | |
|
11-01-2017, 07:51 AM | #63 | |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
Quote:
KSM users should install the KoboRoot.tgz by selecting "install partial update" (rather than "install update"), this prevents rcS to be overwritten. And then they need a way to start the server (and maybe also to kill it; see the previous post.) |
|
11-01-2017, 12:06 PM | #64 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
@nhedgehog
I finally installed your package (without rcS and ifconfig) and the cook book wiki on my Touch FW 4.6.9995. The server was starting and I did not get any error message in the log file. However, nothing appeared in the web browser. I thought I might just have done some typo with the index file, and did not worry about it (I had no intention to read the cook book anyway). Then something different attracted my attention. Since the file size of kiwix-serve is a problem for KSM users (if they want to put it on the system partition), I looked for a smaller one. I took the one from http://wiki.kiwix.org/wiki/Software, and all of a sudden I could see the cook book wiki in the web browser. I tried several times with your and the wiki.kiwix.org's version. Only the wiki.kiwix.org's version worked for me. Last edited by tshering; 11-01-2017 at 12:48 PM. |
11-01-2017, 01:16 PM | #65 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Strange, I know this version, it is quite old but much smaller than the newer one. I used it on my Bookeen device before. Don't know the differences between the versions.
I guess due to the smaller RAM size from the Kobo Touch it is working better on that device. My version comes from the nightly builds (forgot to mention it): http://download.kiwix.org/nightly/ kiwix-tools_armhf*- I took the version 2017.10.13 They didn't compile the arm version for some years but started compiling it again this year. But you did configure the loopback interface via: ifconfig lo 127.0.0.1 up or not? Edit: I'm using the version I provided on my Touch HD reading ebooks only with Coolreader but starting into Nickel for some weeks now (FW.3.19.5761). I did not experience any negative issues coming from runnig kiwix-serve in the background. Last edited by nhedgehog; 11-01-2017 at 01:31 PM. |
Advert | |
|
11-01-2017, 01:30 PM | #66 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
|
11-01-2017, 01:50 PM | #67 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
|
11-01-2017, 01:54 PM | #68 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
The problem is that the user partition cannot be cleanly unmounted in this situation. Users of the Kobo Utilities Plugin for calibre are most likely to see the effect of this (a corruption of the data base).
|
11-01-2017, 02:03 PM | #69 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
I just thought it is obvious that I did it, since I reported that I had success with the old/small version of kiwix-serve. ifconfig is provided by busybox, and pointed at by /sbin/ifconfig.
|
11-01-2017, 02:58 PM | #70 | |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
Quote:
I don't use the Kobo Utilities Plugin for calibre, so I guess that helped. What do you suggest? Adding some safety measure into /usr/local/Kobo/udev/usb or is this called to late? |
|
11-01-2017, 03:54 PM | #71 |
Wizard
Posts: 3,489
Karma: 2914715
Join Date: Jun 2012
Device: kobo touch
|
I think this should work. KSM however prevents this file from being overwritten when the user is updating by "install partial update." I will add your code to KSM when it is ready.
|
11-02-2017, 10:26 AM | #72 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
I did change the installation file and managed to stop and start kiwix-serve during USB connect. Since "/usr/local/Kobo/udev/usb" changed during recent updates, there are 2 installation files now, depending on the firmware version. If the wrong version is installed, USB connection ist lost. To prevent accidental bricking of devices I wrote an extensive tutorial in German and English. Hope that someone will find it useful. Went back to the older version of kiwix-serve, since I couldn't find any flaws in it and it seems to be supporting more devices. Everything can be downloaded at:
http://bit.ly/2zlYaCL Last edited by nhedgehog; 11-05-2017 at 02:41 PM. |
11-06-2017, 04:32 AM | #73 |
Junior Member
Posts: 9
Karma: 2004
Join Date: Nov 2017
Device: Kobo H2O
|
Hi, here's my solution.
I use the excellent webportal local web server plugin. https://www.mobileread.com/forums/sh...d.php?t=262353 I put all Kiwix binaries and zim files in a ext4 second partition on a 128 Go SD-Card (yes, you can, never tried 256 Go because I don't have one). The Kobo browser is patched to work offline. With telnet or ssh Code:
# mkdir /mnt/wikipedia Code:
#!/bin/sh if [ "$STARTUP" == "1" ]; then exit; fi # check whether nickel is running [ "$(pidof nickel | wc -w)" != "0" ] && nickelisrunning=true || nickelisrunning=false MODULE_LOADED=`lsmod | grep -c g_file_storage` if [ $MODULE_LOADED -gt 0 ]; then if [ "$ACTION" == "remove" ]; then [ "$nickelisrunning" == "true" ] && echo sd $ACTION $DEVNAME >> /tmp/nickel-hardware-status ACTION=remove /usr/local/Kobo/udev/plug sleep 5 exit fi fi DEV="/dev/mmcblk1p1" MOUNTARGS="noatime,nodiratime,shortname=mixed,utf8" if [ "$DEV" == "$DEVNAME" ]; then if [ "$ACTION" == "add" ]; then dosfsck -a -w $DEVNAME mount /dev/mmcblk1p2 /mnt/wikipedia mount -r -t vfat -o $MOUNTARGS $DEVNAME /mnt/sd if [ $? != 0 ]; then [ "$nickelisrunning" == "true" ] && echo sd mount fail $DEVNAME >> /tmp/nickel-hardware-status & else [ "$nickelisrunning" == "true" ] && echo sd $ACTION $DEVNAME >> /tmp/nickel-hardware-status & [ -e "/mnt/sd/autoscript.sh" ] && sh /mnt/sd/autoscript.sh fi fi fi if [ "$ACTION" == "remove" ]; then [ "$nickelisrunning" == "true" ] && echo sd $ACTION $DEVNAME >> /tmp/nickel-hardware-status & umount -l /mnt/sd umount -l /mnt/wikipedia sync fi Code:
#!/bin/sh # --- Constants: --- TMPFILE=/tmp/servicemenu ZIMEXT=zim ZIMFOLDER=/mnt/wikipedia/ KIWIXM=/mnt/wikipedia/kiwix-manage KIWIXS=/mnt/wikipedia/kiwix-serve WIKIXML=/mnt/wikipedia/wiki.xml # --- Helpers: --- _chunk() { CHUNK="$1" printf "%X\r\n" ${#CHUNK} printf "%s\r\n" "$CHUNK" } # htmlspecialchars _htmlspecialchars() { echo -n "$1" | sed -r -e 's@&@\&@g' -e 's@[""]@\"@g' -e 's@<@\<@g' -e 's@>@\>@g' } # urlencode _urlencode() { echo -n "$1" | hexdump -v -e '/1 "%02x"' | sed -r -e 's@..@%&@g' } # parse a=b&c=d data _parse() { PREFIX=$1 DATA=$2 while [ "$DATA" != "" ] do FIELD="`echo "$DATA" | cut -d '&' -f 1`" DATA="${DATA:$((${#FIELD}+1))}" key="`echo "$FIELD" | cut -d '=' -f 1 | sed -r -e s@[^a-zA-Z0-9_]@_@g`" value="`echo "$FIELD" | cut -s -d '=' -f 2-'`" if [ "$key" != "" ] then eval "$PREFIX""$key"'="`httpd -d "$value"`"' fi done } # print header _header() { echo -n -e 'HTTP/1.1 200 OK\r\n' echo -n -e 'CONTENT-Type: text/html; charset=UTF-8\r\n' echo -n -e 'Transfer-Encoding: chunked\r\n' echo -n -e 'Cache-Control: no-cache, must-revalidate\r\n' echo -n -e 'Expires: Thu, 01 Jan 1970 01:10:00 +0100\r\n' echo -n -e '\r\n' # echo -n -e 'CONTENT-Type: text/html; charset=UTF-8\r\n\r\n' _chunk "`printf "%4096s" " "`" _chunk '<html><head><style type="text/css">' _chunk 'input, textarea, select { border: 1px solid #555; padding: 0.5em; font-size: 15px; line-height: 1.2em; width: 95%; background: #fff; background: -webkit-gradient(linear, left top, left bottom, from(#fff), to(#ccc)); -webkit-appearance: none; -webkit-box-shadow: 1px 1px 1px #fff; -webkit-border-radius: 0.5em; } ' _chunk ' #progress { margin: 0px auto; width: 60%; height: 30px; border: 8px double #222; overflow: hidden; background: #fff; } #progressbar { width: 0%; height: 30px; border-right: 4px solid #000; background: #aaa; position: relative; text-align: center; font-size: 25px; }' _chunk '</style></head><body>' _chunk '<h1>Kiwix Menu</h1>' } # print footer _footer() { _chunk '<hr>' # extra links query="$1" shift text="$1" shift while [ "$text" != "" ] do _chunk '<a href="?'$query'">'$text'</a> | ' query="$1" shift text="$1" shift done # standard footer _chunk '<a href="?">Back to Kiwix Menu</a>' _chunk '</body></html>' _chunk '' # terminator exit } # print error message # argument: msg _die() { _chunk "<p>Error: $1</p>" _footer exit } # print yesno dialog # argument: question yesquery noquery _yesno() { _chunk "<p> $1 </p>" #_chunk '<a href="?'$2'">Yes</a> <a href="?'$3'">No</a>' _footer "$2" Yes "$3" No exit } # print progress bar _progressbar() { TOTAL="$1" CURRENT="$2" percent=$(($CURRENT*100/$TOTAL)) _chunk '<div id="progress"><div style="width: '$percent'% !important;" id="progressbar">'$percent'%</div></div>' } # --- Views: --- _view() { case "$GETaction" in "") _view_list ;; "info") _view_info ;; "kiwixon") _view_kiwixon ;; "kiwixoff") _view_kiwixoff ;; "kiwixupdate") _view_kiwixupdate ;; *) _die "Unknown action: $GETaction" ;; esac } _view_list() { _chunk '<ul>' _chunk '<li><a href="?action=info">Info</a></li>' _chunk '</ul>' _chunk '<br/>' _chunk '<br/>' _chunk '<ul>' _chunk '<li><a href="?action=kiwixon">Start Kiwix Server</a></li>' _chunk '<br/>' _chunk '<li><a href="?action=kiwixoff">Stop Kiwix Server</a></li>' _chunk '<br/>' _chunk '<li><a href="?action=kiwixupdate">Update Kiwix Library</a></li>' _chunk '</ul>' _chunk '<br/>' _chunk '<br/>' } _view_info() { _chunk '<h4>CPU</h4>' _chunk "<pre>$(_htmlspecialchars "$(cat /proc/cpuinfo)")</pre>" _chunk '<h4>RAM</h4>' _chunk "<pre>$(_htmlspecialchars "$(free -m)")</pre>" _chunk '<h4>HDD</h4>' _chunk "<pre>$(_htmlspecialchars "$(df -h)")</pre>" _chunk '<h4>WIFI</h4>' _chunk "<pre>$(_htmlspecialchars "$(iwconfig)")</pre>" _chunk "<pre>$(_htmlspecialchars "$(ifconfig)")</pre>" } _view_kiwixon() { if pidof -s kiwix-serve > /dev/null; then _chunk "Kiwix is already running!" else _chunk "<p>Kiwix starting...</p>" $KIWIXS --daemon --port=8888 --library $WIKIXML sleep 5 if pidof -s kiwix-serve > /dev/null; then _chunk "Kiwix has started!" else _chunk "Error!" fi fi } _view_kiwixoff() { if pidof -s kiwix-serve > /dev/null; then _chunk "<p>Kiwix stopping...</p>" killall -q kiwix-serve sleep 5 if pidof -s kiwix-serve > /dev/null; then _chunk "<p>Retrying...</p>" killall -q kiwix-serve sleep 5 else _chunk "<p>Kiwix has stopped.</p>" fi else _chunk "<p>Already stopped.</p>" fi } _view_kiwixupdate() { _chunk "<p>Please wait...</p>" rm -f $WIKIXML for ZIMCONTENT in $ZIMFOLDER*; do if [ "${ZIMCONTENT}" != "${ZIMCONTENT%.${ZIMEXT}}" ];then $KIWIXM $WIKIXML add $ZIMCONTENT fi done _chunk "<p>Done.</p>" } # --- Main: --- _parse GET "$QUERY_STRING" read POST_STRING _parse POST "$POST_STRING" _header _view _footer # --- End of file. --- I open the browser (the default home page is webportal). I choose the kiwix menu, then I can launch kiwix-serve and go to the bookmark 127.0.0.1:8888 or refresh the list of my zim files with kiwix-manage and generate a new xml file. Because the zim files are on a ext4 partitions I don't have to split them. To acess the zim files with built-in Kobo reader on the good old 3.19.5761 kernel, you can do this: Code:
# mkdir /mnt/onboard/wikipedia Code:
mount /dev/mmcblk1p2 /mnt/wikipedia mount --bind /mnt/wikipedia /mnt/onboard/wikipedia Last edited by h87booky; 11-07-2017 at 08:49 PM. Reason: Confusing location of /usr/local/Kobo/udev/sd with my own mount point |
11-06-2017, 09:58 AM | #74 |
Guru
Posts: 743
Karma: 619508
Join Date: Sep 2013
Device: EnergySistemEreaderPro, Nook STG, Pocketbook 622, Bookeen Cybooks ...
|
I like your version, thanks for sharing.
|
11-07-2017, 09:10 PM | #75 |
Junior Member
Posts: 9
Karma: 2004
Join Date: Nov 2017
Device: Kobo H2O
|
I forgot to mention a little bug.
Kobo database forgets big zim files (I suppose > 4 Go?) after each reboot or switch to KOReader. I have to plugin USB or simulate an USB connection with KSM to resync, then Kobo rediscover the files. No problem with small zim files. Also, the sizes for these big files are completely wrong, for some with a big negative value. However, at the end it works, Kobo builtin reader displays the montruous 62 Go wikipedia_en_all_novid without any slowdown. This bug doesn't affect the kiwixserve/browser method. Last edited by h87booky; 11-07-2017 at 09:20 PM. |
Tags |
guide, kiwix, wikipedia, wikipedia offline, zim |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Offline wikipedia for DR | fekhner | iRex Developer's Corner | 6 | 02-02-2012 07:33 AM |
offline wikipedia ? PLEASE | fsvum | Calibre | 6 | 11-24-2011 07:29 AM |
Wikipedia offline on JB | wyrm | Ectaco jetBook | 3 | 02-20-2011 08:32 AM |
Offline Wikipedia on DR1000S yet? | Traveller | iRex | 0 | 05-31-2010 05:37 PM |
offline Wikipedia on DR1000? Is it possible? | whopper | iRex | 6 | 02-04-2009 03:41 AM |