Magellan Linux

Diff of /alx-src/branches/alxconf-060/functions/config_network.sh

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

alx-src/tags/alxconf_20060908_1/alxconfig-ng/functions/config_network.sh revision 375, Mon Feb 20 14:49:31 2006 UTC alx-src/branches/alxconf-060/functions/config_network.sh revision 2120 by niro, Mon May 16 11:06:46 2011 UTC
# Line 1  Line 1 
1  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/functions/config_network.sh,v 1.14 2005-10-26 11:58:07 niro Exp $  # $Id$
2  # configures networkin on the host via mysql db settings  # configures networking on the host via mysql db settings
3    
4  get_network_settings()  get_network_settings()
5  {  {
# Line 59  get_network_settings() Line 59  get_network_settings()
59  config_networking()  config_networking()
60  {  {
61   local iface   local iface
62     local CONFIG
63    
64   # first of all get the vars   # first of all get the vars
65   get_network_settings   get_network_settings
# Line 74  config_networking() Line 75  config_networking()
75    
76   # remove all old nics and modules configs   # remove all old nics and modules configs
77   find /etc/conf.d -type f -name 'net.*' | xargs rm   find /etc/conf.d -type f -name 'net.*' | xargs rm
78   find /etc/modules.d -type f -name 'net.*' | xargs rm   find /etc/modprobe.d -type f -name 'net.*' | xargs rm
79    
80   # update the preliminary network   # update the preliminary network
81   # set an device alias for modprobe.conf   # set an device alias for modprobe.conf
82   [ ! -d /etc/modules.d ] && install -d /etc/modules.d   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d
83   # update only if not the same (to speed up bootprocess - no depmod)   # update only if not the same (to speed up bootprocess - no depmod)
84   if [ ! -f /etc/modules.d/net.${iface} ] ||   if [ ! -f /etc/modprobe.d/net.${iface}.conf ] ||
85   [[ ${iface} != $(cat /etc/modules.d/net.${iface} | cut -d' ' -f2) ]]   [[ ${iface} != $(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f2) ]]
86   then   then
87   echo "alias ${iface} ${ALX_MODULE}" > /etc/modules.d/net.${iface}   CONFIG=/etc/modprobe.d/net.${iface}.conf
88     clearconfig
89     addconfig "alias ${iface} ${ALX_MODULE}"
90   fi   fi
91    
92   # update confd-networking default iface   # update confd-networking default iface
93   [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}   [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}
94   echo "${iface}" > ${SETTINGSPATH}/confd-networking   CONFIG=${SETTINGSPATH}/confd-networking
95     clearconfig
96     addconfig "${iface}"
97    
98   # hostname && hosts   # hostname && hosts
99   echo "${ALX_HOSTNAME}" > /etc/hostname   CONFIG=/etc/hostname
100   echo -e "127.0.0.1\tlocalhost.${ALX_DOMAIN}\tlocalhost\t${ALX_HOSTNAME}" > /etc/hosts   clearconfig
101     addconfig "${ALX_HOSTNAME}"
102     CONFIG=/etc/hosts
103     clearconfig
104     addconfig -e "127.0.0.1\tlocalhost.${ALX_DOMAIN}\tlocalhost\t${ALX_HOSTNAME}"
105     case ${ALX_NETWORKING} in
106     static|STATIC)
107     # add hostname with valid ip to hosts
108     addconfig -e "${ALX_IP}\t${ALX_HOSTNAME}.${ALX_DOMAIN}\t${ALX_HOSTNAME}"
109     ;;
110     esac
111    
112   # network devices   # network devices
113    
114   # always on boot   # always on boot
115   echo 'ONBOOT="yes"' > /etc/conf.d/net.${iface}   CONFIG=/etc/conf.d/net.${iface}
116   echo "NETWORKING=\"${ALX_NETWORKING}\"" >> /etc/conf.d/net.${iface}   clearconfig
117    
118     addconfig 'ONBOOT="yes"'
119     addconfig "NETWORKING=\"${ALX_NETWORKING}\""
120   case ${ALX_NETWORKING} in   case ${ALX_NETWORKING} in
121   dhcp|DHCP)   dhcp|DHCP)
122   echo 'DHCP_PROG="/sbin/dhcpcd"' >> /etc/conf.d/net.${iface}   addconfig 'DHCP_PROG="/sbin/udhcpc"'
123   # -k kills the dhcp-cache at system shutdown   addconfig 'DHCP_STOP=""'
  # -z will not  
  echo 'DHCP_STOP="-z"' >> /etc/conf.d/net.${iface}  
124   #timeout after 10 seconds   #timeout after 10 seconds
125   echo 'DHCP_START="-t 10"' >> /etc/conf.d/net.${iface}   addconfig 'DHCP_START="-t 10"'
126   ;;   ;;
127    
128   static|STATIC)   static|STATIC)
129   # add hostname with valid ip to hosts   addconfig "IP=\"${ALX_IP}\""
130   echo -e "${ALX_IP}\t${ALX_HOSTNAME}.${ALX_DOMAIN}\t${ALX_HOSTNAME}" >> /etc/hosts   addconfig "NETMASK=\"${ALX_NETMASK}\""
131   echo "IP=\"${ALX_IP}\"" >> /etc/conf.d/net.${iface}   addconfig "BROADCAST=\"${ALX_BROADCAST}\""
  echo "NETMASK=\"${ALX_NETMASK}\"" >> /etc/conf.d/net.${iface}  
  echo "BROADCAST=\"${ALX_BROADCAST}\"" >> /etc/conf.d/net.${iface}  
