Magellan Linux

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

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

revision 2008 by niro, Mon May 9 15:35:49 2011 UTC revision 3466 by niro, Fri Apr 13 17:27:25 2012 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/mysqlfunctions  source ${ALX_FUNCTIONS}/common
30  source /usr/lib/alxconfig-ng/functions/serial_functions  source ${ALX_FUNCTIONS}/mysqlfunctions
31  source /usr/lib/alxconfig-ng/functions/config_modules  source ${ALX_FUNCTIONS}/serial_functions
32  source /usr/lib/alxconfig-ng/functions/config_network  source ${ALX_FUNCTIONS}/config_modules
33  source /usr/lib/alxconfig-ng/functions/config_printers  source ${ALX_FUNCTIONS}/config_plugins
34  source /usr/lib/alxconfig-ng/functions/config_sessions  source ${ALX_FUNCTIONS}/config_network
35  source /usr/lib/alxconfig-ng/functions/config_x11  source ${ALX_FUNCTIONS}/config_printers
36  source /usr/lib/alxconfig-ng/functions/config_auth  source ${ALX_FUNCTIONS}/config_sessions
37  source /usr/lib/alxconfig-ng/functions/config_ssh_auth  source ${ALX_FUNCTIONS}/config_x11
38  source /usr/lib/alxconfig-ng/functions/config_versions  source ${ALX_FUNCTIONS}/config_auth
39    source ${ALX_FUNCTIONS}/config_ssh_auth
40    source ${ALX_FUNCTIONS}/config_versions
41    
42  # other needed vars  # other needed vars
43  ALX_HW_DETECT=false  ALX_HW_DETECT=false
# Line 50  unset ALX_SERIAL ALX_STATE Line 52  unset ALX_SERIAL ALX_STATE
52  # setup needed directories  # setup needed directories
53  [ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state  [ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state
54    
   
 # read_cmdline ${item}  
 read_cmdline()  
 {  
  local i  
   
  for i in $(< /proc/cmdline)  
  do  
  [[ ${i} = $1 ]] && return 0  
  done  
   
  return 1  
 }  
   
55  update_system_settings()  update_system_settings()
56  {  {
57   echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT}   rc_mecho Checking system setup ...
58    
59   # get the modules settings   # get the modules settings
60   # ! is the first thing that must be configured !   # ! is the first thing that must be configured !
61   config_modules   config_modules
62    
63     # install or uninstall plugins
64     config_plugins
65    
66   # imports network settings from db   # imports network settings from db
67   config_networking   config_networking
68    
# Line 96  update_system_settings() Line 87  update_system_settings()
87    
88  get_system_serial()  get_system_serial()
89  {  {
90   local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE   local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE CONFIG
91    
92   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
93   then   then
# Line 125  get_system_serial() Line 116  get_system_serial()
116   CUR_MAC=$(ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11)   CUR_MAC=$(ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11)
117   CUR_MTIME=$(date +%s)   CUR_MTIME=$(date +%s)
118    
119   echo -e ${COLOREDSTAR} "Trying to validate my serial ..."   rc_print "Trying to validate my serial ..."
120    
121   # nice serial output   # nice serial output
122   $CURS_UP   $CURS_UP
# Line 138  get_system_serial() Line 129  get_system_serial()
129   else   else
130   # abort on non valid serial   # abort on non valid serial
131   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
132   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
133     clearconfig
134     addconfig "ALX_STATE=\"${ALX_STATE}\""
135   show_invalid_serial_msg   show_invalid_serial_msg
136   exit 1   exit 1
137   fi   fi
# Line 148  get_system_serial() Line 141  get_system_serial()
141   echo   echo
142   if [[ ${ALX_FORCED_RECHECK} = true ]]   if [[ ${ALX_FORCED_RECHECK} = true ]]
143   then   then
144   echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT}   rc_mecho "Hardware autodetection forced by system-administrator"
145   # always disable CONFD_NETWORKING here   # always disable CONFD_NETWORKING here
146   export ALX_CONFD_NETWORKING="false"   export ALX_CONFD_NETWORKING="false"
147   else   else
148   echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT}   rc_mecho "Preparing system for first boot"
149   fi   fi
150   ALX_HW_DETECT=true   ALX_HW_DETECT=true
151   /etc/init.d/hwdetect start   hwsetup
152    
153   # set hostname to alx_default_hostname   # set hostname to alx_default_hostname
154   # use old hostname if this is a forced re-check   # use old hostname if this is a forced re-check
# Line 164  get_system_serial() Line 157  get_system_serial()
157   HOSTNAME="${ALX_DEFAULT_HOSTNAME}"   HOSTNAME="${ALX_DEFAULT_HOSTNAME}"
158    
159   # update the hostname on the system for sure   # update the hostname on the system for sure
160   echo "${HOSTNAME}" > /etc/hostname   CONFIG="/etc/hostname"
161     clearconfig
162     addconfig "${HOSTNAME}"
163    
164   # start preliminary networking (dhcp)   # start preliminary networking (dhcp)
165   preliminary_network start   preliminary_network start
# Line 177  get_system_serial() Line 172  get_system_serial()
172   exit 1   exit 1
173   fi   fi
174    
175   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')   CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp')
176   CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)   CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11)
177   CUR_MTIME=$(date +%s)   CUR_MTIME=$(date +%s)
178    
179   # abort now if this is a forced re-check   # abort now if this is a forced re-check
# Line 187  get_system_serial() Line 182  get_system_serial()
182   # but first check the serial   # but first check the serial
183   source /etc/alxconfig-ng/serial   source /etc/alxconfig-ng/serial
184    
185   echo -e ${COLOREDSTAR} "Trying to validate my serial ..."   rc_print "Trying to validate my serial ..."
186    
187   # nice serial output   # nice serial output
188   $CURS_UP   $CURS_UP
# Line 200  get_system_serial() Line 195  get_system_serial()
195   else   else
196   # abort on non valid serial   # abort on non valid serial
197   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
198   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
199     clearconfig
200     addconfig "ALX_STATE=\"${ALX_STATE}\""
201   show_invalid_serial_msg   show_invalid_serial_msg
202   exit 1   exit 1
203   fi   fi
204    
205   # write current state to temp file   # write current state to temp file
206   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
207     clearconfig
208     addconfig "ALX_STATE=\"${ALX_STATE}\""
209   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection
210    
211   # now export ALX_FORCED_RECHECK=true   # now export ALX_FORCED_RECHECK=true
# Line 215  get_system_serial() Line 214  get_system_serial()
214   return 0   return 0
215   fi   fi
216    
217   echo -e ${COLOREDSTAR} "Trying to get new serial ..."   rc_print "Trying to get new serial ..."
218    
219   # request a new serial; one command now (cause must be done in the same session)   # request a new serial; one command now (cause must be done in the same session)
220   ALX_SERIAL=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}');   ALX_SERIAL=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}');
# Line 231  get_system_serial() Line 230  get_system_serial()
230   # set ALX_STATE to ok so everybody knows that everything was ok   # set ALX_STATE to ok so everybody knows that everything was ok
231   ALX_STATE=ok   ALX_STATE=ok
232    
233   echo "ALX_SERIAL=\"${ALX_SERIAL}\"" > /etc/alxconfig-ng/serial   CONFIG="/etc/alxconfig-ng/serial"
234   echo "ALX_REG_DATE=\"${CUR_MTIME}\"" >> /etc/alxconfig-ng/serial   clearconfig
235     addconfig "ALX_SERIAL=\"${ALX_SERIAL}\""
236     addconfig "ALX_REG_DATE=\"${CUR_MTIME}\""
237    
238   evaluate_retval   evaluate_retval
239   else   else
# Line 251  get_system_serial() Line 252  get_system_serial()
252   fi   fi
253    
254   # write current state to temp file   # write current state to temp file
255   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state   CONFIG="/etc/alxconfig-ng/state/state"
256   echo "ALX_IFACE=\"${ALX_IFACE}\"" >> /etc/alxconfig-ng/state/state   clearconfig
257     addconfig "ALX_STATE=\"${ALX_STATE}\""
258     addconfig "ALX_IFACE=\"${ALX_IFACE}\""
259  }  }
260    
261    
# Line 277  import_settings_to_db() Line 280  import_settings_to_db()
280   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
281   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
282    
283   # vars used by hwdetect   # vars used by hwsetup
284   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
285   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
286   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
287    
288   # get setting from hwdetect   # get setting from hwsetup
289   source /etc/conf.d/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
290   source /etc/conf.d/hwsetup/mouse   source /etc/conf.d/hwsetup/mouse
291    
292   echo   echo
293   echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT}   rc_mecho "Importing detected settings to database"
294    
295   # network   # network
296   echo -e "      Network settings ..."   rc_mecho "      Network settings ..."
297   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
298   then   then
299   # get settings   # get settings
  #source ${rc_base}/init.d/network &> /dev/null  
