scripts/bootstrap: surround paths with quotes
This makes user-modified paths more reliable (for example, insensitive to
whitespaces)
@@ -108,7 +108,7 @@ elif [ ${CLEAN} -eq 1 ] && [ -f ${STORAGE}/blocks.sqlite ]; then
find ${STORAGE} -type f -exec rm {} \;
fi
-if [ ! -d ${DPATH} ] || [ ! -w ${DPATH} ]; then
+if [ ! -d "${DPATH}" ] || [ ! -w "${DPATH}" ]; then
echo "error: path to store (${DPATH}) sqlite files does not exist or your user does not have write permission"
exit 1
fi
@@ -159,8 +159,8 @@ echo ""
TMPDIR=TMP.$$
mkdir $TMPDIR
-mkdir -p ${CONFIG_PATH}
-mkdir -p ${SECRET_PATH}
+mkdir -p "${CONFIG_PATH}"
+mkdir -p "${SECRET_PATH}"
### MAKE EVERYTHING
@@ -221,7 +221,7 @@ cat ${TMPDIR}/stake_delegation2.cert | $CLI certificate sign -k ${TMPDIR}/fixed_
STAKE_DELEGATION_CERT2=$(cat ${TMPDIR}/stake_delegation2.signcert)
-cat << EOF > ${CONFIG_PATH}/genesis.yaml
+cat << EOF > "${CONFIG_PATH}/genesis.yaml"
blockchain_configuration:
block0_date: $(date +%s)
discrimination: test
@@ -249,7 +249,7 @@ initial:
- cert: ${STAKE_DELEGATION_CERT2}
EOF
-cat << EOF > ${SECRET_PATH}/pool-secret1.yaml
+cat << EOF > "${SECRET_PATH}/pool-secret1.yaml"
genesis:
sig_key: ${POOL_KES_SK}
vrf_key: ${POOL_VRF_SK}
@@ -258,7 +258,7 @@ bft:
signing_key: ${LEADER_SK}
EOF
-cat << EOF > ${CONFIG_PATH}/config.yaml
+cat << EOF > "${CONFIG_PATH}/config.yaml"
storage: "${STORAGE}/"
rest:
@@ -272,13 +272,13 @@ p2p:
blocks: normal
EOF
-$CLI genesis encode --input ${CONFIG_PATH}/genesis.yaml --output ${CONFIG_PATH}/block-0.bin
+$CLI genesis encode --input "${CONFIG_PATH}/genesis.yaml" --output "${CONFIG_PATH}/block-0.bin"
if [ $? -ne 0 ]; then
echo "error: building the genesis block"
exit 1
fi
-BLOCK0_HASH=$($CLI genesis hash --input ${CONFIG_PATH}/block-0.bin)
+BLOCK0_HASH=$($CLI genesis hash --input "${CONFIG_PATH}/block-0.bin")
### PRINT
@@ -292,9 +292,9 @@ echo "block-0 hash: ${BLUE}${BLOCK0_HASH}${WHITE}"
echo
echo "To start the node:"
if [ $ADD_STARTUP_SCRIPT -eq 1 ]; then
- echo "$NODE --genesis-block ${CONFIG_PATH}/block-0.bin --config ${CONFIG_PATH}/config.yaml --secret ${SECRET_PATH}/pool-secret1.yaml" > startup_script.sh
+ echo "$NODE --genesis-block \"${CONFIG_PATH}/block-0.bin\" --config \"${CONFIG_PATH}/config.yaml\" --secret \"${SECRET_PATH}/pool-secret1.yaml\"" > startup_script.sh
fi
-echo " $NODE --genesis-block ${CONFIG_PATH}/block-0.bin --config ${CONFIG_PATH}/config.yaml --secret ${SECRET_PATH}/pool-secret1.yaml"
+echo " $NODE --genesis-block \"${CONFIG_PATH}/block-0.bin\" --config \"${CONFIG_PATH}/config.yaml\" --secret \"${SECRET_PATH}/pool-secret1.yaml\""
echo "To connect using CLI REST:"
echo " $CLI rest v0 <CMD> --host \"${REST_URL}\""
echo "For example:"
