fixed DNS selector

This commit is contained in:
2026-03-09 09:22:23 +01:00
parent 158125c257
commit b4e1ebbd70

View File

@@ -183,11 +183,11 @@ echo ""
while true; do
read -p "Enter your choice (1-3): " external_access_method
case "$external_access_method" in
1|2|3)
(1|2|3)
echo "Selected option: $external_access_method"
break
;;
*)
(*)
echo "Invalid choice. Please enter 1, 2, or 3."
;;
esac
@@ -217,7 +217,7 @@ fi
if [["$external_access_method" -eq 1]]; then
if ["$external_access_method" -eq 1]; then
# Verify DNS records
echo -e "${cyan}Verifying DNS records...${nc}"
echo ""
@@ -225,7 +225,7 @@ if [["$external_access_method" -eq 1]]; then
# Check A record
echo -e "${cyan}Checking A record for @...${nc}"
a_record_check=$(dig +short A "$domain" @8.8.8.8 | grep -c "^$publicip$")
if [[ "$a_record_check" -eq 0 ]]; then
if [ "$a_record_check" -eq 0 ]; then
echo -e "${cyan}⚠️ Warning: A record for @ is not set or not pointing to $publicip${nc}"
else
echo -e "${cyan}✅ A record for @ is correctly set to $publicip${nc}"
@@ -234,7 +234,7 @@ if [["$external_access_method" -eq 1]]; then
# Check CNAME record
echo -e "${cyan}Checking CNAME record for *...${nc}"
cname_record_check=$(dig +short CNAME "*.$domain" @8.8.8.8 | grep -c "$domain\.$")
if [[ "$cname_record_check" -eq 0 ]]; then
if [ "$cname_record_check" -eq 0 ]; then
echo -e "${cyan}⚠️ Warning: CNAME record for * is not set or not pointing to @${nc}"
else
echo -e "${cyan}✅ CNAME record for * is correctly set to @${nc}"
@@ -251,7 +251,7 @@ if [["$external_access_method" -eq 1]]; then
fi
# Ask about static public IP if using public DNS
if [[ "$external_access_method" -eq 1 ]]; then
if [ "$external_access_method" -eq 1 ]; then
while true; do
@@ -565,11 +565,11 @@ Add any other subdomains you want to use.
EOF
# Write PiHole config (only for options 2 and 3)
if [[ "$external_access_method" -eq 2 ]] || [[ "$external_access_method" -eq 3 ]]; then
if [ "$external_access_method" -eq 2 ] || [ "$external_access_method" -eq 3 ]; then
echo "Writing PiHole configuration..."
# Use public IP for option 3, local IP for option 2
if [[ "$external_access_method" -eq 3 ]]; then
if [ "$external_access_method" -eq 3 ]; then
dns_ip="$publicip"
else
dns_ip="$localip"
@@ -584,7 +584,7 @@ EOF
docker restart pihole
fi
# Enable DHCP on PiHole for options 2 and 3
if [[ "$external_access_method" -eq 2 ]] || [ "$external_access_method" -eq 3 ]; then
if [ "$external_access_method" -eq 2 ] || [ "$external_access_method" -eq 3 ]; then
echo "Configuring DHCP on PiHole..."
# Get network information