From 5a428c027fc745c49e2eca0646a8afdc6200b768 Mon Sep 17 00:00:00 2001 From: Asif Bacchus Date: Sat, 5 Jan 2019 04:39:48 -0700 Subject: [PATCH] subst for server_names.conf --- .vscode/numbered-bookmarks.json | 2 +- setup.sh | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.vscode/numbered-bookmarks.json b/.vscode/numbered-bookmarks.json index f97be01..f705b63 100644 --- a/.vscode/numbered-bookmarks.json +++ b/.vscode/numbered-bookmarks.json @@ -12,7 +12,7 @@ -1, -1, -1, - -1 + 524 ] } ] diff --git a/setup.sh b/setup.sh index 8537a53..937a23e 100644 --- a/setup.sh +++ b/setup.sh @@ -37,7 +37,9 @@ generateDH=0 hostname=$(hostname) configPath="./etc.${hostname}" -# set tags to update +# set tags and files to update +tag_servernames="" +file_servernames="nginx/snippets/server_names.conf" tag_sslcert="" tag_sslkey="" tag_dhparam="" @@ -508,16 +510,25 @@ if [ "${usePHP}" -eq 1 ]; then fi -: <<'COMMENTSECTION' + ### Write configurations to template files # let user know what's happening echo -e "\n${mag}---------------------${norm}" echo -e "${cyan}Updating template files now" # copy template files to working versions +echo "copying files to dedicated directory for customization" +echo -e "${warn}${configPath}${norm}\n" rm -rf "${configPath}" cp -R ./etc "${configPath}" +# process server names +echo -e "updating ${warn}${configPath}/${file_servernames}${norm}" +for name in "${serverNames[@]}"; do + sed -i "/${tag_servernames}/a \ \ ${name}" "${configPath}/${file_servernames}" +done +sed -i "/${tag_servernames}/d" "${configPath}/${file_servernames}" + # process SSL snippet echo "updating SSL paths in snippet file" sed -e "s%${tag_sslcert}%${CertPath}%" "${configPath}/nginx/snippets/ssl/ssl_certs.conf" @@ -528,7 +539,7 @@ echo "updating SSL configuration parameters file" echo -e "s%${tag_dhparam}%${DHPath}%" "${configPath}/nginx/conf.d/mozModern_ssl.conf" echo -e "s%${tag_cachain}%${CAChainPath}%" "${configPath}/nginx/conf.d/mozModern_ssl.conf" -COMMENTSECTION + # debug section echo -e "\n${mag}---------------------${norm}"