Skip to content

Commit

Permalink
Add a script for generating *standalone* packages
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed May 30, 2020
1 parent 96f7e01 commit ff82f58
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
/dictionaries
/src/mupdf_wrapper/*/
/dist
/standalone
/plato-*.zip
/thirdparty/*/*
!/thirdparty/*/*kobo*
4 changes: 4 additions & 0 deletions contrib/NickelMenu/plato
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
menu_item :main :Reboot in Plato :cmd_output :200:quiet:touch /usr/local/Plato/bootlock
chain_success :power :reboot
menu_item :main :Start Plato :cmd_spawn :quiet:/usr/local/Plato/plato.sh
menu_item :main :Copy Logs :cmd_spawn :quiet:cp /usr/local/Plato/*.log /mnt/onboard/.adds/plato
1 change: 1 addition & 0 deletions dist.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

[ -d bin ] || ./download.sh 'bin/*'
[ -d hyphenation-patterns ] || ./download.sh 'hyphenation-patterns/*'
[ -e target/arm-unknown-linux-gnueabihf/release/plato ] || ./build.sh

mkdir -p dist/libs
mkdir dist/dictionaries
Expand Down
16 changes: 1 addition & 15 deletions doc/GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,6 @@
## Install

Extract the archive given on the [release page](https://github.com/baskerville/plato/releases):

```sh
mkdir -p SD_ROOT/.adds/plato
unzip plato-VERSION.zip -d SD_ROOT/.adds/plato
```

`SD_ROOT` is the (platform dependent) root of the SD card.

### Launchers

Pick one launcher:

- [NickelMenu](https://github.com/geek1011/NickelMenu).
- [kfmon](https://github.com/niluje/kfmon).
Pick one of the [one-click install packages](https://www.mobileread.com/forums/showthread.php?t=314220).

## Configure

Expand Down
49 changes: 49 additions & 0 deletions standalone.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#! /bin/sh

if [ "$#" -lt 2 ] ; then
printf "Usage: %s FIRMWARE_ARCHIVE NICKEL_MENU_ARCHIVE\n" "${0##*/}" >&2
exit 1
fi

[ -d dist ] || ./dist.sh
[ -d standalone ] && rm -Rf standalone

FIRMWARE_ARCHIVE=$1
NICKEL_MENU_ARCHIVE=$2

mkdir standalone
cd standalone || exit 1

unzip "$FIRMWARE_ARCHIVE" KoboRoot.tgz
tar -xzvf KoboRoot.tgz etc/init.d/rcS
patch -p 1 < ../contrib/firmware.patch || exit 1
rm KoboRoot.tgz

unzip "$NICKEL_MENU_ARCHIVE" KoboRoot.tgz
tar -xzvf KoboRoot.tgz
rm KoboRoot.tgz
mv mnt/onboard/.adds .
rm -Rf mnt

mkdir -p usr/local
mkdir -p .adds/plato

mv ../dist usr/local/Plato
for name in bin css dictionaries hyphenation-patterns keyboard-layouts ; do
mv usr/local/Plato/"$name" .adds/plato
ln -s /mnt/onboard/.adds/plato/"$name" usr/local/Plato
done

ln -s /mnt/onboard/.adds/plato/Settings.toml usr/local/Plato/Settings.toml
cp ../contrib/NickelMenu/plato .adds/nm

mkdir .kobo
tar -czvf .kobo/KoboRoot.tgz etc usr
rm -Rf etc usr

FIRMWARE_VERSION=$(basename "$FIRMWARE_ARCHIVE" .zip)
FIRMWARE_VERSION=${FIRMWARE_VERSION##*-}
PLATO_VERSION=$(cargo pkgid | cut -d '#' -f 2)

zip -r plato-standalone-"$PLATO_VERSION"-fw_"$FIRMWARE_VERSION".zip .adds .kobo
rm -Rf .adds .kobo

0 comments on commit ff82f58

Please sign in to comment.