Browse Source

check if variables are empty to be more failsafe

pull/143/head
Marcel 12 years ago
parent
commit
a37fef136b
  1. 48
      bootstrap.sh

48
bootstrap.sh

@ -21,6 +21,24 @@ TOX_CORE_DIR=libtoxcore-latest @@ -21,6 +21,24 @@ TOX_CORE_DIR=libtoxcore-latest
# if this script gets the parameter -t or --tox
TOX_ONLY=false
if [ -z "$BASE_DIR" ]; then
echo "internal error detected!"
echo "BASE_DIR should not be empty... aborting"
exit 1
fi
if [ -z "$SODIUM_DIR" ]; then
echo "internal error detected!"
echo "SODIUM_DIR should not be empty... aborting"
exit 1
fi
if [ -z "$TOX_CORE_DIR" ]; then
echo "internal error detected!"
echo "TOX_CORE_DIR should not be empty... aborting"
exit 1
fi
########## check input parameters ##########
@ -34,27 +52,27 @@ if [ $# -ge 1 ] ; then @@ -34,27 +52,27 @@ if [ $# -ge 1 ] ; then
fi
# print help
echo "Use this script to install/update libsodium and libtoxcore in ${INSTALL_DIR}"
echo ""
echo "usage:"
echo " ${0} [-t|--tox|-h|--help]"
echo ""
echo "parameters:"
echo " -h|--help: displays this help"
echo " -t|--tox : only install/update libtoxcore"
echo " requires an already installed libsodium"
echo ""
echo "example usages:"
echo " ${0} -- to install libsodium and libtoxcore"
echo " ${0} -t -- to update already installed libtoxcore"
exit 1
echo "Use this script to install/update libsodium and libtoxcore in ${INSTALL_DIR}"
echo ""
echo "usage:"
echo " ${0} [-t|--tox|-h|--help]"
echo ""
echo "parameters:"
echo " -h|--help: displays this help"
echo " -t|--tox : only install/update libtoxcore"
echo " requires an already installed libsodium"
echo ""
echo "example usages:"
echo " ${0} -- to install libsodium and libtoxcore"
echo " ${0} -t -- to update already installed libtoxcore"
exit 1
fi
fi
############### prepare step ###############
# create INSTALL_DIR directory if necessary
# create BASE_DIR directory if necessary
mkdir -p ${BASE_DIR}
# maybe an earlier run of this script failed

Loading…
Cancel
Save