summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Cantrell <dcantrell@redhat.com>2008-12-15 11:45:37 -1000
committerDavid Cantrell <dcantrell@redhat.com>2008-12-15 11:45:37 -1000
commit646a2f1c80cbae63506e2f6b62b8aad53018c409 (patch)
tree04513564cc9714f2dc656f4a38132f855e31184d
parent1263e881d7029c85bb0cca42abd5851827751d17 (diff)
downloadanaconda-646a2f1c80cbae63506e2f6b62b8aad53018c409.tar.gz
anaconda-646a2f1c80cbae63506e2f6b62b8aad53018c409.tar.xz
anaconda-646a2f1c80cbae63506e2f6b62b8aad53018c409.zip
Allow empty DNS variable in s390 CMS conf file (#465175)
If the DNS variable contains an empty space or a colon, anaconda gives a traceback.
-rw-r--r--loader2/linuxrc.s39042
1 files changed, 38 insertions, 4 deletions
diff --git a/loader2/linuxrc.s390 b/loader2/linuxrc.s390
index 0400ede87..7b8fcde45 100644
--- a/loader2/linuxrc.s390
+++ b/loader2/linuxrc.s390
@@ -60,6 +60,24 @@ checkipv4()
return $?
}
+checkdns()
+{
+ dns=$1
+ # DNS syntax is addr1:addr2:addr3 so first split by ":"
+ dnslist=$(echo $dns | awk -F ':' '{i=1; while (i<=NF) {print $i; i=i+1}}')
+ found=0
+ for i in $dnslist; do
+ # note: only support ipv4 DNS currently,
+ # since both ipv6 address and DNS= parameter can contain ":"
+ checkipv4 $i
+ [ $? -eq 1 ] && return 1
+ # track whether we've found at least one valid IP
+ found=1
+ done
+ [ $found -eq 1 ] && return 0
+ return 1
+}
+
doshutdown()
{
exec /sbin/shutdown
@@ -457,13 +475,29 @@ route add default gw $GATEWAY dev $DEVICE 2>/dev/null
# BH FIXME: Workaround for manual MACADDR, need ping to update arp table
ping -c 1 $GATEWAY > /dev/null
-if [ -z "$DNS" ]; then
- echo $"Enter your DNS server(s), separated by colons (:):"
+# DNS is optional, but if specified it must be correct
+if [ -n "$DNS" ]; then
+ checkdns $DNS
+ ret=$?
+fi
+if [ -z "$DNS" ] || [ $ret -ne 0 ]; then
+ echo $"Enter your DNS server(s), separated by colons (:)"
+ echo $"Leave this blank and press enter to skip"
read DNS
+ checkdns $DNS
+ ret=$?
+ while [ -n "$DNS" ] && [ $ret -ne 0 ]; do
+ echo -n "Invalid DNS address format. "
+ echo $"Enter your DNS server(s), separated by colons (:)"
+ echo $"Leave this blank and press enter to skip"
+ read DNS
+ checkdns $DNS
+ ret=$?
+ done
fi
if [ -z "$DNS" ]; then
- echo $"You might encounter problems without a nameserver, especially"
- echo $"with FTP installs"
+ echo $"WARNING: You might encounter problems without a nameserver,"
+ echo $"especially with FTP installs"
fi
if [ -n "$DNS" -a -z "$SEARCHDNS" ]; then