Magellan Linux

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

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

alx-src/branches/alxconf_20060908/init.d/alxsettings revision 1582 by niro, Tue Nov 23 12:24:14 2010 UTC alx-src/branches/alxconf-060/init.d/alxsettings revision 3460 by niro, Fri Apr 13 17:13:56 2012 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    # $Id$
3  # <niro@magellan-linux.de>  # <niro@magellan-linux.de>
4    
5  #%rlevels: 7:s 0:k 6:k  #%rlevels: 7:s 0:k
6  #%start: 41  #%start: 41
7  #%stop: 01  #%stop: 01
8    
# Line 11  Line 11 
11  #%before:  #%before:
12  #%after:  #%after:
13    
 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.27 2005-10-11 12:10:15 niro Exp $  
   
14  # checks first if the client was already configured and if it has an valid serial  # checks first if the client was already configured and if it has an valid serial
15  # if not it runs the autoconfiguration script  # if not it runs the autoconfiguration script
16  # these settings will be used for client setup  # these settings will be used for client setup
# Line 21  Line 19 
19  # if no changes are at server side they will be kept, if yes the get updated.  # if no changes are at server side they will be kept, if yes the get updated.
20  # the server settings has higher priority.  # the server settings has higher priority.
21    
22  source /etc/sysconfig/rc  source /etc/conf.d/rc
23  source $rc_functions  source $rc_functions
24    
25  # mysql settings  # mysql settings
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  # check if mysql is available  source ${ALX_FUNCTIONS}/config_versions
 [ -x /usr/bin/mysql ] && MYSQL_ALX=true  
41    
42  # other needed vars  # other needed vars
43  ALX_HW_DETECT=false  ALX_HW_DETECT=false
# Line 55  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 126  get_system_serial() Line 112  get_system_serial()
112   exit 1   exit 1
113   fi   fi
114    
115   CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp')   CUR_IP=$(ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp')
116   CUR_MAC=$(/sbin/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 143  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   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
133   show_invalid_serial_msg   show_invalid_serial_msg
134   exit 1   exit 1
135   fi   fi
# Line 153  get_system_serial() Line 139  get_system_serial()
139   echo   echo
140   if [[ ${ALX_FORCED_RECHECK} = true ]]   if [[ ${ALX_FORCED_RECHECK} = true ]]
141   then   then
142   echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT}   rc_mecho "Hardware autodetection forced by system-administrator"
143     # always disable CONFD_NETWORKING here
144     export ALX_CONFD_NETWORKING="false"
145   else   else
146   echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT}   rc_mecho "Preparing system for first boot"
147   fi   fi
148   ALX_HW_DETECT=true   ALX_HW_DETECT=true
149   /etc/init.d/hwdetect start   hwsetup
150    
151   # set hostname to alx_default_hostname   # set hostname to alx_default_hostname
152   # use old hostname if this is a forced re-check   # use old hostname if this is a forced re-check
# Line 180  get_system_serial() Line 168  get_system_serial()
168   exit 1   exit 1
169   fi   fi
170    
171   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')  
172   CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)   CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp')
173     CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11)
174   CUR_MTIME=$(date +%s)   CUR_MTIME=$(date +%s)
175    
176   # abort now if this is a forced re-check   # abort now if this is a forced re-check
# Line 190  get_system_serial() Line 179  get_system_serial()
179   # but first check the serial   # but first check the serial
180   source /etc/alxconfig-ng/serial   source /etc/alxconfig-ng/serial
181    
182   echo -e ${COLOREDSTAR} "Trying to validate my serial ..."   rc_print "Trying to validate my serial ..."
183    
184   # nice serial output   # nice serial output
185   $CURS_UP   $CURS_UP
# Line 209  get_system_serial() Line 198  get_system_serial()
198   fi   fi
199    
200   # write current state to temp file   # write current state to temp file
201   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
202   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection   [ -f /hardware-auto-detection ] && rm /hardware-auto-detection
203    
204   # now export ALX_FORCED_RECHECK=true   # now export ALX_FORCED_RECHECK=true
# Line 218  get_system_serial() Line 207  get_system_serial()
207   return 0   return 0
208   fi   fi
209    
210   echo -e ${COLOREDSTAR} "Trying to get new serial ..."   rc_print "Trying to get new serial ..."
211    
212   # 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)
213   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 234  get_system_serial() Line 223  get_system_serial()
223   # set ALX_STATE to ok so everybody knows that everything was ok   # set ALX_STATE to ok so everybody knows that everything was ok
224   ALX_STATE=ok   ALX_STATE=ok
225    
226   echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial   echo "ALX_SERIAL=\"${ALX_SERIAL}\"" > /etc/alxconfig-ng/serial
227   echo "ALX_REG_DATE=${CUR_MTIME}" >> /etc/alxconfig-ng/serial   echo "ALX_REG_DATE=\"${CUR_MTIME}\"" >> /etc/alxconfig-ng/serial
228    
229   evaluate_retval   evaluate_retval
230   else   else
# Line 254  get_system_serial() Line 243  get_system_serial()
243   fi   fi
244    
245   # write current state to temp file   # write current state to temp file
246   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
247   echo "ALX_IFACE=${ALX_IFACE}" >> /etc/alxconfig-ng/state/state   echo "ALX_IFACE=\"${ALX_IFACE}\"" >> /etc/alxconfig-ng/state/state
248  }  }
249    
250    
# Line 280  import_settings_to_db() Line 269  import_settings_to_db()
269   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
270   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
271    
272   # vars used by hwdetect   # vars used by hwsetup
273   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
274   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
275   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
276    
277   # get setting from hwdetect   # get setting from hwsetup
278   source /etc/sysconfig/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
279   source /etc/sysconfig/hwsetup/mouse   source /etc/conf.d/hwsetup/mouse
280    
281   echo   echo
282   echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT}   rc_mecho "Importing detected settings to database"
283    
284   # network   # network
285   echo -e "      Network settings ..."   rc_mecho "      Network settings ..."
286   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
287   then   then
288   # get settings   # get settings
  #source ${rc_base}/init.d/network &> /dev/null  
