Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create rmfakecloud-proxy package #448

Merged
merged 19 commits into from
Dec 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0df1972
Create rmfakecloud-proxy package
matteodelabre Sep 26, 2021
2ffa84e
Fix formatting
matteodelabre Sep 29, 2021
7fbea68
Add more dependencies to the service
matteodelabre Sep 30, 2021
64541de
Fix unbound variable in rmfakecloudctl
matteodelabre Sep 30, 2021
0f1d68a
set-upstream: Show enable prompt in all cases if disabled
matteodelabre Sep 30, 2021
3cb7cf0
Replace wrapper with yaml config file
matteodelabre Sep 30, 2021
b6b68a5
Remove leftover checksum entry
matteodelabre Sep 30, 2021
21b10ab
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre Oct 5, 2021
0fe270c
Remove pgrep dependency & properly wait for process termination
matteodelabre Oct 5, 2021
b656ee4
Force using /usr/bin/xargs
matteodelabre Oct 5, 2021
4096e93
Add back dependency on pgrep + add findutils dep
matteodelabre Oct 6, 2021
5c43b0b
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre Oct 6, 2021
4dc0c97
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre Oct 15, 2021
63badc6
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre Oct 15, 2021
76f7686
Merge branch 'testing' into package/rmfakecloud-proxy/create
Eeems Nov 22, 2021
d8ac4ba
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre Nov 26, 2021
be4ea86
Rollback failed or interrupted installs
matteodelabre Nov 27, 2021
1a475f5
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre Nov 27, 2021
26f481b
Merge branch 'testing' into package/rmfakecloud-proxy/create
Eeems Dec 4, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
82 changes: 82 additions & 0 deletions package/rmfakecloud-proxy/package
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
#!/usr/bin/env bash
# Copyright (c) 2021 The Toltec Contributors
# SPDX-License-Identifier: MIT

pkgnames=(rmfakecloud-proxy)
pkgdesc="Connect Xochitl to a rmfakecloud server"
_url=https://github.com/ddvk/rmfakecloud-proxy
url="$_url"
_upver=0.0.3
pkgver="$_upver-1"
timestamp=2021-09-26T20:38:44Z
section="utils"
maintainer="Mattéo Delabre <[email protected]>"
license=MIT
installdepends=(procps-ng-pgrep findutils)

image=golang:v2.2
source=(
"https://github.com/ddvk/rmfakecloud-proxy/archive/v$_upver.zip"
rmfakecloudctl
rmfakecloud-proxy.service
)
sha256sums=(
eaa3fdcce250e23f368a4c9ddcfb99ff178decf31b2a7f84501dfc6fdb2e6d8f
SKIP
SKIP
)

build() {
eval "$(go env)"
cat > version.go << GO
package main
const Version = "rmfakecloud-proxy ${_upver%-*} ($GOOS-$GOARCH) $GOVERSION\n$_url"
GO

GOARCH=arm GOARM=7 go build -ldflags="-w -s" -o dist/rmfakecloud-proxy
}

package() {
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/dist/rmfakecloud-proxy
install -D -m 755 -t "$pkgdir"/opt/bin "$srcdir"/rmfakecloudctl
install -D -m 644 -t "$pkgdir"/lib/systemd/system "$srcdir"/rmfakecloud-proxy.service
}

configure() {
# shellcheck source=rmfakecloudctl
source /opt/bin/rmfakecloudctl
systemctl daemon-reload

# Sync the proxy state to the value of its configuration flag
if is-enabled; then
# This branch is reached when upgrading the package
install-certificates
systemctl enable --now rmfakecloud-proxy
install-hosts
else
uninstall-certificates
systemctl disable --now rmfakecloud-proxy
uninstall-hosts
fi

if ! is-enabled; then
cat << MSG

Run the following commands to use rmfakecloud-proxy:

$ rmfakecloudctl set-upstream https://your-server.example.org
$ rmfakecloudctl enable

Replace your-server.example.org with the address of the server you want to use.

MSG
fi
}

preremove() {
rmfakecloudctl disable
}

postremove() {
systemctl daemon-reload
}
15 changes: 15 additions & 0 deletions package/rmfakecloud-proxy/rmfakecloud-proxy.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[Unit]
Description=rmfakecloud reverse proxy
Documentation=https://github.com/ddvk/rmfakecloud-proxy
After=home.mount network.target
Before=xochitl.service launcher.service
ConditionPathExists=/opt/etc/rmfakecloud-proxy/enabled
ConditionPathExists=/opt/etc/rmfakecloud-proxy/config

[Service]
Environment=HOME=/home/root
ExecStart=/opt/bin/rmfakecloud-proxy -c /opt/etc/rmfakecloud-proxy/config
Restart=on-failure

[Install]
WantedBy=multi-user.target
Loading