Magellan Linux

Diff of /alx-src/branches/alxconf-060/init.d/alxsettings

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

revision 2014 by niro, Mon May 9 16:01:06 2011 UTC revision 2122 by niro, Mon May 16 11:08:31 2011 UTC
# Line 26  source $rc_functions Line 26  source $rc_functions
26  source /etc/alxconfig-ng/config.rc  source /etc/alxconfig-ng/config.rc
27    
28  # helper functions  # helper functions
29    source /usr/lib/alxconfig-ng/functions/common
30  source /usr/lib/alxconfig-ng/functions/mysqlfunctions  source /usr/lib/alxconfig-ng/functions/mysqlfunctions
31  source /usr/lib/alxconfig-ng/functions/serial_functions  source /usr/lib/alxconfig-ng/functions/serial_functions
32  source /usr/lib/alxconfig-ng/functions/config_modules  source /usr/lib/alxconfig-ng/functions/config_modules
# Line 177  get_system_serial() Line 178  get_system_serial()
178   exit 1   exit 1
179   fi   fi
180    
181    
182   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')
183   CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)   CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)
184   CUR_MTIME=$(date +%s)   CUR_MTIME=$(date +%s)
# Line 300  import_settings_to_db() Line 302  import_settings_to_db()
302   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
303   echo "WARNING: only importing settings for interface [ ${iface} ] !"   echo "WARNING: only importing settings for interface [ ${iface} ] !"
304   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || exit 1
305   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"   NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)"
306    
307   mysqldo "insert into cfg_network(   mysqldo "insert into cfg_network(
308   hostname,   hostname,
# Line 473  update_settings_in_db() Line 475  update_settings_in_db()
475   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
476   echo "WARNING: only importing settings for interface [ ${iface} ] !"   echo "WARNING: only importing settings for interface [ ${iface} ] !"
477   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || exit 1
478   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"   NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)"
479    
480   mysqldo "update cfg_network set   mysqldo "update cfg_network set
481   hostname='${ALX_DEFAULT_HOSTNAME}',   hostname='${ALX_DEFAULT_HOSTNAME}',
# Line 560  import_settings_local() Line 562  import_settings_local()
562    
563   if [[ ${ALX_CONFD_NETWORKING} = false ]]   if [[ ${ALX_CONFD_NETWORKING} = false ]]
564   then   then
565   #[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}   # set an device alias for modprobe.conf
  #echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules  
   
  # set an device alias for modprobe.conf and modules.conf  
  [ ! -d /etc/modules.d ] && install -d /etc/modules.d  
566   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d
567   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modules.d/net.eth0   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0.conf
  echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0  
568    
569   # regenerate modprobe.conf   # regenerate modprobe.conf
570   [ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf"   [ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf"
# Line 590  import_settings_local() Line 587  import_settings_local()
587   # now generate fluxbox config files   # now generate fluxbox config files
588    
589   # fluxbox main config   # fluxbox main config
590   cat ${ALX_SKELETONS}/fluxbox/init \   cat ${ALX_SKELETONS}/fluxbox/init > ${ALX_UNPRIV_HOME}/.fluxbox/init
  > ${ALX_UNPRIV_HOME}/.fluxbox/init  
591    
592   # fluxbox autostart   # fluxbox autostart
593   cat ${ALX_SKELETONS}/fluxbox/apps \   cat ${ALX_SKELETONS}/fluxbox/apps > ${ALX_UNPRIV_HOME}/.fluxbox/apps
  > ${ALX_UNPRIV_HOME}/.fluxbox/apps  
594    
595   # fluxbox menu header   # fluxbox menu header
596   cat ${ALX_SKELETONS}/fluxbox/menu.header \   cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu
  > ${ALX_UNPRIV_HOME}/.fluxbox/menu  
597    
598   # now fix it with proper messages :P   # now fix it with proper messages :P
599   local ver="$(< /etc/mageversion)"   local ver="$(< /etc/mageversion)"
600   sed -i "s:@CHANGEME@:alx-${ver}  #${ALX_SERIAL}:g" \   sed -i "s:@CHANGEME@:alx-${ver}  #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu
  ${ALX_UNPRIV_HOME}/.fluxbox/menu  
601    
602   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
603   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
604    
605   # fluxbox menu footer   # fluxbox menu footer
606   cat ${ALX_SKELETONS}/fluxbox/menu.footer \   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
  >> ${ALX_UNPRIV_HOME}/.fluxbox/menu  
607    
608   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
609   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
# Line 693  preliminary_network() Line 685  preliminary_network()
685   # keeping like always safe:   # keeping like always safe:
686   # no network should be startet here,   # no network should be startet here,
687   # so we can delete all pid files if one exists   # so we can delete all pid files if one exists
688   if ps -A|grep udhcpc > /dev/null   if [[ ! -z $(pidof udhcpc) ]]
689   then   then
690   echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT}   echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT}
691   killall udhcpc &> /dev/null   killall udhcpc &> /dev/null
692   sleep 1   sleep 1
693   fi   fi
694   [[ ${ALX_CONFD_NETWORKING} = true ]] && [[ ${RUNLEVEL} != S ]] && \   [[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop
  ${rc_base}/init.d/network stop  
695    
696   echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT}   echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT}
697    
# Line 725  preliminary_network() Line 716  preliminary_network()
716   echo -e ${COLOREDSTAR}"Stopping default dhcp based networking ... "${COLDEFAULT}   echo -e ${COLOREDSTAR}"Stopping default dhcp based networking ... "${COLDEFAULT}
717   ifconfig eth0 down   ifconfig eth0 down
718   fi   fi
719   if ps -A|grep udhcpc > /dev/null   if [[ ! -z $(pidof udhcpc) ]]
720   then   then
721   killall udhcpc  &> /dev/null   killall udhcpc  &> /dev/null
722   sleep 1   sleep 1
# Line 767  reset_system_settings() Line 758  reset_system_settings()
758   rm -rf /etc/alxconfig-ng/state   rm -rf /etc/alxconfig-ng/state
759    
760   # clear all printers & net-shares   # clear all printers & net-shares
761   :> /etc/cups/printers.conf   :> /etc/printcap
  :> /etc/samba/smb.conf  
762    
763   # remove inetd, cups & smb from init   # remove lprng
764   rc-config del inetd &> /dev/null   rc-config del lprng &> /dev/null
  rc-config del cups &> /dev/null  
  rc-config del samba &> /dev/null  
765    
766   # remove all user settings   # remove all user settings
767   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}
# Line 783  reset_system_settings() Line 771  reset_system_settings()
771    
772   # remove all old nics and modules configs   # remove all old nics and modules configs
773   find /etc/conf.d -type f -name 'net.*' | xargs rm   find /etc/conf.d -type f -name 'net.*' | xargs rm
774   find /etc/modules.d -type f -name 'net.*' | xargs rm   find /etc/modprobe.d -type f -name 'net.*' | xargs rm
775    
776   # restore default networking   # restore default networking
777   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0
# Line 918  case $1 in Line 906  case $1 in
906   [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state   [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state
907   sleep 0.1   sleep 0.1
908   ;;   ;;
909    
910   *)   *)
911   echo "Usage: $0 {start|stop} ..."   echo "Usage: $0 {start|stop} ..."
912   ;;   ;;

Legend:
Removed from v.2014  
changed lines
  Added in v.2122