From 047956369040c4f9faebe16a67fefa9e4cdd92f2 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Tue, 8 Jan 2019 22:26:18 -0700 Subject: [PATCH] copy configuration to /etc/nginx and exit --- .vscode/numbered-bookmarks.json | 4 ++-- setup.sh | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index 1bd9b9a..5533862 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -6,13 +6,13 @@ -1, 19, 54, - 787, + 819, 68, -1, -1, -1, -1, - -1 + 810 ] } ] diff --git a/setup.sh b/setup.sh index 8439172..f94b2a4 100755 --- a/setup.sh +++ b/setup.sh @@ -784,6 +784,38 @@ fi echo -e "${ok}...files updated${norm}" echo -e "${mag}---------------------${norm}\n" +### copy configDir to actual nginx directory after backup +## backup nginx directory +echo -e "${cyan}Backing up NGINX configuration directory${norm}" +echo "copying /etc/nginx --> /etc/nginx.original" +cp -f -R /etc/nginx /etc/nginx.original +copysuccess=$? +# verify new directory created +if [ "${copysuccess}" -eq 0 ]; then + echo -e "${ok}--- configuration backup successful ---" +else + echo -e "\n${err}Unable to backup existing NGINX configuration${norm}" + echo -e "Updated configuration has been copied to ${warn}${configPath}${norm}" + echo -e "but must be manually integrated into ${warn}'/etc/nginx/'${norm}." + echo "Is this a permissions error?" + echo -e "\n${err}Exiting now.${norm}" + exit 101 +fi +echo -e "${cyan}Integrating updated configuration...${norm}" +echo "(any errors should appear below)" +## remove un-needed and/or existing directories and files +rm -rf /etc/nginx/conf.d +rm -rf /etc/nginx/enabledSites +mv -f /etc/nginx/fastcgi_params /etc/nginx/fastcgi_params.original +mv -f /etc/nginx/nginx.conf /etc/nginx/nginx.conf.original +cp -f -R "${configPath}"/nginx/* /etc/nginx/ +mkdir /etc/nginx/enabledSites +mkdir /etc/nginx/conf.d/enabled +echo -e "${ok}...integration completed${norm}" +echo -e "${mag}---------------------${norm}\n" +echo -e "${ok}Setup script completed${norm}" + + # debug section echo -e "\n${mag}---------------------${norm}"