132   ;;   ;;
133   esac   esac
134    
  # gateway or gateway overrides  
  if [[ ${ALX_GATEWAY} != NULL ]]  
  then  
  echo "GATEWAY=\"${ALX_GATEWAY}\"" >> /etc/conf.d/net.${iface}  
  echo "GATEWAY_IF=\"${iface}\"" >> /etc/conf.d/net.${iface}  
  fi  
   
135   # force mac address override   # force mac address override
136   if [[ ${ALX_FORCEMACTO} != NULL ]]   if [[ ${ALX_FORCEMACTO} != NULL ]]
137   then   then
138   echo "FORCE_MAC_TO=\"${ALX_FORCEMACTO}\"" >> /etc/conf.d/net.${iface}   addconfig "FORCE_MAC_TO=\"${ALX_FORCEMACTO}\""
  fi  
   
  # nameserver or nameserver overrides  
  if [[ ${ALX_DNS} != NULL ]]  
  then  
  echo "nameserver ${ALX_DNS}" > /etc/resolv.conf  
139   fi   fi
140    
  # setup smb.conf (little sed magic:)  
  # first get smb version !  
  local smbconf  
  [[ $(smbd --version | cut -d' ' -f2) > 2.999 ]] && smbconf=smb3.conf || smbconf=smb.conf  
   
  cat ${ALX_SKELETONS}/samba/${smbconf} > /etc/samba/smb.conf  
  sed -i -e "s:\(workgroup = \).*:\1${ALX_DOMAIN}:" /etc/samba/smb.conf  
   
141   # wireless extensions   # wireless extensions
142   local value   local value
143   local var   local var
# Line 167  config_networking() Line 159  config_networking()
159   if [[ -n ${value} ]] && [[ ${value} != NULL ]]   if [[ -n ${value} ]] && [[ ${value} != NULL ]]
160   then   then
161   # remove ALX_ from var   # remove ALX_ from var
162   echo "${var/ALX_/}=\"${value}\"" >> /etc/conf.d/net.${iface}   addconfig "${var/ALX_/}=\"${value}\""
163   fi   fi
164    
165   # clear value   # clear value
166   unset value   unset value
167   done   done
168    
169     # FIXME !!!
170   # setup wpa-driver (only zydas atm)   # setup wpa-driver (only zydas atm)
171   [[ ${ALX_MODULE} = zd1211 ]] && \   if [[ ${ALX_MODULE} = zd1211 ]]
172   echo "WIRELESS_WPA_DRIVER=zydas" >> /etc/conf.d/net.${iface}   then
173     addconfig "WIRELESS_WPA_DRIVER=zydas"
174     fi
175    
176     CONFIG=/etc/conf.d/net.routes
177     clearconfig
178     # gateway or gateway overrides
179     if [[ ${ALX_GATEWAY} != NULL ]]
180     then
181     addconfig "default gw ${ALX_GATEWAY}"
182     fi
183    
184     CONFIG=/etc/resolv.conf
185     clearconfig
186     # nameserver or nameserver overrides
187     if [[ ${ALX_DNS} != NULL ]]
188     then
189     addconfig "nameserver ${ALX_DNS}"
190     fi
191    
192   # unset all vars   # unset all vars
193   unset ALX_HOSTNAME   unset ALX_HOSTNAME
# Line 201  config_networking() Line 212  config_networking()
212   unset ALX_WIRELESS_KEY   unset ALX_WIRELESS_KEY
213   unset ALX_WIRELESS_KEY_ASCII   unset ALX_WIRELESS_KEY_ASCII
214  }  }
   

Legend:
Removed from v.375  
changed lines
  Added in v.2120