Fixed DNS issues with ubuntu-9.10 master
authorPravin Shinde <pravin@black-perl.(none)>
Sat, 26 Dec 2009 14:04:39 +0000 (15:04 +0100)
committerPravin Shinde <pravin@black-perl.(none)>
Sat, 26 Dec 2009 14:04:39 +0000 (15:04 +0100)
bko/live/ubuntu/U9.10/casper
bko/live/ubuntu/U9.10/init
install_help/upload_initramfs_images.sh

index c4cdcf7..9b71ed3 100644 (file)
@@ -176,6 +176,44 @@ copy_live_to() {
     return 0
 }
 
+add_ip_to_resolv_conf ()
+{
+       if [ ! -z ${1} ]
+       then
+               echo "nameserver $1" >> /etc/resolv.conf
+       fi
+}
+
+setup_static_ip ()
+{
+       ifconfig lo 127.0.0.1 up
+       ifconfig "${DEVICE}" up
+       local myip=`echo ${STATICIP} | cut -d: -f1`
+       local mynm=`echo ${STATICIP} | cut -d: -f4`
+       local mygw=`echo ${STATICIP} | cut -d: -f3`
+       echo "myip=${myip} mynm=${mynm} mygw=${mygw}"
+       ifconfig "${DEVICE}" "${myip}" netmask "${mynm}"  
+       ifconfig "${DEVICE}"
+       route add default gw "${mygw}" 
+       return 0
+}
+
+setup_static_dns ()
+{
+       if [ -z ${DNSIP} ]
+       then
+               add_ip_to_resolv_conf "4.2.2.2" 
+               add_ip_to_resolv_conf "128.255.1.3" 
+       else
+               for x in $( echo "${DNS}" | sed 's/,/ /g')
+               do
+                       add_ip_to_resolv_conf ${x} 
+               done
+       fi
+       return 0
+}
+
+
 do_netmount() {
     rc=1
 
@@ -184,7 +222,29 @@ do_netmount() {
     /sbin/udevadm trigger
     /sbin/udevadm settle
 
-    ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config
+       if [ -z ${BOOTIP} ] 
+       then    
+               ipconfig ${DEVICE} /tmp/net-${DEVICE}.conf | tee /netboot.config
+               
+               # Adding DNS Entry
+               local ipconf_dnsip=`cat /netboot.config | grep dns0 | cut -d':' -f3 | cut -d' ' -f2`
+               if [ -z ${ipconf_dnsip}] || [ ${ipconf_dnsip} == '0.0.0.0']
+               then
+                       setup_static_dns
+               else
+                       add_ip_to_resolv_conf ${ipconf_dnsip}
+               fi
+               # source relevant ipconfig output
+               OLDHOSTNAME=${HOSTNAME}
+               . /tmp/net-${DEVICE}.conf
+               [ -z ${HOSTNAME} ] && HOSTNAME=${OLDHOSTNAME}
+               export HOSTNAME
+
+       else
+               setup_static_ip 
+               setup_static_dns
+       fi
+
 
     if [ "${NFSROOT}" = "auto" ]; then
         NFSROOT=${ROOTSERVER}:${ROOTPATH}
@@ -208,6 +268,8 @@ do_netmount() {
     return ${rc}
 }
 
+
+
 do_nfsmount() {
     rc=1
     modprobe "${MP_QUIET}" nfs
index 264be56..8ad4e35 100755 (executable)
@@ -128,6 +128,15 @@ for x in $(cat /proc/cmdline); do
        nfsroot=*)
                NFSROOT="${x#nfsroot=}"
                ;;
+        httpfs=*)
+                HTTPFS="${x#httpfs=}"
+                ;;
+        iscsifs=*)
+                ISCSIFS="${x#iscsifs=}"
+                ;;
+        target=*)
+                TARGET="${x#target=}"
+                ;;
        netboot=*)
                NETBOOT="${x#netboot=}"
                ;;
@@ -254,6 +263,11 @@ if [ -n ${debug} ]; then
        unset debug
 fi
 
+# because of some reasons, I dont understand, resolv.conf is not being set
+# that is why I am copying this manually into actual filesystem. -- pravin
+cp /etc/resolv.conf /root/etc/resolv.conf
+
+
 # Chain to real filesystem
 maybe_break init
 exec run-init ${rootmnt} ${init} "$@" <${rootmnt}/dev/console >${rootmnt}/dev/console 2>&1
index c526429..c59ebec 100755 (executable)
@@ -6,7 +6,11 @@ echo "uploading debian initramfs"
 FILE_TO_COPY=/bko/live/debian/initmod/initrd1.img
 scp $LOCAL_BKO_LOCATION/$FILE_TO_COPY $REMOTE_BKO_LOCATION/$FILE_TO_COPY
 
-echo "uploading ubuntu initramfs"
+echo "uploading ubuntu-9.10 initramfs"
+FILE_TO_COPY=/bko/live/ubuntu/U9.10/initrd.lz
+scp $LOCAL_BKO_LOCATION/$FILE_TO_COPY $REMOTE_BKO_LOCATION/$FILE_TO_COPY
+
+echo "uploading ubuntu-9.04 initramfs"
 FILE_TO_COPY=/bko/live/ubuntu/U9/initrd.gz
 scp $LOCAL_BKO_LOCATION/$FILE_TO_COPY $REMOTE_BKO_LOCATION/$FILE_TO_COPY