From c059e2bf4d0050f7e08b38944c1065c2fde4d278 Mon Sep 17 00:00:00 2001 From: Dan Fedele Date: Mon, 7 Nov 2022 11:28:13 -0500 Subject: Bugfixes and more documentation --- setup.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'setup.sh') diff --git a/setup.sh b/setup.sh index 7bc8a54..5a42b91 100644 --- a/setup.sh +++ b/setup.sh @@ -3,15 +3,28 @@ # Exit immediately on failure set -eu +# Are we running in bash? +# Single bracket to be posix compliant in case we run in sh or something +if [ ! -z ${BASH} ]; then + echo "This script must be run from the Bash shell!" + exit 1 +fi + +# Are we root? if [[ $EUID -ne 0 ]]; then echo "This script must be run as sudo or root." - exit 1 + exit 2 fi -PATH_TO_SCRIPT=$(dirname $0) +PATH_TO_SCRIPT=$(dirname $(readlink -f $0)) ZSH_FUNC_FILE="zsh_functions.zsh" TMUX_FILE="tmux_conf" +if [[ ! -e ${PATH_TO_SCRIPT}/${ZSH_FUNC_FILE} ]] && [[ ! -e ${PATH_TO_SCRIPT}/${TMUX_FILE} ]]; then + echo "Cannot find supporting files! Please clone repository and try again!" + exit 3 +fi + echo "***********************************" echo "* Installing pip *" echo "***********************************" -- cgit v1.2.3