github.com/alexdevranger/node-1.8.27@v0.0.0-20221128213301-aa5841e41d2d/swarm/docker/run.sh (about) 1 #!/bin/sh 2 3 set -o errexit 4 set -o pipefail 5 set -o nounset 6 7 PASSWORD=${PASSWORD:-} 8 DATADIR=${DATADIR:-/root/.ethereum/} 9 10 if [ "$PASSWORD" == "" ]; then echo "Password must be set, in order to use swarm non-interactively." && exit 1; fi 11 12 echo $PASSWORD > /password 13 14 KEYFILE=`find $DATADIR | grep UTC | head -n 1` || true 15 if [ ! -f "$KEYFILE" ]; then echo "No keyfile found. Generating..." && /gdubx --datadir $DATADIR --password /password account new; fi 16 KEYFILE=`find $DATADIR | grep UTC | head -n 1` || true 17 if [ ! -f "$KEYFILE" ]; then echo "Could not find nor generate a BZZ keyfile." && exit 1; else echo "Found keyfile $KEYFILE"; fi 18 19 VERSION=`/swarm version` 20 echo "Running Swarm:" 21 echo $VERSION 22 23 export BZZACCOUNT="`echo -n $KEYFILE | tail -c 40`" || true 24 if [ "$BZZACCOUNT" == "" ]; then echo "Could not parse BZZACCOUNT from keyfile." && exit 1; fi 25 26 exec /swarm --bzzaccount=$BZZACCOUNT --password /password --datadir $DATADIR $@ 2>&1