diff --git a/apacheconfig b/apacheconfig index 616d647..bd3be56 100755 --- a/apacheconfig +++ b/apacheconfig @@ -262,14 +262,17 @@ elif [ "$action" == new-site ]; then ssltempl= certstempl= wwwtempl= - array_from_lines templs "$(list_files "$templdir" "*SITE*.conf")" - [ ${#templs[*]} -gt 0 ] && clrtempl="${templs[0]}" - array_from_lines templs "$(list_files "$templdir" "*SITE*.ssl.conf")" - [ ${#templs[*]} -gt 0 ] && ssltempl="${templs[0]}" - array_from_lines templs "$(list_files "$templdir" "*SITE*-certs.conf")" - [ ${#templs[*]} -gt 0 ] && certstempl="${templs[0]}" - array_from_lines templs "$(list_dirs "$templdir" "*SITE*")" - [ ${#templs[*]} -gt 0 ] && wwwtempl="${templs[0]}" + array_from_lines clrtempls "$(list_files "$templdir" "*SITE*.conf")" + array_from_lines ssltempls "$(list_files "$templdir" "*SITE*.ssl.conf")" + array_from_lines certstempls "$(list_files "$templdir" "*SITE*-certs.conf")" + for xtempl in "${ssltempls[@]}" "${certstempls[@]}"; do + array_del clrtempls "$xtempl" + done + [ ${#clrtempls[*]} -gt 0 ] && clrtempl="${clrtempls[0]}" + [ ${#ssltempls[*]} -gt 0 ] && ssltempl="${ssltempls[0]}" + [ ${#certstempls[*]} -gt 0 ] && certstempl="${certstempls[0]}" + array_from_lines wwwtempls "$(list_dirs "$templdir" "*SITE*")" + [ ${#wwwtempls[*]} -gt 0 ] && wwwtempl="${wwwtempls[0]}" found= for i in "$clrtempl" "$ssltempl" "$certstempl" "$wwwtempl"; do