Skip to content
Permalink
Browse files
check if variables are empty to be more failsafe
  • Loading branch information
Marcel committed Jul 14, 2014
1 parent 047d1fd commit a37fef136b62de345eea3fd7c184c14f930f8d4b
Showing with 33 additions and 15 deletions.
  1. +33 −15 bootstrap.sh
@@ -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

0 comments on commit a37fef1

Please sign in to comment.