remarkable_printer/Makefile
Jonas Große Sundrup d1fe37662a
socket-activate printer
Previous to this commit, the printer needs to continuously run in the
background, even if it doesn't do much most of the time, to keep the
socket open and handle incoming connections. This commit hands over
handling the open socket to systemd and the printer-code gets started by
systemd only when there is something incoming on the socket. The printer
itself then takes over the socket from systemd, handles the incoming
data and exits afterwards, returning socket management to systemd again.

This reduces running processes as well as the memory footprint of the
running system.
2020-12-29 14:30:30 +01:00

48 lines
1.2 KiB
Makefile

.ONESHELL:
.SILENT:
host=10.11.99.1
printer.arm:
go get ./...
env GOOS=linux GOARCH=arm GOARM=5 go build -o printer.arm
printer.x86:
go get ./...
go build -o printer.x86
# get latest prebuilt releases
.PHONY: download_prebuilt
download_prebuilt:
curl -LO http://github.com/evidlo/remarkable_printer/releases/latest/download/release.zip
unzip release.zip
# install to device
.PHONY: install
install: printer.arm
eval $(shell ssh-agent -s)
ssh -o AddKeysToAgent=yes root@$(host) systemctl stop printer || true
scp printer.arm root@$(host):
scp printer.service root@$(host):/etc/systemd/system
scp printer.socket root@$(host):/etc/systemd/system
ssh root@$(host) systemctl daemon-reload
ssh root@$(host) systemctl enable printer.socket
ssh root@$(host) systemctl restart printer.socket
.PHONY: release
release: printer.arm printer.x86
rm -f release.zip
zip release.zip printer.arm printer.x86 printer.service printer.socket -r
.PHONY: install_config
install_config:
sudo lpadmin -p reMarkable \
-E \
-o printer-error-policy=abort-job \
-v socket://$(host) \
-P remarkable.ppd
# -m lsb/usr/cupsfilters/Generic-PDF_Printer-PDF.ppd
clean:
rm -f printer.x86 printer.arm release.zip