-
Notifications
You must be signed in to change notification settings - Fork 71
Create rmfakecloud-proxy package #448
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
0df1972
Create rmfakecloud-proxy package
matteodelabre 2ffa84e
Fix formatting
matteodelabre 7fbea68
Add more dependencies to the service
matteodelabre 64541de
Fix unbound variable in rmfakecloudctl
matteodelabre 0f1d68a
set-upstream: Show enable prompt in all cases if disabled
matteodelabre 3cb7cf0
Replace wrapper with yaml config file
matteodelabre b6b68a5
Remove leftover checksum entry
matteodelabre 21b10ab
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre 0fe270c
Remove pgrep dependency & properly wait for process termination
matteodelabre b656ee4
Force using /usr/bin/xargs
matteodelabre 4096e93
Add back dependency on pgrep + add findutils dep
matteodelabre 5c43b0b
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre 4dc0c97
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre 63badc6
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre 76f7686
Merge branch 'testing' into package/rmfakecloud-proxy/create
Eeems d8ac4ba
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre be4ea86
Rollback failed or interrupted installs
matteodelabre 1a475f5
Merge branch 'testing' into package/rmfakecloud-proxy/create
matteodelabre 26f481b
Merge branch 'testing' into package/rmfakecloud-proxy/create
Eeems File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,85 @@ | ||
| #!/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 <spam@delab.re>" | ||
| license=MIT | ||
| installdepends=(procps-ng-pgrep) | ||
|
|
||
| image=golang:v2.2 | ||
| source=( | ||
| "https://github.com/ddvk/rmfakecloud-proxy/archive/v$_upver.zip" | ||
| rmfakecloudctl | ||
| rmfakecloud-proxy-wrapper | ||
| rmfakecloud-proxy.service | ||
| ) | ||
| sha256sums=( | ||
| eaa3fdcce250e23f368a4c9ddcfb99ff178decf31b2a7f84501dfc6fdb2e6d8f | ||
| SKIP | ||
| 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 755 -t "$pkgdir"/opt/bin "$srcdir"/rmfakecloud-proxy-wrapper | ||
| 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 | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| #!/usr/bin/env bash | ||
| # Copyright (c) 2021 The Toltec Contributors | ||
| # SPDX-License-Identifier: MIT | ||
|
|
||
| # shellcheck source=rmfakecloudctl | ||
| source /opt/bin/rmfakecloudctl | ||
|
|
||
| if ! is-enabled; then | ||
| echo "rmfakecloud-proxy is not enabled." | ||
| echo "Run 'rmfakecloudctl enable' to enable it." | ||
| exit | ||
| fi | ||
|
|
||
| if ! upstream="$(get-upstream)"; then | ||
| echo "rmfakecloud-proxy server is not configured." | ||
| echo "Use 'rmfakecloudctl set-upstream' to configure it." | ||
| exit | ||
| fi | ||
|
|
||
| exec /opt/bin/rmfakecloud-proxy \ | ||
| -addr "$proxy_listen:443" \ | ||
| -cert "$data_dir/rmfakecloud-proxy.bundle.crt" \ | ||
| -key "$data_dir/rmfakecloud-proxy.key" \ | ||
| "$upstream" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| [Unit] | ||
| Description=rmfakecloud reverse proxy | ||
| Documentation=https://github.com/ddvk/rmfakecloud-proxy | ||
| After=home.mount | ||
|
|
||
| [Service] | ||
| Environment=HOME=/home/root | ||
| ExecStart=/opt/bin/rmfakecloud-proxy-wrapper | ||
| Restart=on-failure | ||
|
|
||
| [Install] | ||
| WantedBy=multi-user.target | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.