From a22529026a2f50b8720b190ae20d13e6487b7110 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Mon, 7 Jan 2019 22:36:21 -0700 Subject: [PATCH] added configPath creation test --- setup.sh | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/setup.sh b/setup.sh index 9737d1c..39febe3 100755 --- a/setup.sh +++ b/setup.sh @@ -49,6 +49,7 @@ unset phpAddr unset phpPort unset phpSock unset dhsuccess +unset copysuccess # set variables regexIP4="(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])" @@ -657,6 +658,14 @@ echo "copying files to dedicated directory for customization:" echo -e "${warn}${configPath}${norm}\n" rm -rf "${configPath}" cp -R ./etc "${configPath}" +copysuccess=$? +# check that copy was performed, else exit +if [ "${copysuccess}" -ne 0 ] || [ ! -d "${configPath}" ]; then + echo -e "\n${err}There was a problem creating the configuration directory.${norm}" + echo "Is there a reason ROOT cannot write to this script's directory?" + echo -e "${err}No changes made. Exiting.${norm}" + exit 100 +fi # process server_names snippet echo -e "updating ${warn}${configPath}/${file_servernames}${norm}"