1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

check if variables are empty to be more failsafe

This commit is contained in:
Marcel 2014-07-14 18:56:54 +02:00
parent 047d1fdd50
commit a37fef136b

View File

@ -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
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