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 1348 by niro, Thu Feb 17 21:20:09 2011 UTC revision 1646 by niro, Thu Mar 10 18:14:47 2011 UTC
# Line 23  set_network_hostname() Line 23  set_network_hostname()
23  {  {
24   local value="$1"   local value="$1"
25   local CONFIG   local CONFIG
26     local socket
27     local cookie
28     local authtype
29    
30   [[ -z ${value} ]] && help_network_hostname && return 1   [[ -z ${value} ]] && help_network_hostname && return 1
31    
32   CONFIG="/etc/hostname"   CONFIG="/etc/hostname"
33   clearconfig   clearconfig
34   addconfig "${value}"   addconfig "${value}"
35   hostname "${value}"   hostname "${value}"
36    
37     # update hosts file
38     CONFIG="/etc/hosts"
39     clearconfig
40     addconfig "127.0.0.1 localhost ${value}"
41     # add ipv6 defaults
42     addconfig "::1 ip6-localhost ip6-loopback"
43     addconfig "fe00::0 ip6-localnet"
44     addconfig "ff00::0 ip6-mcastprefix"
45     addconfig "ff02::1 ip6-allnodes"
46     addconfig "ff02::2 ip6-allrouters"
47     addconfig "ff02::3 ip6-allhosts"
48    
49     # check for running x11 and recreate the xauth cookie with the correct hostname
50     if [[ ! -z $(pidof X) ]]
51     then
52     socket="${value}/unix${MCORE_XORG_DISPLAY}"
53     cookie=$(x11runas "xauth list | sed 's:.*\ \(.*\):\1:'")
54     authtype="MIT-MAGIC-COOKIE-1"
55     # add the new hostname to the xauthority file
56     x11runas "xauth add ${socket} ${authtype} ${cookie}"
57     fi
58  }  }
59    
60  help_network_iface()  help_network_iface()
# Line 102  get_network_gateway() Line 128  get_network_gateway()
128  {  {
129   local gw   local gw
130   gw=$(ip route | grep default | sed 's:.*via[[:space:]]\(.*\)[[:space:]]dev.*:\1:')   gw=$(ip route | grep default | sed 's:.*via[[:space:]]\(.*\)[[:space:]]dev.*:\1:')
131   echo "${gw}"   rvecho "${gw}"
132  }  }
133    
134  set_network_gateway()  set_network_gateway()
# Line 130  help_network_nameserver() Line 156  help_network_nameserver()
156   mecho "get network.nameserver"   mecho "get network.nameserver"
157   mecho " displays the current nameserver of the system"   mecho " displays the current nameserver of the system"
158   mecho   mecho
159   mecho "set network.dns [ip1] [ip2] .. [ipN]"   mecho "set network.nameserver [ip1] [ip2] .. [ipN]"
160   mecho " adds given ips as nameserver to the system"   mecho " adds given ips as nameserver to the system"
161  }  }
162    
# Line 142  get_network_nameserver() Line 168  get_network_nameserver()
168   dns=$(grep nameserver /etc/resolv.conf | sed 's:.*[[:space:]]\(.*\):\1:g')   dns=$(grep nameserver /etc/resolv.conf | sed 's:.*[[:space:]]\(.*\):\1:g')
169   for i in ${dns}   for i in ${dns}
170   do   do
171   echo "${i}"   rvecho "${i}"
172   done   done
173  }  }
174    

Legend:
Removed from v.1348  
changed lines
  Added in v.1646