300   for iface in $(onboot_interface_list ${network_settings}/net.*)   for iface in $(onboot_interface_list ${network_settings}/net.*)
301   do   do
302   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
303   echo "WARNING: only importing settings for interface [ ${iface} ] !"   rc_echo "WARNING: only importing settings for interface [ ${iface} ] !"
304   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || echo "Error: could not read '${network_settings}/net.${iface}'"
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 371  import_settings_to_db() Line 373  import_settings_to_db()
373   evaluate_retval   evaluate_retval
374    
375   # xserver   # xserver
376   echo -e "      Graphic settings ..."   rc_mecho "      Graphic settings ..."
377   # xserver general   # xserver general
378   ( mysqldo "insert into cfg_graphic(   ( mysqldo "insert into cfg_graphic(
379   serial,   serial,
# Line 390  import_settings_to_db() Line 392  import_settings_to_db()
392   evaluate_retval   evaluate_retval
393    
394   # input   # input
395   echo -e "      Input settings ..."   rc_mecho "      Input settings ..."
396   mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');"   mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');"
397   evaluate_retval   evaluate_retval
398    
399   # auth   # auth
400   echo -e "      Authentification settings ..."   rc_mecho "      Authentification settings ..."
401   mysqldo "insert into client_auth(   mysqldo "insert into client_auth(
402   serial,   serial,
403   username,   username,
# Line 416  import_settings_to_db() Line 418  import_settings_to_db()
418    
419   # exchange ssh rsa keys - the first boot needs this !   # exchange ssh rsa keys - the first boot needs this !
420   # or no reboot will work via the webadmin   # or no reboot will work via the webadmin
421   echo -e "      SSH authentification settings ..."   rc_mecho "      SSH authentification settings ..."
422   HOME=/root config_ssh_auth   HOME=/root config_ssh_auth
423   evaluate_retval   evaluate_retval
424    
425   # autostart   # autostart
426   echo -e "      Autostart settings ..."   rc_mecho "      Autostart settings ..."
427   mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"   mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"
428    
429   # screensaver   # screensaver
430   echo -e "      Screensaver settings ..."   rc_mecho "      Screensaver settings ..."
431   mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"   mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"
432    
433   # version info   # version info
434     rc_mecho "      OS version info ..."
435   local alx_os   local alx_os
436   local alx_utils   local alx_utils
437   alx_os="$(< /etc/mageversion)"   alx_os="$(< /etc/mageversion)"
438   alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')"   alx_utils="$(magequery -n alxconfig-ng | sed 's:.*\[\ \(.*\)\ \].*:\1:')"
439   alx_utils="${alx_utils/alxconfig-ng-alx-}"   alx_utils="${alx_utils/alxconfig-ng-}"
440   mysqldo "insert into client_version(serial,os,utils) values('${ALX_SERIAL}','${alx_os}','${alx_utils}')"   mysqldo "insert into client_version(serial,os,utils) values('${ALX_SERIAL}','${alx_os}','${alx_utils}')"
441    
442   evaluate_retval   evaluate_retval
# Line 450  update_settings_in_db() Line 453  update_settings_in_db()
453   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
454   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
455    
456   # vars used by hwdetect   # vars used by hwsetup
457   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
458   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
459   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
460    
461   # get setting from hwdetect   # get setting from hwsetup
462   source /etc/conf.d/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
463   source /etc/conf.d/hwsetup/mouse   source /etc/conf.d/hwsetup/mouse
464    
465   echo   echo
466   echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT}   rc_mecho "Updating detected settings in database"
467    
468   # network   # network
469   echo -e "      Network settings ..."   rc_mecho "      Network settings ..."
470   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
471   then   then
472   # get settings   # get settings
# Line 471  update_settings_in_db() Line 474  update_settings_in_db()
474   for iface in $(onboot_interface_list ${network_settings}/net.*)   for iface in $(onboot_interface_list ${network_settings}/net.*)
475   do   do
476   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
477   echo "WARNING: only importing settings for interface [ ${iface} ] !"   rc_echo "WARNING: only importing settings for interface [ ${iface} ] !"
478   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || exit 1
479   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"   NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)"
480    
481   mysqldo "update cfg_network set   mysqldo "update cfg_network set
482   hostname='${ALX_DEFAULT_HOSTNAME}',   hostname='${ALX_DEFAULT_HOSTNAME}',
# Line 512  update_settings_in_db() Line 515  update_settings_in_db()
515   evaluate_retval   evaluate_retval
516    
517   # xserver   # xserver
518   echo -e "      Graphic settings ..."   rc_mecho "      Graphic settings ..."
519   # xserver general   # xserver general
520   mysqldo "update cfg_graphic set   mysqldo "update cfg_graphic set
521   module='${XMODULE}',   module='${XMODULE}',
# Line 523  update_settings_in_db() Line 526  update_settings_in_db()
526   evaluate_retval   evaluate_retval
527    
528   # input   # input
529   echo -e "      Input settings ..."   rc_mecho "      Input settings ..."
530   mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"   mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"
531   evaluate_retval   evaluate_retval
532    
533   # version info   # version info
534     rc_mecho "      OS version info ..."
535   local alx_os   local alx_os
536   local alx_utils   local alx_utils
537   alx_os="$(< /etc/mageversion)"   alx_os="$(< /etc/mageversion)"
# Line 547  import_settings_local() Line 551  import_settings_local()
551   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
552   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
553    
554   # vars used by hwdetect   # vars used by hwsetup
555   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
556   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
557   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
558    
559   # get setting from hwdetect   # get setting from hwsetup
560   source /etc/conf.d/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
561    
562   echo   echo
563   echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT}   rc_mecho "Importing detected settings to local system"
564    
565   if [[ ${ALX_CONFD_NETWORKING} = false ]]   if [[ ${ALX_CONFD_NETWORKING} = false ]]
566   then   then
567   #[ ! -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  
568   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d
569   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modules.d/net.eth0   # update only if not the same (to speed up bootprocess - no depmod)
570   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0   CONFIG="/etc/modprobe.d/net.${ALX_IFACE}.conf"
571     clearconfig
572     addconfig "alias ${ALX_IFACE} ${cfg_network_module}"
573    
574     # update confd-networking default iface
575     [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}
576     CONFIG="${SETTINGSPATH}/confd-networking"
577     clearconfig
578     addconfig "${ALX_IFACE}"
579    
580   # regenerate modprobe.conf   # regenerate modprobe.conf
581   [ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf"   [ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!"
582   evaluate_retval   evaluate_retval
583   fi   fi
584    
# Line 590  import_settings_local() Line 598  import_settings_local()
598   # now generate fluxbox config files   # now generate fluxbox config files
599    
600   # fluxbox main config   # fluxbox main config
601   cat ${ALX_SKELETONS}/fluxbox/init \   local fbinit
602   > ${ALX_UNPRIV_HOME}/.fluxbox/init   if [ -f ${ALX_SKELETONS}/fluxbox/init ]
603     then
604     fbinit="${ALX_SKELETONS}/fluxbox/init"
605     else
606     fbinit="/usr/share/fluxbox/init"
607     fi
608     cat ${fbinit} > ${ALX_UNPRIV_HOME}/.fluxbox/init
609    
610   # fluxbox autostart   # fluxbox autostart
611   cat ${ALX_SKELETONS}/fluxbox/apps \   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"
612   > ${ALX_UNPRIV_HOME}/.fluxbox/apps   # do not show decorations on messages generated with xmessage
613     if [ -x /usr/bin/xmessage ]
614     then
615     addconfig '[app] (xmessage)'
616     addconfig ' [Deco] {NONE}'
617     addconfig '[end]'
618     fi
619     # add icon utility
620     [ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}'
621     # add numlock utility
622     [ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}'
623    
624     # fluxbox hotkeys
625     local fbkeys
626     if [ -f ${ALX_SKELETONS}/fluxbox/keys ]
627     then
628     fbkeys="${ALX_SKELETONS}/fluxbox/keys"
629     else
630     fbkeys="/usr/share/fluxbox/keys"
631     fi
632     cat ${fbkeys} > ${ALX_UNPRIV_HOME}/.fluxbox/keys
633    
634   # fluxbox menu header   # fluxbox menu header
635   cat ${ALX_SKELETONS}/fluxbox/menu.header \   cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu
  > ${ALX_UNPRIV_HOME}/.fluxbox/menu  
636    
637   # now fix it with proper messages :P   # now fix it with proper messages :P
638   local ver="$(< /etc/mageversion)"   local ver="$(< /etc/mageversion)"
639   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  
640    
641   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
642   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
643    
644   # fluxbox menu footer   # fluxbox menu footer
645   cat ${ALX_SKELETONS}/fluxbox/menu.footer \   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
  >> ${ALX_UNPRIV_HOME}/.fluxbox/menu  
646    
647   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
648   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
649    
   
650   # setup some standart icons (sysinfo.lnk)   # setup some standart icons (sysinfo.lnk)
  # basic config  
  cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc  
   
651   # clean desktop icon location   # clean desktop icon location
652   [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop   [ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop
653   install -d ${ALX_UNPRIV_HOME}/.xtdesktop   install -d ${ALX_UNPRIV_HOME}/.idesktop
654    
655     # add shutdown, reboot icons
656     local name
657     # default settings
658     declare -i x=30
659     declare -i y=30
660     for i in shutdown reboot
661     do
662     case ${i} in
663     shutdown) name="Herunterfahren" ;;
664     reboot) name="Neustarten" ;;
665     esac
666    
667     generate_icon \
668     --name "${name}" \
669     --command "/usr/lib/alxconfig-ng/bin/user_${i}.sh" \
670     --icon "${ALX_SESSIONS_ICONS}/${i}.png" \
671     --dest "${dest}/${i}.lnk" \
672     --xres "${x}" \
673     --yres "${y}"
674    
675     y=$((${y} + 80))
676     done
677    
678   # last but not least gen a icon with some sys informations   # last but not least gen a icon with some sys informations
679   local sysinfo   local sysinfo
# Line 645  import_settings_local() Line 695  import_settings_local()
695   --name "${sysinfo}" \   --name "${sysinfo}" \
696   --command "exit 0" \   --command "exit 0" \
697   --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \   --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \
698   --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \   --dest "${ALX_UNPRIV_HOME}/.idesktop/sysinfo.lnk" \
699   --xres "${xres}" \   --xres "${xres}" \
700   --yres "${yres}" \   --yres "${yres}" \
701   --icon-width "1" \   --icon-width "1" \
702   --icon-height "1"   --icon-height "1"
703    
  # create a xinitrc  
  echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc  
   
704   # set correct permissions   # set correct permissions
705   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
706   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
707   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
708   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop   chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop
709   chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc   if [ -f ${ALX_UNPRIV_HOME}/.ideskrc ]
710   chmod 0644 ${ALX_UNPRIV_HOME}/.xinitrc   then
711     chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc
712     fi
713  }  }
714    
715  # start|stop  # start|stop
716  preliminary_network()  preliminary_network()
717  {  {
718   local module   local module
  local modulesconf  
719    
720   if [ -f /etc/alxconfig-ng/state/configured ]   if [ -f /etc/alxconfig-ng/state/configured ]
721   then   then
# Line 679  preliminary_network() Line 727  preliminary_network()
727   modprobe ${module}   modprobe ${module}
728   fi   fi
729    
  # check modprobe.conf  
  if [[ $(kernel_major_version) = 2.4 ]]  
  then  
  modulesconf="/etc/modules.conf"  
  else  
  modulesconf="/etc/modprobe.conf"  
  fi  
  if [[ -z $(grep eth0 ${modulesconf}) ]]  
  then  
  modules-update force  
  fi  
730   else   else
731   # vars used by hwdetect   # vars used by hwsetup
732   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
733   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
734    
735   # get setting from hwdetect   # get setting from hwsetup
736   source /etc/conf.d/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
737   modprobe ${NETCARD_DRIVER}   modprobe ${NETCARD_DRIVER}
738   fi   fi
# Line 705  preliminary_network() Line 742  preliminary_network()
742   # keeping like always safe:   # keeping like always safe:
743   # no network should be startet here,   # no network should be startet here,
744   # so we can delete all pid files if one exists   # so we can delete all pid files if one exists
745   if ps -A|grep dhcpcd > /dev/null   if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]]
746   then   then
747   echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT}   rc_mecho "Forcing network down"
748   dhcpcd -k   killall $(basename ${ALX_DHCP_PROG}) &> /dev/null
749   sleep 1   sleep 1
  else  
  rm -f /var/run/dhcpcd-eth?.pid  
