depot/third_party/nixpkgs/pkgs/applications/networking/bee/0001-clef-service-accept-default-CONFIGDIR-from-the-envir.patch
Default email ae91cbe6cc Project import generated by Copybara.
GitOrigin-RevId: 536fe36e23ab0fc8b7f35c24603422eee9fc17a2
2021-02-05 18:12:51 +01:00

44 lines
1.6 KiB
Diff

From 04933c578f51aa1f536991318dc5aede57f81c0d Mon Sep 17 00:00:00 2001
From: Attila Lendvai <attila@lendvai.name>
Date: Sat, 30 Jan 2021 14:02:02 +0100
Subject: [PATCH 1/2] clef-service: accept default CONFIGDIR from the
environment
---
packaging/bee-clef-service | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/packaging/bee-clef-service b/packaging/bee-clef-service
index 10bcd92..34c7edd 100755
--- a/packaging/bee-clef-service
+++ b/packaging/bee-clef-service
@@ -1,16 +1,21 @@
#!/usr/bin/env sh
start() {
- KEYSTORE=/var/lib/bee-clef/keystore
- CONFIGDIR=/var/lib/bee-clef
+ if [ -z "$CONFIGDIR" ]; then
+ CONFIGDIR=/var/lib/bee-clef
+ fi
+ if [ -z "$PASSWORD_FILE" ]; then
+ PASSWORD_FILE=${CONFIGDIR}/password
+ fi
+ KEYSTORE=${CONFIGDIR}/keystore
+ SECRET=$(cat ${PASSWORD_FILE})
CHAINID=5
- SECRET=$(cat /var/lib/bee-clef/password)
# clef with every start sets permissions back to 600
- (sleep 4; chmod 660 /var/lib/bee-clef/clef.ipc) &
+ (sleep 4; chmod 660 ${CONFIGDIR}/clef.ipc) &
( sleep 2; cat << EOF
{ "jsonrpc": "2.0", "id":1, "result": { "text":"$SECRET" } }
EOF
-) | clef --stdio-ui --keystore $KEYSTORE --configdir $CONFIGDIR --chainid $CHAINID --rules /etc/bee-clef/rules.js --nousb --4bytedb-custom /etc/bee-clef/4byte.json --pcscdpath "" --auditlog "" --loglevel 3 --ipcpath /var/lib/bee-clef
+) | clef --stdio-ui --keystore $KEYSTORE --configdir $CONFIGDIR --chainid $CHAINID --rules /etc/bee-clef/rules.js --nousb --4bytedb-custom /etc/bee-clef/4byte.json --pcscdpath "" --auditlog "" --loglevel 3 --ipcpath ${CONFIGDIR}
}
stop() {
--
2.29.2