Magellan Linux

Diff of /mcore-src/trunk/mcore-tools/daemon/client/include/network.client.class

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

revision 1348 by niro, Thu Feb 17 21:20:09 2011 UTC revision 2026 by niro, Mon Aug 13 11:28:31 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 23  set_network_hostname() Line 32  set_network_hostname()
32  {  {
33   local value="$1"   local value="$1"
34   local CONFIG   local CONFIG
35     local socket
36     local cookie
37     local authtype
38    
39   [[ -z ${value} ]] && help_network_hostname && return 1   [[ -z ${value} ]] && help_network_hostname && return 1
40    
41   CONFIG="/etc/hostname"   CONFIG="/etc/hostname"
42   clearconfig   clearconfig
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
59     if [[ ! -z $(pidof X) ]]
60     then
61     socket="${value}/unix${MCORE_XORG_DISPLAY}"
62     cookie=$(x11runas "xauth list | sed 's:.*\ \(.*\):\1:'")
63     authtype="MIT-MAGIC-COOKIE-1"
64     # add the new hostname to the xauthority file
65     x11runas "xauth add ${socket} ${authtype} ${cookie}"
66     fi
67  }  }
68    
69  help_network_iface()  help_network_iface()
# Line 75  set_network_iface() Line 110  set_network_iface()
110    
111   dhcp)   dhcp)
112   addconfig 'NETWORKING="dhcp"'   addconfig 'NETWORKING="dhcp"'
  # addconfig 'DHCP_PROG="/sbin/udhcpc"'  
  # addconfig 'DHCP_START="-t3 -T3 -q -b"'  
  # addconfig 'DHCP_STOP=""'  
113   ;;   ;;
114   esac   esac
115    
# Line 102  get_network_gateway() Line 134  get_network_gateway()
134  {  {
135   local gw   local gw
136   gw=$(ip route | grep default | sed 's:.*via[[:space:]]\(.*\)[[:space:]]dev.*:\1:')   gw=$(ip route | grep default | sed 's:.*via[[:space:]]\(.*\)[[:space:]]dev.*:\1:')
137   echo "${gw}"   rvecho "${gw}"
138  }  }
139    
140  set_network_gateway()  set_network_gateway()
# Line 130  help_network_nameserver() Line 162  help_network_nameserver()
162   mecho "get network.nameserver"   mecho "get network.nameserver"
163   mecho " displays the current nameserver of the system"   mecho " displays the current nameserver of the system"
164   mecho   mecho
165   mecho "set network.dns [ip1] [ip2] .. [ipN]"   mecho "set network.nameserver [ip1] [ip2] .. [ipN]"
166   mecho " adds given ips as nameserver to the system"   mecho " adds given ips as nameserver to the system"
167  }  }
168    
# Line 142  get_network_nameserver() Line 174  get_network_nameserver()
174   dns=$(grep nameserver /etc/resolv.conf | sed 's:.*[[:space:]]\(.*\):\1:g')   dns=$(grep nameserver /etc/resolv.conf | sed 's:.*[[:space:]]\(.*\):\1:g')
175   for i in ${dns}   for i in ${dns}
176   do   do
177   echo "${i}"   rvecho "${i}"
178   done   done
179  }  }
180    

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