289   for iface in $(onboot_interface_list ${network_settings}/net.*)   for iface in $(onboot_interface_list ${network_settings}/net.*)
290   do   do
291   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
292   echo "WARNING: only importing settings for interface [ ${iface} ] !"   rc_echo "WARNING: only importing settings for interface [ ${iface} ] !"
293   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || echo "Error: could not read '${network_settings}/net.${iface}'"
294   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"   NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)"
295    
296   mysqldo "insert into cfg_network(   mysqldo "insert into cfg_network(
297   hostname,   hostname,
# Line 374  import_settings_to_db() Line 362  import_settings_to_db()
362   evaluate_retval   evaluate_retval
363    
364   # xserver   # xserver
365   echo -e "      Graphic settings ..."   rc_mecho "      Graphic settings ..."
366   # xserver general   # xserver general
367   ( mysqldo "insert into cfg_graphic(   ( mysqldo "insert into cfg_graphic(
368   serial,   serial,
# Line 393  import_settings_to_db() Line 381  import_settings_to_db()
381   evaluate_retval   evaluate_retval
382    
383   # input   # input
384   echo -e "      Input settings ..."   rc_mecho "      Input settings ..."
385   mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');"   mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');"
386   evaluate_retval   evaluate_retval
387    
388   # auth   # auth
389   echo -e "      Authentification settings ..."   rc_mecho "      Authentification settings ..."
390   mysqldo "insert into client_auth(   mysqldo "insert into client_auth(
391   serial,   serial,
392   username,   username,
# Line 419  import_settings_to_db() Line 407  import_settings_to_db()
407    
408   # exchange ssh rsa keys - the first boot needs this !   # exchange ssh rsa keys - the first boot needs this !
409   # or no reboot will work via the webadmin   # or no reboot will work via the webadmin
410   echo -e "      SSH authentification settings ..."   rc_mecho "      SSH authentification settings ..."
411   HOME=/root config_ssh_auth   HOME=/root config_ssh_auth
412   evaluate_retval   evaluate_retval
413    
414   # autostart   # autostart
415   echo -e "      Autostart settings ..."   rc_mecho "      Autostart settings ..."
416   mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"   mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"
417    
418   # screensaver   # screensaver
419   echo -e "      Screensaver settings ..."   rc_mecho "      Screensaver settings ..."
420   mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"   mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"
421    
422   # version info   # version info
423     rc_mecho "      OS version info ..."
424   local alx_os   local alx_os
425   local alx_utils   local alx_utils
426   alx_os="$(< /etc/mageversion)"   alx_os="$(< /etc/mageversion)"
427   alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')"   alx_utils="$(magequery -n alxconfig-ng | sed 's:.*\[\ \(.*\)\ \].*:\1:')"
428   alx_utils="${alx_utils/alxconfig-ng-alx-}"   alx_utils="${alx_utils/alxconfig-ng-}"
429   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}')"
430    
431   evaluate_retval   evaluate_retval
# Line 453  update_settings_in_db() Line 442  update_settings_in_db()
442   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
443   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
444    
445   # vars used by hwdetect   # vars used by hwsetup
446   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
447   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
448   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
449    
450   # get setting from hwdetect   # get setting from hwsetup
451   source /etc/sysconfig/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
452   source /etc/sysconfig/hwsetup/mouse   source /etc/conf.d/hwsetup/mouse
453    
454   echo   echo
455   echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT}   rc_mecho "Updating detected settings in database"
456    
457   # network   # network
458   echo -e "      Network settings ..."   rc_mecho "      Network settings ..."
459   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
460   then   then
461   # get settings   # get settings
# Line 474  update_settings_in_db() Line 463  update_settings_in_db()
463   for iface in $(onboot_interface_list ${network_settings}/net.*)   for iface in $(onboot_interface_list ${network_settings}/net.*)
464   do   do
465   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
466   echo "WARNING: only importing settings for interface [ ${iface} ] !"   rc_echo "WARNING: only importing settings for interface [ ${iface} ] !"
467   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || exit 1
468   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"   NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)"
469    
470   mysqldo "update cfg_network set   mysqldo "update cfg_network set
471   hostname='${ALX_DEFAULT_HOSTNAME}',   hostname='${ALX_DEFAULT_HOSTNAME}',
# Line 515  update_settings_in_db() Line 504  update_settings_in_db()
504   evaluate_retval   evaluate_retval
505    
506   # xserver   # xserver
507   echo -e "      Graphic settings ..."   rc_mecho "      Graphic settings ..."
508   # xserver general   # xserver general
509   mysqldo "update cfg_graphic set   mysqldo "update cfg_graphic set
510   module='${XMODULE}',   module='${XMODULE}',
# Line 526  update_settings_in_db() Line 515  update_settings_in_db()
515   evaluate_retval   evaluate_retval
516    
517   # input   # input
518   echo -e "      Input settings ..."   rc_mecho "      Input settings ..."
519   mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"   mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"
520   evaluate_retval   evaluate_retval
521    
522   # version info   # version info
523     rc_mecho "      OS version info ..."
524   local alx_os   local alx_os
525   local alx_utils   local alx_utils
526   alx_os="$(< /etc/mageversion)"   alx_os="$(< /etc/mageversion)"
# Line 550  import_settings_local() Line 540  import_settings_local()
540   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
541   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
542    
543   # vars used by hwdetect   # vars used by hwsetup
544   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
545   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
546   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
547    
548   # get setting from hwdetect   # get setting from hwsetup
549   source /etc/sysconfig/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
550    
551   echo   echo
552   echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT}   rc_mecho "Importing detected settings to local system"
553    
554   if [[ ${ALX_CONFD_NETWORKING} = false ]]   if [[ ${ALX_CONFD_NETWORKING} = false ]]
555   then   then
  #[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}  
  #echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules  
   
