- Go 77.2%
- Makefile 22.8%
| internal | ||
| .gitignore | ||
| go.mod | ||
| go.sum | ||
| Makefile | ||
| README.md | ||
| rocket.go | ||
| rocket.yml | ||
Rocket
A small PocketBook app to synchronize your books from a Git repository.
Rationale
I don't always connect my PocketBook to my PC to synchronize books, which I actually keep inside a Git repository.
This allows me to easily add a new book from/to any device that has a Git client, my phone/e-ink tablet included.
After careful consideration, I picked up Golang as the tool for the job since it compiles a (semi-)static binary.
Development
You'll need the PocketBook SDK downloaded somewhere on your development machine.
You can put the PocketBook SDK in ~/sdks/pocketbook, or create a Makefile.env file in the root of this repository and put the following:
# Path to PocketBook SDK root. Inside you have the SDK-B288 directory.
POCKETBOOK_SDK_ROOT := ${HOME}/path/to/pocketbook-sdk-root
Building
Development build
The development build is made to run in normal Linux console, so you can test it locally before putting it on your device.
make dev
./rocket.app -h
Production build
The production build is built against the PocketBook SDK and is meant to run on an actual PocketBook device.
make prod
No-config build
You can build a no-config version of the app with all settings pre-compiled.
Add something like the following to your Makefile.env:
# No-config build variables
# In this example I'm using a SSH key with newlines escaped as "\n"
NOCONF_CONFIG :=
NOCONF_AUTHENTICATION := -----BEGIN OPENSSH PRIVATE KEY-----\n[...]\n-----END OPENSSH PRIVATE KEY-----
NOCONF_KNOWN_HOSTS_DB := /mnt/ext1/.known_hosts
NOCONF_REPOSITORY := git@github.com:user/books.git
NOCONF_BRANCH := master
NOCONF_DESTINATION := /mnt/ext1/Books
NOCONF_RESET := false
default: help
noconf:
CC=$(POCKETBOOK_CC) \
CGO_ENABLED=1 \
GOOS=linux \
GOARCH=arm \
GOARM=7 \
go build \
-o rocket.app \
-tags='pocketbook' \
-ldflags='-X "main.version=$(VERSION)" -X "main.defaultConfig=$(NOCONF_CONFIG)" -X "main.defaultAuthentication=$(NOCONF_AUTHENTICATION)" -X "main.defaultKnownHostsDB=$(NOCONF_KNOWN_HOSTS_DB)" -X "main.defaultRepository=$(NOCONF_REPOSITORY)" -X "main.defaultBranch=$(NOCONF_BRANCH)" -X "main.defaultDestination=$(NOCONF_DESTINATION)" -X "main.defaultReset=$(NOCONF_RESET)"'
Then build it:
make noconf
Installation
Release
Download rocket.app and rocket.yml from the latest release.
Put the files in the applications directory on your PocketBook.
Local build
Build either prod or noconf and do the same as above.
You can skip the rocket.yml file for a noconf build.
Configuration
If you install rocket.app from a release or from prod build, you'd need to edit rocket.yml accordingly.
Testing
Tested on InkPad 4 (PB743.)