Magellan Linux

Diff of /alx-src/trunk/tinyalxconfig-ng/functions/config_network.sh

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

revision 392 by niro, Wed Jun 4 18:07:24 2008 UTC revision 447 by niro, Thu Jun 5 17:21:37 2008 UTC
# Line 1  Line 1 
1  # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_network.sh,v 1.2 2008-06-04 18:07:24 niro Exp $  # $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/functions/config_network.sh,v 1.7 2008-06-05 17:21:37 niro Exp $
2  # configures networkin on the host via mysql db settings  # configures networkin on the host via mysql db settings
3    
4  get_network_settings()  get_network_settings()
# Line 56  get_network_settings() Line 56  get_network_settings()
56   export ALX_WIRELESS_KEY_ASCII=$(mysqldo "select wireless_key_ascii from cfg_network where serial='${ALX_SERIAL}'")   export ALX_WIRELESS_KEY_ASCII=$(mysqldo "select wireless_key_ascii from cfg_network where serial='${ALX_SERIAL}'")
57  }  }
58    
59    check_network_settings()
60    {
61     # sanity checks
62     [[ ${ALX_IFACE} = NULL ]] && return 1
63     [[ ${ALX_HOSTNAME} = NULL ]] && return 1
64     [[ ${ALX_NETWORKING} = NULL ]] && return 1
65    
66     # if we get here, everything is ok
67     return 0
68    }
69    
70  config_networking()  config_networking()
71  {  {
72   local iface   local iface
73    
74   # first of all get the vars   # first of all get the vars
75   get_network_settings   get_network_settings
76     if ! check_network_settings
77     then
78     echo -e "${COLYELLOW}Could not retrieve network settings, doing nothing ...${COLDEFAULT}"
79     return 1
80     fi
81    
82   # get the right nic   # get the right nic
83   if [[ -z ${ALX_IFACE} ]] || [[ ${ALX_IFACE} = NULL ]]   if [[ -z ${ALX_IFACE} ]] || [[ ${ALX_IFACE} = NULL ]]
# Line 74  config_networking() Line 90  config_networking()
90    
91   # remove all old nics and modules configs   # remove all old nics and modules configs
92   find /etc/conf.d -type f -name 'net.*' | xargs rm   find /etc/conf.d -type f -name 'net.*' | xargs rm
  find /etc/modules.d -type f -name 'net.*' | xargs rm  
   
  # update the preliminary network  
  # set an device alias for modprobe.conf  
  [ ! -d /etc/modules.d ] && install -d /etc/modules.d  
  # update only if not the same (to speed up bootprocess - no depmod)  
  if [ ! -f /etc/modules.d/net.${iface} ] ||  
  [[ ${iface} != $(cat /etc/modules.d/net.${iface} | cut -d' ' -f2) ]]  
  then  
  echo "alias ${iface} ${ALX_MODULE}" > /etc/modules.d/net.${iface}  
  fi  
93    
94   # update confd-networking default iface   # update confd-networking default iface
95   [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}   [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}
# Line 135  config_networking() Line 140  config_networking()
140   echo "nameserver ${ALX_DNS}" > /etc/resolv.conf   echo "nameserver ${ALX_DNS}" > /etc/resolv.conf
141   fi   fi
142    
  # 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  
   
143   # wireless extensions   # wireless extensions
144   local value   local value
145   local var   local var

Legend:
Removed from v.392  
changed lines
  Added in v.447