diff options
Diffstat (limited to 'go-swarm.install')
-rw-r--r-- | go-swarm.install | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/go-swarm.install b/go-swarm.install index 65f2fe638196..121b9e497f0c 100644 --- a/go-swarm.install +++ b/go-swarm.install @@ -1,31 +1,34 @@ post_install () { - dependsdir=/tmp/.go-swarm-depends-$1 - mkdir -p /var/lib/bzz/keystore + if [ -f /var/lib/bzz/.swarm-pass ]; then + echo "you already have a Swarm data dir. I'll leave it alone ;)" + return 0 + fi - if [ -f "${dependsdir}/.havepythonwallet" ]; then - echo "generating wallet with swarm-genkey" + mkdir -p /var/lib/bzz/.ethereum/keystore + gethbin=$(which geth) + if [ ! -z $gethbin ]; then + echo "generating wallet with geth" tmpkey=$(mktemp -d) pushd ${tmpkey} - /usr/local/bin/swarm-genkey + dd if=/dev/urandom of=.swarm-pass bs=1 count=64 + geth --datadir /var/lib/bzz/.ethereum --password ${tmpkey}/.swarm-pass account new install -v -D -m600 .swarm-pass /var/lib/bzz/.swarm-pass - install -v -D -m600 UTC* /var/lib/bzz/keystore/ popd rm -vrf ${tmpkey} - elif [ -f "${dependsdir}/.havegethwallet" ]; then - echo "generating wallet with geth" + elif [ -x /usr/local/bin/swarm-genkey ]; then + echo "generating wallet with swarm-genkey" tmpkey=$(mktemp -d) pushd ${tmpkey} - dd if=/dev/urandom of=.swarm-pass bs=1 count=64 - geth --datadir /var/lib/bzz --password ${tmpkey}/.swarm-pass account new + /usr/local/bin/swarm-genkey install -v -D -m600 .swarm-pass /var/lib/bzz/.swarm-pass + install -v -D -m600 UTC* /var/lib/bzz/.ethereum/keystore/ popd + rm -vrf ${tmpkey} else echo "Missing optional dependencies required to automatically generate a ethereum wallet for the swarm node" echo "You will not be able to run a node with it" echo "You can generate it manually later using go-ethereum or the swarm-genkey.py script provided this package, provided dependencies are met" fi - unlink ${dependsdir}/.havepythonwallet - unlink ${dependsdir}/.havegethwallet chown -v bzz:bzz /var/lib/bzz -R - chmod 700 /var/lib/bzz/keystore + chmod 700 /var/lib/bzz/.ethereum/keystore } |