556   # set an device alias for modprobe.conf   # set an device alias for modprobe.conf
557   [ ! -d /etc/modules.d ] && install -d /etc/modules.d   [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d
558   echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modules.d/net.eth0   # update only if not the same (to speed up bootprocess - no depmod)
559     CONFIG="/etc/modprobe.d/net.${ALX_IFACE}.conf"
560     clearconfig
561     addconfig "alias ${ALX_IFACE} ${cfg_network_module}"
562    
563     # update confd-networking default iface
564     [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}
565     CONFIG="${SETTINGSPATH}/confd-networking"
566     clearconfig
567     addconfig "${ALX_IFACE}"
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 || rc_echo "modules-update not found!"
571   evaluate_retval   evaluate_retval
572   fi   fi
573    
574   # set system state to 'already configured'   # set system state to 'already configured'
575   touch /etc/alxconfig-ng/state/configured   touch /etc/alxconfig-ng/state/configured
576    
577     # install slim desktopmanager configuration
578     config_display_manager
579    
580   # if only an recheck was forced than abort now   # if only an recheck was forced than abort now
581   [[ ${ALX_FORCED_RECHECK} = true ]] && return 0   [[ ${ALX_FORCED_RECHECK} = true ]] && return 0
582    
# Line 588  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 \   local fbinit
591   > ${ALX_UNPRIV_HOME}/.fluxbox/init   if [ -f ${ALX_SKELETONS}/fluxbox/init ]
592     then
593     fbinit="${ALX_SKELETONS}/fluxbox/init"
594     else
595     fbinit="/usr/share/fluxbox/init"
596     fi
597     cat ${fbinit} > ${ALX_UNPRIV_HOME}/.fluxbox/init
598    
599   # fluxbox autostart   # fluxbox autostart
600   cat ${ALX_SKELETONS}/fluxbox/apps \   CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"
601   > ${ALX_UNPRIV_HOME}/.fluxbox/apps   # do not show decorations on messages generated with xmessage
602     if [ -x /usr/bin/xmessage ]
603     then
604     addconfig '[app] (xmessage)'
605     addconfig ' [Deco] {NONE}'
606     addconfig '[end]'
607     fi
608     # add icon utility
609     [ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}'
610     # add numlock utility
611     [ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}'
612    
613     # fluxbox hotkeys
614     local fbkeys
615     if [ -f ${ALX_SKELETONS}/fluxbox/keys ]
616     then
617     fbkeys="${ALX_SKELETONS}/fluxbox/keys"
618     else
619     fbkeys="/usr/share/fluxbox/keys"
620     fi
621     cat ${fbkeys} > ${ALX_UNPRIV_HOME}/.fluxbox/keys
622    
623   # fluxbox menu header   # fluxbox menu header
624   cat ${ALX_SKELETONS}/fluxbox/menu.header \   cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu
  > ${ALX_UNPRIV_HOME}/.fluxbox/menu  
625    
626   # now fix it with proper messages :P   # now fix it with proper messages :P
627   local ver="$(< /etc/mageversion)"   local ver="$(< /etc/mageversion)"
628   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  
629    
630   # add a newline (maybe there is no crlf in the header)   # add a newline (maybe there is no crlf in the header)
631   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
632    
633   # fluxbox menu footer   # fluxbox menu footer
634   cat ${ALX_SKELETONS}/fluxbox/menu.footer \   cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
  >> ${ALX_UNPRIV_HOME}/.fluxbox/menu  
635    
636   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
637   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
638    
   
639   # setup some standart icons (sysinfo.lnk)   # setup some standart icons (sysinfo.lnk)
  # basic config  
  cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc  
   
640   # clean desktop icon location   # clean desktop icon location
641   [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop   [ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop
642   install -d ${ALX_UNPRIV_HOME}/.xtdesktop   install -d ${ALX_UNPRIV_HOME}/.idesktop
643    
644     # add shutdown, reboot icons
645     local name
646     # default settings
647     declare -i x=30
648     declare -i y=30
649     for i in shutdown reboot
650     do
651     case ${i} in
652     shutdown) name="Herunterfahren" ;;
653     reboot) name="Neustarten" ;;
654     esac
655    
656     generate_icon \
657     --name "${name}" \
658     --command "/usr/lib/alxconfig-ng/bin/user_${i}.sh" \
659     --icon "${ALX_SESSIONS_ICONS}/${i}.png" \
660     --dest "${dest}/${i}.lnk" \
661     --xres "${x}" \
662     --yres "${y}"
663    
664     y=$((${y} + 80))
665     done
666    
667   # last but not least gen a icon with some sys informations   # last but not least gen a icon with some sys informations
668   local sysinfo   local sysinfo
# Line 643  import_settings_local() Line 684  import_settings_local()
684   --name "${sysinfo}" \   --name "${sysinfo}" \
685   --command "exit 0" \   --command "exit 0" \
686   --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \   --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \
687   --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \   --dest "${ALX_UNPRIV_HOME}/.idesktop/sysinfo.lnk" \
688   --xres "${xres}" \   --xres "${xres}" \
689   --yres "${yres}" \   --yres "${yres}" \
690   --icon-width "1" \   --icon-width "1" \
691   --icon-height "1"   --icon-height "1"
692    
  # create a xinitrc  
  echo "exec startfluxbox" > ${ALX_UNPRIV_HOME}/.xinitrc  
   
693   # set correct permissions   # set correct permissions
694   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
695   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
696   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
697   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop   chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop
698   chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc   if [ -f ${ALX_UNPRIV_HOME}/.ideskrc ]
699   chmod 0644 ${ALX_UNPRIV_HOME}/.xinitrc   then
700     chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc
701     fi
702  }  }
703    
704  # start|stop  # start|stop
# Line 675  preliminary_network() Line 715  preliminary_network()
715   module=$(cat ${SETTINGSPATH}/modules)   module=$(cat ${SETTINGSPATH}/modules)
716   modprobe ${module}   modprobe ${module}
717   fi   fi
718    
719   else   else
720   # vars used by hwdetect   # vars used by hwsetup
721   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
722   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
723    
724   # get setting from hwdetect   # get setting from hwsetup
725   source /etc/sysconfig/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
726   modprobe ${NETCARD_DRIVER}   modprobe ${NETCARD_DRIVER}
727   fi   fi
728    
# Line 690  preliminary_network() Line 731  preliminary_network()
731   # keeping like always safe:   # keeping like always safe:
732   # no network should be startet here,   # no network should be startet here,
733   # so we can delete all pid files if one exists   # so we can delete all pid files if one exists
734   if ps -A|grep dhcpcd > /dev/null   if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]]
735   then   then
736   echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT}   rc_mecho "Forcing network down"
737   dhcpcd -k   killall $(basename ${ALX_DHCP_PROG}) &> /dev/null
738   sleep 1   sleep 1
  else  
  rm -f /var/run/dhcpcd-eth?.pid  
