]> git.ameliathe1st.gay Git - git-over-gnunet.git/commitdiff
Basic daemon
authorAmélia Coutard-Sander <git@ameliathe1st.gay>
Mon, 25 Nov 2024 21:20:46 +0000 (22:20 +0100)
committerAmélia Coutard-Sander <git@ameliathe1st.gay>
Mon, 25 Nov 2024 21:20:46 +0000 (22:20 +0100)
daemon.sh [new file with mode: 0755]

diff --git a/daemon.sh b/daemon.sh
new file mode 100755 (executable)
index 0000000..ac6e7d7
--- /dev/null
+++ b/daemon.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+
+mktempfifo() {
+       name="$(mktemp -u)"
+       mkfifo "$name" || mktempfifo
+}
+
+if test -z $1 || test -z $2 || ! test -z $3; then
+       echo >&2 "Usage: $0 <service> <passphrase>"
+       exit 1
+fi
+
+service="$1"
+passphrase="$2"
+
+echo >&2 "Running $service on port $passphrase-git-$service."
+
+mktempfifo
+while < "$name" gnunet-cadet -o "$passphrase-git-$service" | git "$service" . > "$name"; test 130 != "$?"; do
+       rm "$name"
+       mktempfifo
+done
+
+rm $name
+
+echo >&2 "Terminating $service on port $passphrase-$service."