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