739   fi   fi
740   [[ ${ALX_CONFD_NETWORKING} = true ]] && [[ ${RUNLEVEL} != S ]] && \   [[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop
  ${rc_base}/init.d/network stop  
741    
742   echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT}   rc_mecho "Starting preliminary networking ... "
743    
744   # start network configured from /etc/conf.d   # start network configured from /etc/conf.d
745   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
746   then   then
747   ${rc_base}/init.d/network start   ${rc_base}/init.d/network start
748   else   else
749   echo -e ${COLOREDSTAR}"Starting default dhcp based networking ... "${COLDEFAULT}   rc_print "Starting default dhcp based networking ... "
750   # -t 10 timeout of 10 secs   ${ALX_DHCP_PROG} ${ALX_DHCP_START} ${ALX_IFACE} &> /dev/null
  dhcpcd -t 10 &> /dev/null  
751   evaluate_retval   evaluate_retval
752   fi   fi
753   ;;   ;;
754    
755   stop)   stop)
756   echo -e ${COLMAGENTA}"Stopping preliminary networking ... "${COLDEFAULT}   rc_mecho "Stopping preliminary networking ... "
757   if [[ ${ALX_CONFD_NETWORKING} = true ]]   if [[ ${ALX_CONFD_NETWORKING} = true ]]
758   then   then
759   ${rc_base}/init.d/network stop   ${rc_base}/init.d/network stop
760   else   else
761   echo -e ${COLOREDSTAR}"Stopping default dhcp based networking ... "${COLDEFAULT}   rc_print "Stopping default dhcp based networking ... "
762   ifconfig eth0 down   ifconfig ${ALX_IFACE} down
763   fi   fi
764   if ps -A|grep dhcpcd > /dev/null   if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]]
765   then   then
766   dhcpcd -z  &> /dev/null   killall $(basename ${ALX_DHCP_PROG}) &> /dev/null
767     sleep 1
768   fi   fi
769   evaluate_retval   evaluate_retval
770   ;;   ;;
# Line 740  preliminary_network() Line 778  preliminary_network()
778  reset_system_settings()  reset_system_settings()
779  {  {
780   # force load of de kbdkeys   # force load of de kbdkeys
781   loadkeys -q de   [ -x /usr/bin/loadkeys ] && loadkeys -q de
782   echo   [ -x /sbin/loadkmap ] && loadkmap < /usr/share/busybox/keymaps/de.kmap
783   echo -en ${COLRED}   rc_echo
784   echo -n "*** Warning: you are about to reset *all* local settings on this system!"   rc_echo -en "${COLRED}"
785   echo -e ${COLDEFAULT}   rc_echo -n '--- Warning: you are about to reset *all* local settings on this system!'
786   echo "*** Do you really want to continue ?"   rc_echo -e "${COLDEFAULT}"
787   echo -n "*** Enter 'yes' to continue, anything else to abort: "   rc_echo '--- Do you really want to continue ?'
788     rc_echo -n '--- Enter 'yes' to continue, anything else to abort: '
789   read kbinsert   read kbinsert
790   if [[ ${kbinsert} = yes ]]   if [[ ${kbinsert} = yes ]]
791   then   then
792   echo -en ${COLRED}   rc_echo -en "${COLRED}"
793   echo -n "*** OK, you really want it ... killing all settings: "   rc_echo -n '--- OK, you really want it ... killing all settings: '
794   for i in 3 2 1 now   for i in 3 2 1 now
795   do   do
796   echo -n " ${i}"   rc_echo -n " ${i}"
797   sleep 1   sleep 1
798   done   done
799   echo -e ${COLDEFAULT}   rc_echo -e "${COLDEFAULT}"
800    
801   ## reset all settings:   ## reset all settings:
802   rm -rf ${SETTINGSPATH}/*   rm -rf ${SETTINGSPATH}
803   rm -f /etc/alxconfig-ng/serial   rm -f /etc/alxconfig-ng/serial
804   rm -rf /etc/alxconfig-ng/state   rm -rf /etc/alxconfig-ng/state
805    
806   # clear all printers & net-shares   # clear all printers & net-shares
807   :> /etc/cups/printers.conf   :> /etc/printcap
  :> /etc/samba/smb.conf  
808    
809   # remove inetd, cups & smb from init   # remove lprng
810   rc-config del inetd &> /dev/null   rc-config del lprng &> /dev/null
811   rc-config del cups &> /dev/null   rc-config del nmbd &> /dev/null
  rc-config del samba &> /dev/null  
812    
813   # remove all user settings   # remove all user settings
814   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}   [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}
815    
816   # remove all ica-sessions   # remove all ica-sessions
817   find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm   find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs --no-run-if-empty rm
818    
819   # remove all old nics and modules configs   # remove all old nics and modules configs
820   find /etc/conf.d -type f -name 'net.*' | xargs rm   find /etc/conf.d -type f -name 'net.*' | xargs --no-run-if-empty rm
821   find /etc/modules.d -type f -name 'net.*' | xargs rm   find /etc/modprobe.d -type f -name 'net.*' | xargs --no-run-if-empty rm
822    
823   # restore default networking   # restore default networking
824   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0   cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0
825    
826   echo "I am done now, press [Enter] to reboot system ..."   rc_echo "I am done now, press [Enter] to reboot system ..."
827   else   else
828   echo "Aborted, press [Enter] to reboot system ..."   rc_echo "Aborted, press [Enter] to reboot system ..."
829   fi   fi
830   read   read
831   reboot   reboot
# Line 916  case $1 in Line 953  case $1 in
953   [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state   [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state
954   sleep 0.1   sleep 0.1
955   ;;   ;;
956    
957   *)   *)
958   echo "Usage: $0 {start|stop} ..."   echo "Usage: $0 {start|stop} ..."
959   ;;   ;;
960  esac  esac
   

Legend:
Removed from v.1582  
changed lines
  Added in v.3460