X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=start;h=9868ce14888c5565515ecc3c9a4a8285163a77b3;hb=65def938815f634f3dca9b28f5cb074585033edc;hp=e00bdd9c57aa182a5770ac7de8f185e036b8c5d2;hpb=199e1b06dd48580b19274723e51073ce076d8a1f;p=electrum-server.git diff --git a/start b/start index e00bdd9..9868ce1 100755 --- a/start +++ b/start @@ -1,17 +1,28 @@ #!/bin/bash -path=`grep path_fulltree /etc/electrum.conf |awk -F\= '{print $2}'` +electrum_config="/etc/electrum.conf" + +if [ ! -f $electrum_config ]; then + echo "$electrum_config does not exist" + exit +fi + +path=`grep path_fulltree $electrum_config |awk -F\= '{print $2}'` + +#needs more hardening against double definiton of variable, dismiss commented ones + +if ! [ "$path" ]; then + echo "Variable path_fulltree not set in $electrum_config" + exit + # we're actually forcing fulltree with this clause, which is ok if displaying v0.9 should use fulltree +fi if [ ! -d $path ]; then echo "Database not found in $path." - read -p "Do you want to download it from the Electrum foundry? " -n 1 -r + read -p "Do you want to download it from the Electrum foundry to $path ? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - rm -rf fulltree fulltree.tar - wget http://foundry.electrum.org/leveldb-dump/electrum-fulltree-100-latest.tar -O fulltree.tar - tar -xvf fulltree.tar - mv fulltree $path - rm -rf fulltree fulltree.tar + wget -O - "http://foundry.electrum.org/leveldb-dump/electrum-fulltree-100-latest.tar" | tar -C $path --strip-components 1 -xvf - fi fi