aboutsummaryrefslogtreecommitdiffstats
path: root/swarm/docker/run.sh
diff options
context:
space:
mode:
authorAnton Evangelatov <anton.evangelatov@gmail.com>2019-01-03 22:32:58 +0800
committerGitHub <noreply@github.com>2019-01-03 22:32:58 +0800
commit49975264a8d37aa9af1a2b71015059245c0c2e0b (patch)
tree83738c338fae0fc68332c71adf655f05f656e4da /swarm/docker/run.sh
parent1ea5279d5d7cd44ab18d72a2d26f1ad03b8d2b5e (diff)
downloaddexon-49975264a8d37aa9af1a2b71015059245c0c2e0b.tar.gz
dexon-49975264a8d37aa9af1a2b71015059245c0c2e0b.tar.zst
dexon-49975264a8d37aa9af1a2b71015059245c0c2e0b.zip
swarm/docker: Dockerfile for swarm:edge docker image (#18386)
Diffstat (limited to 'swarm/docker/run.sh')
-rwxr-xr-xswarm/docker/run.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/swarm/docker/run.sh b/swarm/docker/run.sh
new file mode 100755
index 000000000..3e613b56d
--- /dev/null
+++ b/swarm/docker/run.sh
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+set -o errexit
+set -o pipefail
+set -o nounset
+
+PASSWORD=${PASSWORD:-}
+DATADIR=${DATADIR:-/root/.ethereum/}
+
+if [ "$PASSWORD" == "" ]; then echo "Password must be set, in order to use swarm non-interactively." && exit 1; fi
+
+echo $PASSWORD > /password
+
+KEYFILE=`find $DATADIR | grep UTC | head -n 1` || true
+if [ ! -f "$KEYFILE" ]; then echo "No keyfile found. Generating..." && /geth --datadir $DATADIR --password /password account new; fi
+KEYFILE=`find $DATADIR | grep UTC | head -n 1` || true
+if [ ! -f "$KEYFILE" ]; then echo "Could not find nor generate a BZZ keyfile." && exit 1; else echo "Found keyfile $KEYFILE"; fi
+
+VERSION=`/swarm version`
+echo "Running Swarm:"
+echo $VERSION
+
+export BZZACCOUNT="`echo -n $KEYFILE | tail -c 40`" || true
+if [ "$BZZACCOUNT" == "" ]; then echo "Could not parse BZZACCOUNT from keyfile." && exit 1; fi
+
+exec /swarm --bzzaccount=$BZZACCOUNT --password /password --datadir $DATADIR $@ 2>&1