Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/src/modules/network/network.client.class.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1351 by niro, Thu Feb 17 21:44:18 2011 UTC revision 2032 by niro, Mon Aug 13 11:59:21 2012 UTC
# Line 15  help_network_hostname() Line 15  help_network_hostname()
15    
16  get_network_hostname()  get_network_hostname()
17  {  {
18   hostname   local val
19    
20     if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
21     then
22     val=$(hostname)
23     else
24     val=$(< /etc/hostname)
25     fi
26    
27     rvecho "${val}"
28  }  }
29    
30  # set_network_hostname $value  # set_network_hostname $value
# Line 34  set_network_hostname() Line 43  set_network_hostname()
43   addconfig "${value}"   addconfig "${value}"
44   hostname "${value}"   hostname "${value}"
45    
46     # update hosts file
47     CONFIG="/etc/hosts"
48     clearconfig
49     addconfig "127.0.0.1 localhost ${value}"
50     # add ipv6 defaults
51     addconfig "::1 ip6-localhost ip6-loopback"
52     addconfig "fe00::0 ip6-localnet"
53     addconfig "ff00::0 ip6-mcastprefix"
54     addconfig "ff02::1 ip6-allnodes"
55     addconfig "ff02::2 ip6-allrouters"
56     addconfig "ff02::3 ip6-allhosts"
57    
58   # check for running x11 and recreate the xauth cookie with the correct hostname   # check for running x11 and recreate the xauth cookie with the correct hostname
59   if [[ ! -z $(pidof X) ]]   if [[ ! -z $(pidof X) ]]
60   then   then
# Line 62  set_network_iface() Line 83  set_network_iface()
83   local broadcast="$5"   local broadcast="$5"
84   local network="$6"   local network="$6"
85   local CONFIG   local CONFIG
86     local dhcp_prog
87    
88   [[ -z ${iface} ]] && help_network_iface && return 1   [[ -z ${iface} ]] && help_network_iface && return 1
89   [[ -z ${networking} ]] && help_network_iface && return 1   [[ -z ${networking} ]] && help_network_iface && return 1
# Line 89  set_network_iface() Line 111  set_network_iface()
111    
112   dhcp)   dhcp)
113   addconfig 'NETWORKING="dhcp"'   addconfig 'NETWORKING="dhcp"'
  # addconfig 'DHCP_PROG="/sbin/udhcpc"'  
  # addconfig 'DHCP_START="-t3 -T3 -q -b"'  
  # addconfig 'DHCP_STOP=""'  
114   ;;   ;;
115   esac   esac
116    
117   if [[ ! -z $(ip addr | grep "${iface}.*UP.*") ]]   if [[ -z ${MROOT} ]] || [[ ${MROOT} = / ]]
118   then   then
119   set_system_service restart network "${iface}"   if [[ ! -z $(ip addr | grep "${iface}.*UP.*") ]]
120     then
121     set_system_service restart network "${iface}"
122     else
123     set_system_service start network "${iface}"
124     fi
125   else   else
126   set_system_service start network "${iface}"   case ${networking} in
127     static)
128     ifconfig "${iface}" "${ip}" netmask "${netmask}" broadcast "${broadcast}"
129     ;;
130     dhcp)
131     source /etc/conf.d/network
132     [[ ! -z $(pidof ${dhcp_prog}) ]] && killall ${DEFAULT_DHCP_PROG}
133     ${DEFAULT_DHCP_PROG} ${DEFAULT_DHCP_START} "${iface}"
134     ;;
135     esac
136   fi   fi
137  }  }
138    
# Line 116  get_network_gateway() Line 149  get_network_gateway()
149  {  {
150   local gw   local gw
151   gw=$(ip route | grep default | sed 's:.*via[[:space:]]\(.*\)[[:space:]]dev.*:\1:')   gw=$(ip route | grep default | sed 's:.*via[[:space:]]\(.*\)[[:space:]]dev.*:\1:')
152   echo "${gw}"   rvecho "${gw}"
153  }  }
154    
155  set_network_gateway()  set_network_gateway()
# Line 156  get_network_nameserver() Line 189  get_network_nameserver()
189   dns=$(grep nameserver /etc/resolv.conf | sed 's:.*[[:space:]]\(.*\):\1:g')   dns=$(grep nameserver /etc/resolv.conf | sed 's:.*[[:space:]]\(.*\):\1:g')
190   for i in ${dns}   for i in ${dns}
191   do   do
192   echo "${i}"   rvecho "${i}"
193   done   done
194  }  }
195    

Legend:
Removed from v.1351  
changed lines
  Added in v.2032