From: Eagle[TM] Date: Tue, 4 Mar 2014 23:36:02 +0000 (+0100) Subject: hardening against multiple path_fulltree definitions in config; use of mkdir -p X-Git-Url: https://git.novaco.in/?p=electrum-server.git;a=commitdiff_plain;h=9fbfefabb58de2bcbdd06fc814d619171420b6c4;hp=9e68150ef4404205b79f84ec20d5e6fd82eae290 hardening against multiple path_fulltree definitions in config; use of mkdir -p --- diff --git a/start b/start index bd1db62..e0d0bc9 100755 --- a/start +++ b/start @@ -14,9 +14,7 @@ if [ ! -f $electrum_config ]; then exit fi -path=`grep path_fulltree $electrum_config |awk -F\= '{print $2}'` - -#needs more hardening against double definiton of variable, dismiss commented ones +path=`grep -e ^path_fulltree $electrum_config |awk -F\= '{print $2}' | tail -n 1` if ! [ "$path" ]; then echo "Variable path_fulltree not set in $electrum_config" @@ -31,7 +29,7 @@ if [ ! -d $path ]; then read -p "Do you want to download it from the Electrum foundry to $path ? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]]; then - mkdir $path + mkdir -p $path wget -O - "http://foundry.electrum.org/leveldb-dump/electrum-fulltree-100-latest.tar.gz" | tar --extract --gunzip --strip-components 1 --directory $path --file - fi fi