750   fi   fi
751   [[ ${ALX_CONFD_NETWORKING} = true ]] && [[ ${RUNLEVEL} != S ]] && \   [[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop
  ${rc_base}/init.d/network stop  
752    
753   echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT}   rc_mecho "Starting preliminary networking ... "
754    
755   # start network configured from /etc/conf.d   # start network configured from /etc/conf.d
756   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
757   then   then
758   ${rc_base}/init.d/network start   ${rc_base}/init.d/network start
759   else   else
760   echo -e ${COLOREDSTAR}"Starting default dhcp based networking ... "${COLDEFAULT}   rc_print "Starting default dhcp based networking ... "
761   # -t 10 timeout of 10 secs   ${ALX_DHCP_PROG} ${ALX_DHCP_START} ${ALX_IFACE} &> /dev/null
  dhcpcd -t 10 &> /dev/null  
762   evaluate_retval   evaluate_retval
763   fi   fi
764   ;;   ;;
765    
766   stop)   stop)
767   echo -e ${COLMAGENTA}"Stopping preliminary networking ... "${COLDEFAULT}   rc_mecho "Stopping preliminary networking ... "
768   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
769   then   then
770   ${rc_base}/init.d/network stop   ${rc_base}/init.d/network stop
771   else   else
772   echo -e ${COLOREDSTAR}"Stopping default dhcp based networking ... "${COLDEFAULT}   rc_print "Stopping default dhcp based networking ... "
773   ifconfig eth0 down   ifconfig ${ALX_IFACE} down
774   fi   fi
775   if ps -A|grep dhcpcd > /dev/null   if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]]
776   then   then
777   dhcpcd -z  &> /dev/null   killall $(basename ${ALX_DHCP_PROG}) &> /dev/null
778   sleep 1   sleep 1
779   fi   fi
780   evaluate_retval   evaluate_retval
# Line 756  preliminary_network() Line 789  preliminary_network()
789  reset_system_settings()  reset_system_settings()
790  {  {
791   # force load of de kbdkeys   # force load of de kbdkeys
792   loadkeys -q de   [ -x /usr/bin/loadkeys ] && loadkeys -q de
793   echo   [ -x /sbin/loadkmap ] && loadkmap < /usr/share/busybox/keymaps/de.kmap
794   echo -en ${COLRED}   rc_echo
795   echo -n "*** Warning: you are about to reset *all* local settings on this system!"   rc_echo -en "${COLRED}"
796   echo -e ${COLDEFAULT}   rc_echo -n '--- Warning: you are about to reset *all* local settings on this system!'
797   echo "*** Do you really want to continue ?"   rc_echo -e "${COLDEFAULT}"
798   echo -n "*** Enter 'yes' to continue, anything else to abort: "   rc_echo '--- Do you really want to continue ?'
799     rc_echo -n '--- Enter 'yes' to continue, anything else to abort: '
800   read kbinsert   read kbinsert
801   if [[ ${kbinsert} = yes ]]   if [[ ${kbinsert} = yes ]]
802   then   then
803   echo -en ${COLRED}   rc_echo -en "${COLRED}"
804   echo -n "*** OK, you really want it ... killing all settings: "   rc_echo -n '--- OK, you really want it ... killing all settings: '
805   for i in 3 2 1 now   for i in 3 2 1 now
806   do   do
807   echo -n " ${i}"   rc_echo -n " ${i}"
808   sleep 1   sleep 1
809   done   done
810   echo -e ${COLDEFAULT}   rc_echo -e "${COLDEFAULT}"
811    
812   ## reset all settings:   ## reset all settings:
813   rm -rf ${SETTINGSPATH}/*   rm -rf ${SETTINGSPATH}
814   rm -f /etc/alxconfig-ng/serial   rm -f /etc/alxconfig-ng/serial
815   rm -rf /etc/alxconfig-ng/state   rm -rf /etc/alxconfig-ng/state
816     local i
817     for i in xserver netcard knoppix mouse
818     do
819     [[ -f /etc/conf.d/hwsetup/${i} ]] && rm /etc/conf.d/hwsetup/${i}
820     done
821    
822   # clear all printers & net-shares   # clear all printers & net-shares
823   :> /etc/cups/printers.conf   :> /etc/printcap
  :> /etc/samba/smb.conf  
824    
825   # remove inetd, cups & smb from init   # remove lprng
826   rc-config del inetd &> /dev/null   rc-config del lprng &> /dev/null
827   rc-config del cups &> /dev/null   rc-config del nmbd &> /dev/null
  rc-config del samba &> /dev/null  
828    
829   # remove all user settings   # remove all user settings
830   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}
831     install -o ${ALX_UNPRIV_USER} -g ${ALX_UNPRIV_GROUP} -d ${ALX_UNPRIV_HOME}
832    
833   # remove all ica-sessions   # remove all ica-sessions
834   find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm   find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs --no-run-if-empty rm
835    
836   # remove all old nics and modules configs   # remove all old nics and modules configs
837   find /etc/conf.d -type f -name 'net.*' | xargs rm   find /etc/conf.d -type f -name 'net.*' | xargs --no-run-if-empty rm
838   find /etc/modules.d -type f -name 'net.*' | xargs rm   find /etc/modprobe.d -type f -name 'net.*' | xargs --no-run-if-empty rm
839    
840   # restore default networking   # restore default networking
841   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0
842     local CONFIG="/etc/hostname"
843     clearconfig
844     addconfig "${ALX_DEFAULT_HOSTNAME}"
845    
846   echo "I am done now, press [Enter] to reboot system ..."   rc_echo -n "I am done now, press [Enter] to reboot system ..."
847   else   else
848   echo "Aborted, press [Enter] to reboot system ..."   rc_echo -n "Aborted, press [Enter] to reboot system ..."
849   fi   fi
850   read   read
851   reboot   sync
852     mount -oremount,ro /
853     reboot -f
854  }  }
855    
856  onboot_interface_list()  onboot_interface_list()
# Line 932  case $1 in Line 975  case $1 in
975   [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state   [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state
976   sleep 0.1   sleep 0.1
977   ;;   ;;
978    
979   *)   *)
980   echo "Usage: $0 {start|stop} ..."   echo "Usage: $0 {start|stop} ..."
981   ;;   ;;
982  esac  esac
   

Legend:
Removed from v.2008  
changed lines
  Added in v.3466