Skip to content

Commit 7a42f41

Browse files
matteodelabreEeems
andcommitted
Create rmfakecloud-proxy package (#448)
This PR provides a new package intended to ease the setup of rmfakecloud on a device. [rmfakecloud](https://github.com/ddvk/rmfakecloud) is an alternative Xochitl sync server developed by ddvk that anyone can self-host. With this package, connecting to an rmfakecloud server only takes a few steps: * `opkg install rmfakecloud-proxy` * `rmfakecloudctl set-upstream https://...` (define the server to use) * `rmfakecloudctl enable` One can then run `rmfakecloudctl disable` (or uninstall the package) to revert back to the default reMarkable servers. Co-authored-by: Nathaniel van Diepen <[email protected]>
1 parent 469aa83 commit 7a42f41

File tree

3 files changed

+457
-0
lines changed

3 files changed

+457
-0
lines changed

package/rmfakecloud-proxy/package

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
#!/usr/bin/env bash
2+
# Copyright (c) 2021 The Toltec Contributors
3+
# SPDX-License-Identifier: MIT
4+
5+
pkgnames=(rmfakecloud-proxy)
6+
pkgdesc="Connect Xochitl to a rmfakecloud server"
7+
_url=https://github.com/ddvk/rmfakecloud-proxy
8+
url="$_url"
9+
_upver=0.0.3
10+
pkgver="$_upver-1"
11+
timestamp=2021-09-26T20:38:44Z
12+
section="utils"
13+
maintainer="Mattéo Delabre <[email protected]>"
14+
license=MIT
15+
installdepends=(procps-ng-pgrep findutils)
16+
17+
image=golang:v2.2
18+
source=(
19+
"https://github.com/ddvk/rmfakecloud-proxy/archive/v$_upver.zip"
20+
rmfakecloudctl
21+
rmfakecloud-proxy.service
22+
)
23+
sha256sums=(
24+
eaa3fdcce250e23f368a4c9ddcfb99ff178decf31b2a7f84501dfc6fdb2e6d8f
25+
SKIP
26+
SKIP
27+
)
28+
29+
build() {
30+
eval "$(go env)"
31+
cat > version.go << GO
32+
package main
33+
const Version = "rmfakecloud-proxy ${_upver%-*} ($GOOS-$GOARCH) $GOVERSION\n$_url"
34+
GO
35+
36+
GOARCH=arm GOARM=7 go build -ldflags="-w -s" -o dist/rmfakecloud-proxy
37+
}
38+
39+
package() {
40+
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/dist/rmfakecloud-proxy
41+
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/rmfakecloudctl
42+
install -D -m 644 -t "$pkgdir"/lib/systemd/system "$srcdir"/rmfakecloud-proxy.service
43+
}
44+
45+
configure() {
46+
# shellcheck source=rmfakecloudctl
47+
source /opt/bin/rmfakecloudctl
48+
systemctl daemon-reload
49+
50+
# Sync the proxy state to the value of its configuration flag
51+
if is-enabled; then
52+
# This branch is reached when upgrading the package
53+
install-certificates
54+
systemctl enable --now rmfakecloud-proxy
55+
install-hosts
56+
else
57+
uninstall-certificates
58+
systemctl disable --now rmfakecloud-proxy
59+
uninstall-hosts
60+
fi
61+
62+
if ! is-enabled; then
63+
cat << MSG
64+
65+
Run the following commands to use rmfakecloud-proxy:
66+
67+
$ rmfakecloudctl set-upstream https://your-server.example.org
68+
$ rmfakecloudctl enable
69+
70+
Replace your-server.example.org with the address of the server you want to use.
71+
72+
MSG
73+
fi
74+
}
75+
76+
preremove() {
77+
rmfakecloudctl disable
78+
}
79+
80+
postremove() {
81+
systemctl daemon-reload
82+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[Unit]
2+
Description=rmfakecloud reverse proxy
3+
Documentation=https://github.com/ddvk/rmfakecloud-proxy
4+
After=home.mount network.target
5+
Before=xochitl.service launcher.service
6+
ConditionPathExists=/opt/etc/rmfakecloud-proxy/enabled
7+
ConditionPathExists=/opt/etc/rmfakecloud-proxy/config
8+
9+
[Service]
10+
Environment=HOME=/home/root
11+
ExecStart=/opt/bin/rmfakecloud-proxy -c /opt/etc/rmfakecloud-proxy/config
12+
Restart=on-failure
13+
14+
[Install]
15+
WantedBy=multi-user.target

0 commit comments

Comments
 (0)