summaryrefslogtreecommitdiffstats
path: root/pkgs/applications/networking/bee/0001-clef-service-accept-default-CONFIGDIR-from-the-envir.patch
blob: fb551646b7c626357d1471d02ebf934e14ace77f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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