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}"