github.com/jincm/wesharechain@v0.0.0-20210122032815-1537409ce26a/chain/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..." && /geth --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