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/trunk/alxconfig-ng/init.d/alxsettings revision 221 by niro, Tue Mar 8 20:49:14 2005 UTC alx-src/branches/alxconf-060/init.d/alxsettings revision 2471 by niro, Mon Jun 27 15:14:05 2011 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 19  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/conf.d/rc
 #                       |start|  
 #                       +-----+  
 #                          |  
 #                          |  
 #              start_preliminary_network  
 #                          |  
 #                          |       n  
 #                  serial_check ------->  get_new_serial  
 #                          |                      |  
 #                         y|                      |  
 #                          |           n          |  
 #                check_is_configured ---->  run_hw_detection  
 #                          |                      |  
 #                         y|                      |  
 #            n             |                      |  
 #        +--------cfg_equal_to_db          import_settings_to_db  
 #        |                 |                      |  
 #   update_from_db        y|                      |  
 #        |                 |                      |  
 #   set_is_configured      |                  set_is_configured  
 #        +-----------------|                      |  
 #                          +----------------------+  
 #                          |  
 #                          |  
 #               stop_preliminary_network  
 #                          |  
 #                          |  
 #                       +----+  
 #                       |done|  
 #                       +----+  
 #                          |  
 #                          |  
 #                 normal_system_bootup  
 #                          |  
 #                          .  
 #                          .  
 #                          .  
 #  
 #  
 #  
   
 source /etc/sysconfig/rc  
23  source $rc_functions  source $rc_functions
24    
25  #mysql settings  # mysql settings
26  source /etc/alx-config/config.rc  source /etc/alxconfig-ng/config.rc
 source /opt/alx-config/functions/mysqlfunctions  
 source /opt/alx-config/functions/alx-mysql-functions  
27    
28  #check if mysql is available  # helper functions
29  [ -x /usr/bin/mysql ] && MYSQL_ALX=true  source /usr/lib/alxconfig-ng/functions/common
30    source /usr/lib/alxconfig-ng/functions/mysqlfunctions
31    source /usr/lib/alxconfig-ng/functions/serial_functions
32    source /usr/lib/alxconfig-ng/functions/config_modules
33    source /usr/lib/alxconfig-ng/functions/config_network
34    source /usr/lib/alxconfig-ng/functions/config_printers
35    source /usr/lib/alxconfig-ng/functions/config_sessions
36    source /usr/lib/alxconfig-ng/functions/config_x11
37    source /usr/lib/alxconfig-ng/functions/config_auth
38    source /usr/lib/alxconfig-ng/functions/config_ssh_auth
39    source /usr/lib/alxconfig-ng/functions/config_versions
40    
41  #other needed vars  # other needed vars
42  ALX_HW_DETECT=false  ALX_HW_DETECT=false
43  ALX_NETWORK_SETUP=false  ALX_FORCED_RECHECK=false
44  ALX_XSERVER_SETUP=false  ALX_RESET_SETTINGS=false
45  ALX_SESSION_SETUP=false  ALX_CONFD_NETWORKING=false
 ALX_PRINTER_SETUP=false  
46    
47  #unset vars which may kill us  # unset vars which may kill us
48  unset ALX_SERIAL ALX_STATE  unset ALX_SERIAL ALX_STATE
49    
50    
51  #setup needed directories  # setup needed directories
52  [ ! -d /etc/alx-config/state ] && install -d /etc/alx-config/state  [ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state
   
   
 # still a need to implement this ?  
 # #needed to detect usb/livecd boot  
 # if [ -e /.bootdev ]  
 # then  
 # source /.bootdev  
 # else  
 # echo "Couldn't find /.bootdev. Aborting."  
 # exit 1  
 # fi  
   
 # still a need to implement this ? --> media-check ?  
 settings_import() {  
  if [ "${FSTYPE}" == "vfat" ]  
  then  
  if [ -e /mnt/cdrom/settings/system ]  
  then  
  echo -e ${COLOREDSTAR}"Importing old alx-settings ..."  
  ( cp -R /mnt/cdrom/settings/system/* /etc/alx-config/settings/menu &&  
   source /etc/alx-config/config.rc &&  
   source /opt/alx-config/Configurator/config_functions.sh &&  
   setup_xfree > /dev/null 2>&1 &&  
   setup_modules > /dev/null 2>&1 &&  
   setup_network > /dev/null 2>&1 &&  
   #setup_printers > /dev/null 2>&1 &&  
   setup_sessions > /dev/null 2>&1 &&  
   touch /etc/alx-config/imported )  
  evaluate_retval  
  fi  
  fi  
 }  
   
   
 # this thingy needs an complete rewrite.  
 # first get all settings from db server,  
 # than check against local system settings,  
 # if there are any differences, update the local settings,  
 # as the server has a higher priority.  
 # Important: write local settings only if they make sense,  
 #            to have a fallback in case the server is down!  
 #get_settings_from_server(){  
 # #some needed arrays  
 # #ARRAY_NETWORK #module domain networking netmask dns gateway  
 # #SESSION #  
 # #GRAFIK  #  
 #  
 # echo "Importing now old Settings ..."  
 #  
 # local serial module domain networking netmask dns gateway i x all  
 #  
 # declare -i i=0  
 #  
 # #get hostname from database  
 # MY_HOSTNAME=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # "select hostname from cfg_serial where id='${ALX_SERIAL}'")  
 #  
 # #get network settings from database  
 # all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # "select module,  
 # domain,  
 # networking,  
 # netmask,  
 # dns,  
 # gateway,  
 # broadcast,  
 # ip  
 # from cfg_network where serial='${ALX_SERIAL}'")  
 # #split'em up and put in array  
 # for x in ${all}  
 # do  
 # ARRAY_NETWORK[${i}]=${x}  
 # ((i++))  
 # done  
 # echo " Network:"  
 # echo "   MODULE:     ${ARRAY_NETWORK[0]}"  
 # echo "   IP:         ${ARRAY_NETWORK[7]}"  
 # echo "   HOSTNAME:   ${MY_HOSTNAME}"  
 # echo "   DOMAIN:     ${ARRAY_NETWORK[1]}"  
 # echo "   NETWORKING: ${ARRAY_NETWORK[2]}"  
 # echo "   NETMASK:    ${ARRAY_NETWORK[3]}"  
 # echo "   DNS:        ${ARRAY_NETWORK[4]}"  
 # echo "   GATEWAY:    ${ARRAY_NETWORK[5]}"  
 # echo "   BROADCAST:  ${ARRAY_NETWORK[6]}"  
 # echo  
 #  
 # #get x settings from database  
 # local module resolution  
 #  
 # #reset i  
 # declare -i i=0  
 # all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # "select module,  
 # resolution  
 # from cfg_grafik where serial='${ALX_SERIAL}'")  
 # #split'em up and put in array  
 # for x in ${all}  
 # do  
 # ARRAY_GRAFIK[${i}]=${x}  
 # ((i++))  
 # done  
 #  
 # echo " VGA:"  
 # echo "   MODULE:     ${ARRAY_GRAFIK[0]}"  
 # echo "   RESOLUTION: ${ARRAY_GRAFIK[1]}"  
 # echo  
 #  
 # #get ica-sessions from database  
 # ARRAY_SESSIONS=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # "select session from cfg_session where serial='${ALX_SERIAL}'")  
 #  
 # echo " SESSIONS:"  
 # declare -i i=0  
 # for x in ${ARRAY_SESSIONS}  
 # do  
 # ((i++))  
 # echo "   SESSION${i}:   ${x}"  
 # done  
 # echo  
 #  
 # #now write these settings  
 # local SETTINGSPATH  
 #  
 # #network  
 #  
 # #settings must be also set on system, so we put this to menu  
 # SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
 #  
 # [ ! -d ${SETTINGSPATH}/modules ] && install -d ${SETTINGSPATH}/modules  
 # echo "${ARRAY_NETWORK[0]}" > ${SETTINGSPATH}/modules/modules  
 #  
 # [ ! -d ${SETTINGSPATH}/network ] && install -d ${SETTINGSPATH}/network  
 # echo "${MY_HOSTNAME}" > ${SETTINGSPATH}/network/hostname  
 # echo "${ARRAY_NETWORK[1]}" > ${SETTINGSPATH}/network/domain  
 # echo "${ARRAY_NETWORK[2]}" > ${SETTINGSPATH}/network/networking  
 # [ -n "${ARRAY_NETWORK[3]}" ] && echo "${ARRAY_NETWORK[3]}" > ${SETTINGSPATH}/network/netmask  
 # [ -n "${ARRAY_NETWORK[4]}" ] && echo "${ARRAY_NETWORK[4]}" > ${SETTINGSPATH}/network/dns  
 # [ -n "${ARRAY_NETWORK[5]}" ] && echo "${ARRAY_NETWORK[5]}" > ${SETTINGSPATH}/network/gateway  
 # [ -n "${ARRAY_NETWORK[6]}" ] && echo "${ARRAY_NETWORK[6]}" > ${SETTINGSPATH}/network/broadcast  
 # [ -n "${ARRAY_NETWORK[7]}" ] && echo "${ARRAY_NETWORK[7]}" > ${SETTINGSPATH}/network/ip  
53    
54    update_system_settings()
55    {
56     rc_mecho Checking system setup ...
57    
58  validate_networking(){   # get the modules settings
59   #source /opt/alx-config/Configurator/config_functions.sh   # ! is the first thing that must be configured !
60     config_modules
  local x i all LOCAL_NETWORK DB_NETWORK SETTINGSPATH  
   
  #all arrays:  
  # ->  hostname modules domain networking ip netmask dns gateway broadcast  
   
   #networking  
  #get settings from local system  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/system  
  declare -i i=0  
  for x in network/hostname \  
  modules/modules \  
  network/domain \  
  network/networking \  
  network/ip \  
  network/netmask \  
  network/dns \  
  network/gateway \  
  network/broadcast  
  do  
  if [ -f ${SETTINGSPATH}/${x} ]  
  then  
  #file exist, then use content  
  LOCAL_NETWORK[${i}]="$(< ${SETTINGSPATH}/${x})"  
  else  
  LOCAL_NETWORK[${i}]=""  
  fi  
  ((i++))  
  done  
   
  #get settings from database  
 # DB_NETWORK[0]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # "select hostname from cfg_network where serial='${ALX_SERIAL}'")  
   
  all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select hostname,  
  module,  
  domain,  
  networking,  
  ip,  
  netmask,  
  dns,  
  gateway,  
  broadcast  
  from cfg_network where serial='${ALX_SERIAL}'")  
   
  #split'em up and put in an array  
  declare -i i=0  
  for x in ${all}  
  do  
  DB_NETWORK[${i}]=${x}  
  ((i++))  
  done  
   
  #needed by the small hotfix  
  local FIX_ME  
  FIX_ME="${DB_NETWORK[2]}"  
   
   
  #now compare this stuff if they are equal  
  for ((i=0; i < 9; i++))  
  do  
  if [ "${DB_NETWORK[${i}]}" = "${LOCAL_NETWORK[${i}]}" ]  
  then  
  echo "${i}: ${DB_NETWORK[${i}]} == ${LOCAL_NETWORK[${i}]}"  
   
  #delete equal stuff from DB_NETWORK  
  DB_NETWORK[${i}]="*NULL*"  
   
  else  
  echo "${i}: ${DB_NETWORK[${i}]} != ${LOCAL_NETWORK[${i}]}"  
  fi  
  done  
   
   
  #update configs  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
  declare -i i=0  
  for x in network/hostname \  
  modules/modules \  
  network/domain \  
  network/networking \  
  network/ip \  
  network/netmask \  
  network/dns \  
  network/gateway \  
  network/broadcast  
  do  
  #update only staff wich wasn't overwritten  
  if [ "${DB_NETWORK[${i}]}" != "*NULL*" ]  
  then  
  #create directory if not exist  
  if [ ! -d $(dirname ${SETTINGSPATH}/${x}) ]  
  then  
  install -d $(dirname ${SETTINGSPATH}/${x})  
  fi  
  echo "${DB_NETWORK[${i}]}" > ${SETTINGSPATH}/${x}  
   
  # theses fucking config functions:  
  # network gets only updated,  
  # if ${SETTINGS_TEMPLATE}/menu/network/networking exist  
  # so we force an update here  
  if [ ! -f ${SETTINGSPATH}/network/networking ]  
  then  
  [ ! -d ${SETTINGSPATH}/network ] && install -d ${SETTINGSPATH}/network  
  echo "${FIX_ME}" > ${SETTINGSPATH}/network/networking  
  fi  
   
  #set update flag  
  ALX_NETWORK_SETUP=true  
  fi  
  ((i++))  
  done  
 }  
61    
62     # imports network settings from db
63     config_networking
64    
65     # imports x11 settings from db
66     config_x11
67    
68  validate_xserver(){   # imports session settings from db
69   #source /opt/alx-config/Configurator/config_functions.sh   config_sessions
   
  local x i all LOCAL_XSERVER DB_XSERVER SETTINGSPATH  
70    
71   #all arrays:   # imports printer settings from db
72   # ->  xmodule resolution depth mouse monvendor monmodel hsync vref   config_printing
73    
74    #xserver   # imports auth settings from db
75   #get settings from local system   config_auth
  #vga  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/system  
  declare -i i=0  
  for x in vga/vga \  
  vga/vgares \  
  vga/vgadepth  
  do  
  if [ -f ${SETTINGSPATH}/${x} ]  
  then  
  #file exist, then use content  
  LOCAL_XSERVER[${i}]="$(< ${SETTINGSPATH}/${x})"  
  else  
  LOCAL_XSERVER[${i}]=""  
  fi  
  ((i++))  
  done  
   
  #mouse  
  if [ -f ${SETTINGSPATH}/mouse/mouse ]  
  then  
  #file exist, then use content  
  LOCAL_XSERVER[3]="$(< ${SETTINGSPATH}/mouse/mouse)"  
  else  
  LOCAL_XSERVER[3]=""  
  fi  
   
  #monitor  
  local myvendor mymodel hsync vref  
  if [ -f ${SETTINGSPATH}/monitor/monitor ]  
  then  
  source ${SETTINGSPATH}/monitor/monitor  
   
  declare -i i=4  
  for x in "${myvendor}" \  
  "${mymodel}" \  
  "${hsync}" \  
  "${vref}"  
  do  
  LOCAL_XSERVER[${i}]="${x}"  
  ((i++))  
  done  
  else  
  LOCAL_XSERVER[4]=""  
  LOCAL_XSERVER[5]=""  
  LOCAL_XSERVER[6]=""  
  LOCAL_XSERVER[7]=""  
  fi  
   
   
  #get settings from database  
  all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select module,  
  resolution,  
  depth  
  from cfg_graphic where serial='${ALX_SERIAL}'")  
   
  #split'em up and put in an array  
  declare -i i=0  
  for x in ${all}  
  do  
  DB_XSERVER[${i}]=${x}  
  ((i++))  
  done  
   
  # read mouse  
  DB_XSERVER[3]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select mouse from cfg_input where serial='${ALX_SERIAL}'")  
   
  #monitors  
 # all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # "select vendor,  
 # model,  
 # hsync,  
 # vrefresh  
 # from cfg_monitor where serial='${ALX_SERIAL}'")  
   
  all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
         "select vendor,  
  model,  
  hsync,  
  vrefresh  
  from list_monitors  
  inner join cfg_graphic  
  on cfg_graphic.monitorid=list_monitors.id;")  
   
  #split'em up and put in an array  
  declare -i i=4  
  for x in ${all}  
  do  
  DB_XSERVER[${i}]=${x}  
  ((i++))  
  done  
   
 # #now compare this stuff if they are equal  
 # for ((i=0; i < 8; i++))  
 # do  
 # if [ "${DB_XSERVER[${i}]}" = "${LOCAL_XSERVER[${i}]}" ]  
 # then  
 # echo "${i}: ${DB_XSERVER[${i}]} == ${LOCAL_XSERVER[${i}]}"  
 #  
 # #delete equal stuff from DB_NETWORK  
 # DB_XSERVER[${i}]="*NULL*"  
 #  
 # else  
 # echo "${i}: ${DB_XSERVER[${i}]} != ${LOCAL_XSERVER[${i}]}"  
 # fi  
 # done  
 #  
 #  
 # #update configs  
 # SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
 # #xserver general  
 # declare -i i=0  
 # for x in vga/vga \  
 # vga/vgares \  
 # vga/vgadepth \  
 # mouse/mouse  
 # do  
 # #update only staff wich wasn't overwritten  
 # if [ "${DB_XSERVER[${i}]}" != "*NULL*" ]  
 # then  
 # #create directory if not exist  
 # if [ ! -d $(dirname ${SETTINGSPATH}/${x}) ]  
 # then  
 # install -d $(dirname ${SETTINGSPATH}/${x})  
 # fi  
 # echo "${DB_XSERVER[${i}]}" > ${SETTINGSPATH}/${x}  
 # #set update flag  
 # ALX_XSERVER_SETUP=true  
 # fi  
 # ((i++))  
 # done  
 #  
 # #xserver monitors  
 # if [ "${DB_XSERVER[4]}" != "*NULL*" \  
 # -o "${DB_XSERVER[5]}" != "*NULL*" \  
 # -o "${DB_XSERVER[6]}" != "*NULL*" \  
 # -o "${DB_XSERVER[7]}" != "*NULL*" ]  
 # then  
 # if [ ! -d ${SETTINGSPATH}/monitor ]  
 # then  
 # install -d ${SETTINGSPATH}/monitor  
 # fi  
 # echo "myvendor=\"${DB_XSERVER[4]}\"" > ${SETTINGSPATH}/monitor/monitor  
 # echo "mymodel=\"${DB_XSERVER[5]}\"" >> ${SETTINGSPATH}/monitor/monitor  
 # echo "hsync=\"${DB_XSERVER[6]}\"" >> ${SETTINGSPATH}/monitor/monitor  
 # echo "vref=\"${DB_XSERVER[7]}\"" >> ${SETTINGSPATH}/monitor/monitor  
 #  
 # #set update flag  
 # ALX_XSERVER_SETUP=true  
 # fi  
   
  # - damn fucking setup_xfree routine need to rewrite this fucking stuff -  
  # setup_xfree will only run  
  # if ${SETTINGS_TEMPLATE}/menu/vga/vga exist  
  # so we must *always* update *all* settings if something has changed  
76    
77   #now compare this stuff if they are equal   # exchange ssh rsa keys
78   for ((i=0; i < 8; i++))   HOME=/root config_ssh_auth
  do  
  if [ "${DB_XSERVER[${i}]}" = "${LOCAL_XSERVER[${i}]}" ]  
  then  
  echo "${i}: ${DB_XSERVER[${i}]} == ${LOCAL_XSERVER[${i}]}"  
   
  #delete equal stuff from DB_NETWORK  
  #DB_XSERVER[${i}]="*NULL*"  
   
  else  
  echo "${i}: ${DB_XSERVER[${i}]} != ${LOCAL_XSERVER[${i}]}"  
  fi  
  done  
79    
80   SETTINGSPATH=${SETTINGS_TEMPLATE}/menu   # import version info
81   if [ "${DB_XSERVER[0]}" != "*NULL*" \   config_version
  -o "${DB_XSERVER[1]}" != "*NULL*" \  
  -o "${DB_XSERVER[2]}" != "*NULL*" \  
  -o "${DB_XSERVER[3]}" != "*NULL*" \  
  -o "${DB_XSERVER[4]}" != "*NULL*" \  
  -o "${DB_XSERVER[5]}" != "*NULL*" \  
  -o "${DB_XSERVER[6]}" != "*NULL*" \  
  -o "${DB_XSERVER[7]}" != "*NULL*" ]  
  then  
  [ ! -d ${SETTINGSPATH}/vga ] && install -d ${SETTINGSPATH}/vga  
  [ ! -d ${SETTINGSPATH}/mouse ] && install -d ${SETTINGSPATH}/mouse  
  [ ! -d ${SETTINGSPATH}/monitor ] && install -d ${SETTINGSPATH}/monitor  
   
  echo "${DB_XSERVER[0]}" > ${SETTINGSPATH}/vga/vga  
  echo "${DB_XSERVER[1]}" > ${SETTINGSPATH}/vga/vgares  
  echo "${DB_XSERVER[2]}" > ${SETTINGSPATH}/vga/vgadepth  
  echo "${DB_XSERVER[3]}" > ${SETTINGSPATH}/mouse/mouse  
   
  echo "myvendor=\"${DB_XSERVER[4]}\"" > ${SETTINGSPATH}/monitor/monitor  
  echo "mymodel=\"${DB_XSERVER[5]}\"" >> ${SETTINGSPATH}/monitor/monitor  
  echo "hsync=\"${DB_XSERVER[6]}\"" >> ${SETTINGSPATH}/monitor/monitor  
  echo "vref=\"${DB_XSERVER[7]}\"" >> ${SETTINGSPATH}/monitor/monitor  
   
  #set update flag  
  ALX_XSERVER_SETUP=true  
  fi  
82  }  }
83    
84    get_system_serial()
85    {
86     local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE
87    
88  validate_sessions(){   if [[ ${ALX_CONFD_NETWORKING} = true ]]
  #source /opt/alx-config/Configurator/config_functions.sh  
   
  local x i all LOCAL_SESSIONS DB_SESSIONS SETTINGSPATH count  
   
  #all arrays:  
  # ->  session1 session2 ... sessionN  
   
   
  #no LOCAL_SESSIONS here, needs bubblesort  
   
  #get settings from database  
  all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select session from cfg_sessions where serial='${ALX_SERIAL}'")  
   
  #split'em up and put in an array (only if $all not zero)  
  declare -i i=0  
  if [ -n "${all}" ]  
89   then   then
90   for x in ${all}   ALX_IFACE="$(< ${SETTINGSPATH}/confd-networking)"
  do  
  DB_SESSIONS[${i}]=${x}  
  ((i++))  
  done  
  count=${i}  
91   else   else
92   count=0   ALX_IFACE="eth0"
  fi  
   
  ## no compare here, can only done with bubblesort or s.th like that  
  # shows only the new sessions  
  declare -i i=0  
  #count=${#DB_SESSIONS[*]} #---> not working gets always 1, why ?  
   
  echo "Number of new sessions: ${count}"  
  for ((i=0; i < count; i++))  
  do  
  echo "${i} - ${DB_SESSIONS[${i}]}"  
  done  
   
  #update local configs  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
  declare -i i=0  
   
  #count=${#DB_SESSIONS[*]}  
   
  if [ ${count} -gt 0 ]  
  then  
  #create directory if not exist  
  [ ! -d ${SETTINGSPATH}/sessions ] && install -d ${SETTINGSPATH}/sessions  
   
  #delete old sessions  
  echo -n > ${SETTINGSPATH}/sessions/sessions  
   
  for ((i=0; i < count; i++))  
  do  
  echo "${DB_SESSIONS[${i}]}" >> ${SETTINGSPATH}/sessions/sessions  
  done  
   
  #set update flag  
  ALX_SESSION_SETUP=true  
93   fi   fi
 }  
   
94    
95  validate_printing(){   # check if serial file exists
96   #source /opt/alx-config/Configurator/config_functions.sh   if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]]
   
  local x i k all LOCAL_PRINTER DB_PRINTER SETTINGSPATH count  
   
  #all arrays: [2 dimensions !]  
  # ->  name1 name2 ... nameN  
  # ->  name1 printingport ip share  
   
  #later on, for now -> name1 port1 ip1 share1 name2 ....  
  # seperator is 4  
   
  #local PRINTERNAME PRINTING IP SHARE  
   
  # update *always* printers from database;  
  # compare with local settings cannot be done yet  
   
  #get settings from database  
  all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select printer_name,  
  port,  
  ip,  
  share  
  from cfg_printers where serial='${ALX_SERIAL}'")  
   
  #split'em up and put in an array  
  declare -i i=0  
  declare -i k=0  
   
  if [ -n "${all}" ]  
97   then   then
98   for x in ${all}   source /etc/alxconfig-ng/serial
  do  
  ((k++))  
  DB_PRINTER[${i}]="${DB_PRINTER[${i}]} ${x}"  
  if [ ${k} -eq 4 ]  
  then  
  ((i++))  
  #reset $k  
  declare -i k=0  
  fi  
  done  
  count=${i}  
  else  
  count=0  
  fi  
   
  #echo settings  
  echo "Number of new printers: ${count}"  
  for ((i=0; i < count; i++))  
  do  
  echo "${i} printer:"  
  for x in ${DB_PRINTER[${i}]}  
  do  
  echo "    ${x}"  
  done  
  done  
   
  #import settings (only if counter > 0)  
  local prnset  
   
  #delete all printers (*always*)  
  if [ -d ${SETTINGS_TEMPLATE}/system/printing ]  
  then  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
  [ -d ${SETTINGSPATH}/delete ] && rm -rf ${SETTINGSPATH}/delete  
  install -d ${SETTINGSPATH}/delete  
  mv -f ${SETTINGS_TEMPLATE}/system/printing/* ${SETTINGSPATH}/delete  
  rm -rf ${SETTINGS_TEMPLATE}/system/printing  
   
  #set update flag (*always*)  
  ALX_PRINTER_SETUP=true  
  fi  
   
  if [ ${count} -gt 0 ]  
  then  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
   
  [ ! -d ${SETTINGSPATH}/printing ] && install -d ${SETTINGSPATH}/printing  
  for ((i=0; i < count; i++))  
  do  
  declare -i k=0  
  for x in ${DB_PRINTER[${i}]}  
  do  
  prnset[${k}]=${x}  
  ((k++))  
  done  
   
  echo "PRINTERNAME=${prnset[0]}" >  ${SETTINGSPATH}/printing/${prnset[0]}  
  echo "PRINTING=${prnset[1]}" >> ${SETTINGSPATH}/printing/${prnset[0]}  
  echo "IP=${prnset[2]}" >> ${SETTINGSPATH}/printing/${prnset[0]}  
  echo "SHARE=${prnset[3]}" >> ${SETTINGSPATH}/printing/${prnset[0]}  
  done  
   
  #set update flag (*always*)  
  ALX_PRINTER_SETUP=true  
  fi  
   
 }  
99    
100  update_system_settings(){   # start preliminary networking (dhcp)
101   source /opt/alx-config/Configurator/config_functions.sh   preliminary_network start
102    
103   echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT}   # check if mysql server is reachable
104     # if not abort this script
105   echo   if ! reach_mysql_server
106   echo "network"   then
107   validate_networking   preliminary_network stop
108   echo   exit 1
109   echo "xserver"   fi
  validate_xserver  
  echo  
  echo "sessions"  
  validate_sessions  
  echo  
  #echo "printers"  
  #validate_printing  
  #echo  
   
  if [ "${ALX_NETWORK_SETUP}" == "true" ]  
  then  
  echo -e ${COLMAGENTA}"Updating network settings"${COLDEFAULT}  
  setup_modules  
  setup_network  
  fi  
   
  if [ "${ALX_XSERVER_SETUP}" == "true" ]  
  then  
  echo -e ${COLMAGENTA}"Updating xserver settings"${COLDEFAULT}  
  setup_xfree  
  fi  
   
  if [ "${ALX_SESSION_SETUP}" == "true" ]  
  then  
  echo -e ${COLMAGENTA}"Updating session settings"${COLDEFAULT}  
  setup_sessions  
  fi  
   
  #if [ "${ALX_PRINTER_SETUP}" == "true" ]  
  #then  
  # echo -e ${COLMAGENTA}"Updating printer settings"${COLDEFAULT}  
  # setup_printers  
  #fi  
   
  #clean up temp files  
  local SETTINGSPATH  
  SETTINGSPATH=${SETTINGS_TEMPLATE}/menu  
  #[ -d ${SETTINGSPATH} ] && rm -rf ${SETTINGSPATH}  
 }  
110    
111  get_system_serial(){   CUR_IP=$(ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp')
112     CUR_MAC=$(ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11)
113     CUR_MTIME=$(date +%s)
114    
115   local CUR_IP CUR_MAC CUR_MTIME   rc_print "Trying to validate my serial ..."
116    
117   #check if serial file exists   # nice serial output
  if [ -f /etc/alx-config/serial ]  
  then  
  source /etc/alx-config/serial  
   
  # if system is already configured, it *has* a hostname.  
  # so we take the hostname of this system here  
  source /etc/hostname  
   
  #start preliminary networking (dhcp)  
  preliminary_network start  
   
  CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')  
  CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)  
  CUR_MTIME=$(date +%s)  
   
  echo -e ${COLOREDSTAR} "Trying to validate my serial ..."  
   
  #nice serial output  
118   $CURS_UP   $CURS_UP
119   $SET_WCOL   $SET_WCOL
120   echo "[ SN: ${ALX_SERIAL} ]"   echo "[ SN: ${ALX_SERIAL} ]"
   
 # #is this system outdated ?  
 # #MY_HOSTNAME=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # # "select hostname from cfg_serial where id='${ALX_SERIAL}'")  
 #  
 # #we do this now with the date instead of the hostname  
 # local MY_ALX_REG_DATE  
 # MY_ALX_REG_DATE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
 # "select mtime from client_serial where serial='${ALX_SERIAL}'")  
 #  
 # #if [ "${MY_HOSTNAME}" == "${HOSTNAME}" ]  
 # if [ "${MY_ALX_REG_DATE}" == "${ALX_REG_DATE}" ]  
 # then  
 # #set ALX_STATE to ok so everybody that everything was ok  
 # ALX_STATE=ok  
 #  
 # evaluate_retval  
 # else  
 # #print false (works only if this is the first statement here)  
 # evaluate_retval  
 #  
 # #set ALX_STATE to error so everybody sees there was an error  
 # ALX_STATE=error  
 # fi  
121    
122   if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}"   if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}"
123   then   then
124   ALX_STATE="ok"   ALX_STATE="ok"
125   else   else
126     # abort on non valid serial
127   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
128     echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
129     show_invalid_serial_msg
130     exit 1
131   fi   fi
132    
133   else   else
134   #run hardware detection   # run hardware detection
135   echo   echo
136   echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT}   if [[ ${ALX_FORCED_RECHECK} = true ]]
137     then
138     rc_mecho "Hardware autodetection forced by system-administrator"
139     # always disable CONFD_NETWORKING here
140     export ALX_CONFD_NETWORKING="false"
141     else
142     rc_mecho "Preparing system for first boot"
143     fi
144   ALX_HW_DETECT=true   ALX_HW_DETECT=true
145   /etc/init.d/hwdetect start   hwsetup
146    
147   #set hostname to alx_default_hostname   # set hostname to alx_default_hostname
148     # use old hostname if this is a forced re-check
149     [[ ${ALX_FORCED_RECHECK} = true ]] && ALX_DEFAULT_HOSTNAME="$(< /etc/hostname)"
150   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
151   HOSTNAME="${ALX_DEFAULT_HOSTNAME}"   HOSTNAME="${ALX_DEFAULT_HOSTNAME}"
152    
153   #update the hostname on the system for sure   # update the hostname on the system for sure
154   echo "HOSTNAME=${HOSTNAME}" > /etc/hostname   echo "${HOSTNAME}" > /etc/hostname
155    
156   #start preliminary networking (dhcp)   # start preliminary networking (dhcp)
157   preliminary_network start   preliminary_network start
158    
159     # check if mysql server is reachable
160     # if not abort this script
161     if ! reach_mysql_server
162     then
163     preliminary_network stop
164     exit 1
165     fi
166    
167    
168   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')
169   CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)   CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)
170   CUR_MTIME=$(date +%s)   CUR_MTIME=$(date +%s)
   
  echo -e ${COLOREDSTAR} "Trying to get new serial ..."  
   
  #request new serial  
  #ALX_REG_DATE="$(date +%F)"  
   
  #we're using the mtime now (better for vaildating the serial)  
  mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "insert into client_serials(  
  mtime,  
  mac  
  )  
  values(  
  '${CUR_MTIME}',  
  '${CUR_MAC}'  
  );"  
   
  #then validate and retrieve serial  
   
  ### warning must be changed that only the LAST ID will be fetched,  ###  
  ### or you get error if the computer name and date are the same     ###  
  ### you have more then one serial number than                       ###  
   
  #not 100% working may get more than *one* id  
  #ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  # "select id from cfg_serial where datum='${ALX_REG_DATE}' and hostname='${HOSTNAME}'")  
   
  #select highest id only (added max)  
  ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
  "select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'")  
171    
172   if [ "${ALX_SERIAL}" != NULL ]   # abort now if this is a forced re-check
173     if [[ ${ALX_FORCED_RECHECK} = true ]]
174   then   then
175   #nice serial output   # but first check the serial
176     source /etc/alxconfig-ng/serial
177    
178     rc_print "Trying to validate my serial ..."
179    
180     # nice serial output
181   $CURS_UP   $CURS_UP
182   $SET_WCOL   $SET_WCOL
183   echo "[ SN: ${ALX_SERIAL} ]"   echo "[ SN: ${ALX_SERIAL} ]"
184    
185   #set ALX_STATE to ok so everybody that everything was ok   if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}"
186     then
187     ALX_STATE="ok"
188     else
189     # abort on non valid serial
190     ALX_STATE="invalid serial"
191     echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state
192     show_invalid_serial_msg
193     exit 1
194     fi
195    
196     # write current state to temp file
197     echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
198     [ -f /hardware-auto-detection ] && rm /hardware-auto-detection
199    
200     # now export ALX_FORCED_RECHECK=true
201     # that the setting will be updated not inserted !
202     export ALX_FORCED_RECHECK=true
203     return 0
204     fi
205    
206     rc_print "Trying to get new serial ..."
207    
208     # request a new serial; one command now (cause must be done in the same session)
209     ALX_SERIAL=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}');
210     select last_insert_id();")
211    
212     if [[ ${ALX_SERIAL} != NULL ]]
213     then
214     # nice serial output
215     $CURS_UP
216     $SET_WCOL
217     echo "[ SN: ${ALX_SERIAL} ]"
218    
219     # set ALX_STATE to ok so everybody knows that everything was ok
220   ALX_STATE=ok   ALX_STATE=ok
221    
222   echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alx-config/serial   echo "ALX_SERIAL=\"${ALX_SERIAL}\"" > /etc/alxconfig-ng/serial
223   echo "ALX_REG_DATE=${CUR_MTIME}" >> /etc/alx-config/serial   echo "ALX_REG_DATE=\"${CUR_MTIME}\"" >> /etc/alxconfig-ng/serial
224    
225   evaluate_retval   evaluate_retval
226   else   else
227   #print false (works only if this is the first statement here)   # print false (works only if this is the first statement here)
228   evaluate_retval   evaluate_retval
229    
230   #set ALX_STATE to error so everybody sees there was an error   # set ALX_STATE to error so everybody sees there was an error
231   ALX_STATE=error   ALX_STATE=error
232    
233   #show an error that no new serial was found   # show an error that no new serial was found
234   #nice serial output   # nice serial output
235   $CURS_UP   $CURS_UP
236   $SET_WCOL   $SET_WCOL
237   echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]"   echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]"
238   fi   fi
239   fi   fi
240    
241   #write current state to temp file   # write current state to temp file
242   echo "ALX_STATE=${ALX_STATE}" > /etc/alx-config/state/state   echo "ALX_STATE=\"${ALX_STATE}\"" > /etc/alxconfig-ng/state/state
243     echo "ALX_IFACE=\"${ALX_IFACE}\"" >> /etc/alxconfig-ng/state/state
244  }  }
245    
246    
247  check_is_configured() {  check_is_configured()
248   if [ -f /etc/alx-config/state/configured ]  {
249     if [ -f /etc/alxconfig-ng/state/configured ]
250   then   then
251   export ALX_CONFIGURED=true   export ALX_CONFIGURED=true
252   else   else
# Line 927  check_is_configured() { Line 256  check_is_configured() {
256    
257    
258  # imports current settings to the database resolved by the hardware detection  # imports current settings to the database resolved by the hardware detection
259  import_settings_to_db() {  import_settings_to_db()
260   #note: networking is always 'dhcp' if hw was autodetected  {
261   #note: default_domain/hostname is set in config.rc   # note: networking is always 'dhcp' if hw was autodetected
262     # note: default_domain/hostname is set in config.rc
263   #to be safe, we do some sanity checks  
264     # to be safe, we do some sanity checks
265   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
266   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
267    
268   #vars used by hwdetect   # vars used by hwsetup
269   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
270   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
271   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
272    
273   #get setting from hwdetect   # get setting from hwsetup
274   source /etc/sysconfig/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
275   source /etc/sysconfig/hwsetup/mouse   source /etc/conf.d/hwsetup/mouse
276    
277   echo   echo
278   echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT}   rc_mecho "Importing detected settings to database"
279    
280   #network   # network
281   echo -e "      Network settings ..."   rc_mecho "      Network settings ..."
282   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   if [[ ${ALX_CONFD_NETWORKING} = true ]]
283   "insert into cfg_network(   then
284   hostname,   # get settings
285   serial,   for iface in $(onboot_interface_list ${network_settings}/net.*)
286   module,   do
287   domain,   [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
288   networking   rc_echo "WARNING: only importing settings for interface [ ${iface} ] !"
289   )   source ${network_settings}/net.${iface} || echo "Error: could not read '${network_settings}/net.${iface}'"
290   values(   NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)"
291   '${ALX_DEFAULT_HOSTNAME}',  
292   '${ALX_SERIAL}',   mysqldo "insert into cfg_network(
293   '${NETCARD_DRIVER}',   hostname,
294   '${ALX_DEFAULT_DOMAIN}',   serial,
295   'dhcp'   module,
296   );"   domain,
297     networking,
298     netmask,
299     dns,
300     gateway,
301     broadcast,
302     ip,
303     forcemacto,
304     wireless_bitrate,
305     wireless_channel,
306     wireless_essid,
307     wireless_frequency,
308     wireless_mode,
309     wireless_nick,
310     wireless_auth_mode,
311     wireless_key_length,
312     wireless_key,
313     wireless_key_ascii
314     )
315     values(
316     '${ALX_DEFAULT_HOSTNAME}',
317     '${ALX_SERIAL}',
318     '${NETCARD_DRIVER}',
319     '${ALX_DEFAULT_DOMAIN}',
320     '${NETWORKING}',
321     '${NETMASK}',
322     '${NAMESERVER}',
323     '${GATEWAY}',
324     '${BROADCAST}',
325     '${IP}',
326     '${FORCE_MAC_TO}',
327     '${WIRELESS_BITRATE}',
328     '${WIRELESS_CHANNEL}',
329     '${WIRELESS_ESSID}',
330     '${WIRELESS_FREQUENCY}',
331     '${WIRELESS_MODE}',
332     '${WIRELESS_NICK}',
333     '${WIRELESS_AUTH_MODE}',
334     '${WIRELESS_KEY_LENGTH}',
335     '${WIRELESS_KEY}',
336     '${WIRELESS_KEY_ASCII}'
337     );"
338    
339     # only insert the *FIRST* iface
340     break
341     done
342     else
343     mysqldo "insert into cfg_network(
344     hostname,
345     serial,
346     module,
347     domain,
348     networking
349     )
350     values(
351     '${ALX_DEFAULT_HOSTNAME}',
352     '${ALX_SERIAL}',
353     '${NETCARD_DRIVER}',
354     '${ALX_DEFAULT_DOMAIN}',
355     'dhcp'
356     );"
357     fi
358   evaluate_retval   evaluate_retval
359    
360   #xserver   # xserver
361   echo -e "      Graphic settings ..."   rc_mecho "      Graphic settings ..."
362   #xserver general   # xserver general
363   ( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   ( mysqldo "insert into cfg_graphic(
  "insert into cfg_graphic(  
364   serial,   serial,
365   module,   module,
366   resolution,   resolution,
367   depth   depth,
368     refresh_rate
369   )   )
370   values(   values(
371   '${ALX_SERIAL}',   '${ALX_SERIAL}',
372   '${XMODULE}',   '${XMODULE}',
373   '1024x768',   '1024x768',
374   '16'   '16',
375   );";   '60'
376   #xserver monitor   );"; )
377    mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   evaluate_retval
378   "insert into cfg_monitor(  
379     # input
380     rc_mecho "      Input settings ..."
381     mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');"
382     evaluate_retval
383    
384     # auth
385     rc_mecho "      Authentification settings ..."
386     mysqldo "insert into client_auth(
387   serial,   serial,
388   vendor,   username,
389   model,   shell,
390   hsync,   vnc,
391   vrefresh   samba,
392     station
393   )   )
394   values(   values(
395   '${ALX_SERIAL}',   '${ALX_SERIAL}',
396   'Aamazing',   '${ALX_UNPRIV_USER}',
397   'CM-1528-FS',   '',
398   '28-64',   '',
399   '47-104'   '',
400   );";   ''
401     );"
402   # input   evaluate_retval
403    mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  
404   "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');";)   # exchange ssh rsa keys - the first boot needs this !
405     # or no reboot will work via the webadmin
406     rc_mecho "      SSH authentification settings ..."
407     HOME=/root config_ssh_auth
408     evaluate_retval
409    
410     # autostart
411     rc_mecho "      Autostart settings ..."
412     mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"
413    
414     # screensaver
415     rc_mecho "      Screensaver settings ..."
416     mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"
417    
418     # version info
419     rc_mecho "      OS version info ..."
420     local alx_os
421     local alx_utils
422     alx_os="$(< /etc/mageversion)"
423     alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')"
424     alx_utils="${alx_utils/alxconfig-ng-alx-}"
425     mysqldo "insert into client_version(serial,os,utils) values('${ALX_SERIAL}','${alx_os}','${alx_utils}')"
426    
427   evaluate_retval   evaluate_retval
428  }  }
429    
430  # imports current settings to the local system resolved by the hardware detection  # imports current settings to the database resolved by the hardware detection
431  import_settings_local(){  update_settings_in_db()
432   #note: networking is always 'dhcp' if hw was autodetected  {
433   #note: default_domain/hostname is set in config.rc   # note: networking is always 'dhcp' if hw was autodetected
434     # note: default_domain/hostname is set in config.rc or exported
435   #to be safe, we do some sanity checks   # note: we updating only hardware settings here !
436    
437     # to be safe, we do some sanity checks
438   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain   [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
439   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx   [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
440    
441   #vars used by hwdetect   # vars used by hwsetup
442   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
443   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
444   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE   local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
445    
446     # get setting from hwsetup
447   #get setting from hwdetect   source /etc/conf.d/hwsetup/knoppix
448   source /etc/sysconfig/hwsetup/knoppix   source /etc/conf.d/hwsetup/mouse
449   source /etc/sysconfig/hwsetup/mouse  
   
450   echo   echo
451   echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT}   rc_mecho "Updating detected settings in database"
452    
453     # network
454   #allready configured, no update needed so we put it to system   rc_mecho "      Network settings ..."
455   SETTINGSPATH=${SETTINGS_TEMPLATE}/system   if [[ ${ALX_CONFD_NETWORKING} = true ]]
456     then
457     # get settings
458   #network   #source ${rc_base}/init.d/network &> /dev/null
459   echo -e "      Network settings ..."   for iface in $(onboot_interface_list ${network_settings}/net.*)
460     do
461     [[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue
462     rc_echo "WARNING: only importing settings for interface [ ${iface} ] !"
463     source ${network_settings}/net.${iface} || exit 1
464     NETCARD_DRIVER="$(cat /etc/modprobe.d/net.${iface}.conf | cut -d' ' -f3)"
465    
466     mysqldo "update cfg_network set
467     hostname='${ALX_DEFAULT_HOSTNAME}',
468     module='${NETCARD_DRIVER}',
469     domain='${ALX_DEFAULT_DOMAIN}',
470     networking='${NETWORKING}',
471     netmask='${NETMASK}',
472     dns='${NAMESERVER}',
473     gateway='${GATEWAY}',
474     broadcast='${BROADCAST}',
475     ip='${IP}',
476     forcemacto='${FORCE_MAC_TO}',
477     wireless_bitrate='${WIRELESS_BITRATE}',
478     wireless_channel='${WIRELESS_CHANNEL}',
479     wireless_essid='${WIRELESS_ESSID}',
480     wireless_frequency='${WIRELESS_FREQUENCY}',
481     wireless_mode='${WIRELESS_MODE}',
482     wireless_nick='${WIRELESS_NICK}',
483     wireless_auth_mode='${WIRELESS_AUTH_MODE}',
484     wireless_key_length='${WIRELESS_KEY_LENGTH}',
485     wireless_key='${WIRELESS_KEY}',
486     wireless_key_ascii='${WIRELESS_KEY_ASCII}'
487     where serial=${ALX_SERIAL};"
488    
489   [ ! -d ${SETTINGSPATH}/modules ] && install -d ${SETTINGSPATH}/modules   # only insert the *FIRST* iface
490   echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules/modules   break
491     done
492   [ ! -d ${SETTINGSPATH}/network ] && install -d ${SETTINGSPATH}/network   else
493   ( echo "${ALX_DEFAULT_HOSTNAME}" > ${SETTINGSPATH}/network/hostname;   mysqldo "update cfg_network set
494    echo "${ALX_DEFAULT_DOMAIN}" > ${SETTINGSPATH}/network/domain;   hostname='${ALX_DEFAULT_HOSTNAME}',
495    echo "dhcp" > ${SETTINGSPATH}/network/networking )   module='${NETCARD_DRIVER}',
496     domain='${ALX_DEFAULT_DOMAIN}',
497     networking='dhcp'
498     where serial=${ALX_SERIAL};"
499     fi
500   evaluate_retval   evaluate_retval
501    
502     # xserver
503   #xserver   rc_mecho "      Graphic settings ..."
504   echo -e "      Graphic settings ..."   # xserver general
505     mysqldo "update cfg_graphic set
506   [ ! -d ${SETTINGSPATH}/vga ] && install -d ${SETTINGSPATH}/vga   module='${XMODULE}',
507   [ ! -d ${SETTINGSPATH}/mouse ] && install -d ${SETTINGSPATH}/mouse   resolution='1024x768',
508   [ ! -d ${SETTINGSPATH}/monitor ] && install -d ${SETTINGSPATH}/monitor   depth='16',
509   ( echo "${XMODULE}" > ${SETTINGSPATH}/vga/vga;   refresh_rate='60'
510    echo "16" > ${SETTINGSPATH}/vga/vgadepth;   where serial=${ALX_SERIAL};"
   echo "1024x768" > ${SETTINGSPATH}/vga/vgares;  
   echo "${XMOUSETYPE}" > ${SETTINGSPATH}/mouse/mouse;  
   echo "myvendor=\"Aamazing\"" > ${SETTINGSPATH}/monitor/monitor;  
   echo "mymodel=\"CM-1528-FS\"" >> ${SETTINGSPATH}/monitor/monitor;  
   echo "hsync=\"28-64\"" >> ${SETTINGSPATH}/monitor/monitor;  
   echo "vref=\"47-104\"" >> ${SETTINGSPATH}/monitor/monitor;)  
511   evaluate_retval   evaluate_retval
512    
513   #set system state to 'already configured'   # input
514   touch /etc/alx-config/state/configured   rc_mecho "      Input settings ..."
515     mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"
516     evaluate_retval
517    
518     # version info
519     rc_mecho "      OS version info ..."
520     local alx_os
521     local alx_utils
522     alx_os="$(< /etc/mageversion)"
523     alx_utils="$(magequery -n alxconfig-ng-alx | sed 's:.*\[\ \(.*\)\ \].*:\1:')"
524     alx_utils="${alx_utils/alxconfig-ng-alx-}"
525     mysqldo "update client_version set os='${alx_os}', utils='${alx_utils}' where serial=${ALX_SERIAL};"
526  }  }
527    
528  #start|stop  # imports current settings to the local system resolved by the hardware detection
529  preliminary_network(){  # we only need the network settings
530    import_settings_local()
531    {
532     # note: networking is always 'dhcp' if hw was autodetected
533     # note: default_domain/hostname is set in config.rc
534    
535     # to be safe, we do some sanity checks
536     [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
537     [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
538    
539     # vars used by hwsetup
540     local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
541     local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
542     local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
543    
544     # get setting from hwsetup
545     source /etc/conf.d/hwsetup/knoppix
546    
547     echo
548     rc_mecho "Importing detected settings to local system"
549    
550     if [[ ${ALX_CONFD_NETWORKING} = false ]]
551     then
552     # set an device alias for modprobe.conf
553     [ ! -d /etc/modprobe.d ] && install -d /etc/modprobe.d
554     echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modprobe.d/net.eth0.conf
555    
556     # regenerate modprobe.conf
557     [ -x $(which modules-update) ] && modules-update || rc_echo "modules-update not found!"
558     evaluate_retval
559     fi
560    
561     # set system state to 'already configured'
562     touch /etc/alxconfig-ng/state/configured
563    
564     # install slim desktopmanager configuration
565     config_display_manager
566    
567     # if only an recheck was forced than abort now
568     [[ ${ALX_FORCED_RECHECK} = true ]] && return 0
569    
570     # create a fresh fluxbox directory
571     [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox
572     install -d ${ALX_UNPRIV_HOME}/.fluxbox
573    
574     # now generate fluxbox config files
575    
576     # fluxbox main config
577     local fbinit
578     if [ -f ${ALX_SKELETONS}/fluxbox/init ]
579     then
580     fbinit="${ALX_SKELETONS}/fluxbox/init"
581     else
582     fbinit="/usr/share/fluxbox/init"
583     fi
584     cat ${fbinit} > ${ALX_UNPRIV_HOME}/.fluxbox/init
585    
586     # fluxbox autostart
587     CONFIG="${ALX_UNPRIV_HOME}/.fluxbox/apps"
588     # do not show decorations on messages generated with xmessage
589     if [ -x /usr/bin/xmessage ]
590     then
591     addconfig '[app] (xmessage)'
592     addconfig ' [Deco] {NONE}'
593     addconfig '[end]'
594     fi
595     # add icon utility
596     [ -x /usr/bin/idesk ] && addconfig '[startup] {nohup idesk > /dev/null &}'
597     # add numlock utility
598     [ -x /usr/bin/numlockx ] && addconfig '[startup] {nohup numlockx on &}'
599    
600     # fluxbox hotkeys
601     local fbkeys
602     if [ -f ${ALX_SKELETONS}/fluxbox/keys ]
603     then
604     fbkeys="${ALX_SKELETONS}/fluxbox/keys"
605     else
606     fbkeys="/usr/share/fluxbox/keys"
607     fi
608     cat ${fbkeys} > ${ALX_UNPRIV_HOME}/.fluxbox/keys
609    
610     # fluxbox menu header
611     cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu
612    
613     # now fix it with proper messages :P
614     local ver="$(< /etc/mageversion)"
615     sed -i "s:@CHANGEME@:alx-${ver}  #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu
616    
617     # add a newline (maybe there is no crlf in the header)
618     echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
619    
620     # fluxbox menu footer
621     cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
622    
623     # add a newline (maybe there is no crlf in the footer)
624     echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
625    
626     # setup some standart icons (sysinfo.lnk)
627     # clean desktop icon location
628     [ -d ${ALX_UNPRIV_HOME}/.idesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.idesktop
629     install -d ${ALX_UNPRIV_HOME}/.idesktop
630    
631     # add shutdown, reboot icons
632     local name
633     # default settings
634     declare -i x=30
635     declare -i y=30
636     for i in shutdown reboot
637     do
638     case ${i} in
639     shutdown) name="Herunterfahren"
640     reboot) name="Neustarten"
641     esac
642    
643     generate_icon \
644     --name "${name}" \
645     --command "/usr/lib/alxconfig-ng/bin/user_${i}.sh" \
646     --icon "${ALX_SESSIONS_ICONS}/${i}.png" \
647     --dest "${dest}/${i}.lnk" \
648     --xres "${x}" \
649     --yres "${y}"
650    
651     y=$((${y} + 80))
652     done
653    
654     # last but not least gen a icon with some sys informations
655     local sysinfo
656     local osversion
657     local xres
658     local yres
659    
660     osversion="$(< /etc/mageversion)"
661     sysinfo="Hostname: ${ALX_DEFAULT_HOSTNAME} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)"
662    
663     # at first boot we got always a resolution of 1024x768-16@60
664     # middle of the screen
665     # (no txt - length required, xtdesk manage that itself)
666     xres="$((1024 / 2))"
667     # default y pos (full yres -22 !)
668     yres="$((768 - 22 ))"
669    
670     generate_icon \
671     --name "${sysinfo}" \
672     --command "exit 0" \
673     --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \
674     --dest "${ALX_UNPRIV_HOME}/.idesktop/sysinfo.lnk" \
675     --xres "${xres}" \
676     --yres "${yres}" \
677     --icon-width "1" \
678     --icon-height "1"
679    
680     # set correct permissions
681     chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
682     chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
683     chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
684     chmod 0755 ${ALX_UNPRIV_HOME}/.idesktop
685     if [ -f ${ALX_UNPRIV_HOME}/.ideskrc ]
686     then
687     chmod 0644 ${ALX_UNPRIV_HOME}/.ideskrc
688     fi
689    }
690    
691    # start|stop
692    preliminary_network()
693    {
694   local module   local module
695    
696   if [ -f /etc/alx-config/state/configured ]   if [ -f /etc/alxconfig-ng/state/configured ]
697   then   then
698   #get module name   # compat for old clients
699   module=$(cat ${SETTINGS_TEMPLATE}/system/modules/modules)   if [ -f ${SETTINGSPATH}/modules ]
700   modprobe ${module}   then
701     # get module name
702     module=$(cat ${SETTINGSPATH}/modules)
703     modprobe ${module}
704     fi
705    
706   else   else
707   #vars used by hwdetect   # vars used by hwsetup
708   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME   local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
709   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER   local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
710    
711   #get setting from hwdetect   # get setting from hwsetup
712   source /etc/sysconfig/hwsetup/knoppix   source /etc/conf.d/hwsetup/knoppix
713   modprobe ${NETCARD_DRIVER}   modprobe ${NETCARD_DRIVER}
714   fi   fi
715    
716   case $1 in   case $1 in
717   start)   start)
718   # keeping like always safe:   # keeping like always safe:
719   # no network should be startet here,   # no network should be startet here,
720   # so we can delete all pid files if one exists   # so we can delete all pid files if one exists
721   if ps -A|grep dhcpcd > /dev/null   if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]]
722   then   then
723   echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT}   rc_mecho "Forcing network down"
724   dhcpcd -k   killall $(basename ${ALX_DHCP_PROG}) &> /dev/null
725   sleep 1   sleep 1
726     fi
727     [[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop
728    
729     rc_mecho "Starting preliminary networking ... "
730    
731     # start network configured from /etc/conf.d
732     if [[ ${ALX_CONFD_NETWORKING} = true ]]
733     then
734     ${rc_base}/init.d/network start
735   else   else
736   rm -f /var/run/dhcpcd-eth?.pid   rc_print "Starting default dhcp based networking ... "
737     ${ALX_DHCP_PROG} ${ALX_DHCP_START} &> /dev/null
738     evaluate_retval
739   fi   fi
   
  echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT}  
  #dhcpcd &> /dev/null #&& echo "ok" || echo "false"  
   
  # aka_fix ########################################  
  ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up  
  route del default gw 128.20.50.13 &> /dev/null  
  route add default gw 128.20.50.21 &> /dev/null  
  echo "nameserver 128.20.50.21" > /etc/resolv.conf  
  ##################################################  
  evaluate_retval  
740   ;;   ;;
741    
742   stop)   stop)
743   echo -e ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT}   rc_mecho "Stopping preliminary networking ... "
744   ifconfig eth0 down   if [[ ${ALX_CONFD_NETWORKING} = true ]]
745   if ps -A|grep dhcpcd > /dev/null   then
746     ${rc_base}/init.d/network stop
747     else
748     rc_print "Stopping default dhcp based networking ... "
749     ifconfig ${ALX_IFACE} down
750     fi
751     if [[ ! -z $(pidof $(basename ${ALX_DHCP_PROG})) ]]
752   then   then
753   #echo -en ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT}   killall $(basename ${ALX_DHCP_PROG}) &> /dev/null
754   dhcpcd -z  &> /dev/null   sleep 1
755   fi   fi
756   evaluate_retval   evaluate_retval
757   ;;   ;;
758    
759   *)   *)
760   echo "Usage: preliminary_network {start|stop}"   echo "Usage: preliminary_network {start|stop}"
761   ;;   ;;
762   esac   esac
763  }  }
764    
765    reset_system_settings()
766    {
767     # force load of de kbdkeys
768     loadkeys -q de
769     rc_echo
770     rc_echo -en ${COLRED}
771     rc_echo -n "*** Warning: you are about to reset *all* local settings on this system!"
772     rc_echo -e ${COLDEFAULT}
773     rc_echo "*** Do you really want to continue ?"
774     rc_echo -n "*** Enter 'yes' to continue, anything else to abort: "
775     read kbinsert
776     if [[ ${kbinsert} = yes ]]
777     then
778     rc_echo -en ${COLRED}
779     rc_echo -n "*** OK, you really want it ... killing all settings: "
780     for i in 3 2 1 now
781     do
782     rc_echo -n " ${i}"
783     sleep 1
784     done
785     rc_echo -e ${COLDEFAULT}
786    
787     ## reset all settings:
788     rm -rf ${SETTINGSPATH}/*
789     rm -f /etc/alxconfig-ng/serial
790     rm -rf /etc/alxconfig-ng/state
791    
792     # clear all printers & net-shares
793     :> /etc/printcap
794    
795     # remove lprng
796     rc-config del lprng &> /dev/null
797    
798     # remove all user settings
799     [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}
800    
801     # remove all ica-sessions
802     find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm
803    
804     # remove all old nics and modules configs
805     find /etc/conf.d -type f -name 'net.*' | xargs rm
806     find /etc/modprobe.d -type f -name 'net.*' | xargs rm
807    
808     # restore default networking
809     cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0
810    
811     rc_echo "I am done now, press [Enter] to reboot system ..."
812     else
813     rc_echo "Aborted, press [Enter] to reboot system ..."
814     fi
815     read
816     reboot
817    }
818    
819    onboot_interface_list()
820    {
821     local file
822     local devices
823     local iface
824    
825     # get list of all devices
826     for file in $@
827     do
828     if [[ $(read_value ONBOOT ${file}) = yes ]]
829     then
830     iface="$(basename ${file} | sed s/net.//)"
831     # exclude backup files
832     case "${iface}" in
833     *~) ;;
834     *) devices="${devices} $(basename ${file} | sed s/net.//)" ;;
835     esac
836     fi
837     done
838    
839     echo "${devices}"
840    }
841    
842    # read values from net.* files
843    read_value()
844    {
845     local var="$1"
846     local file="$2"
847     local value
848    
849     # local all possible vars
850     # global
851     local ONBOOT
852     local NETWORKING
853    
854     # static
855     local IP
856     local NETMASK
857     local BROADCAST
858     local NETWORKING
859     local FORCE_MAC_TO
860    
861     # dhcp
862     local DHCP_PROG
863     local DHCP_START
864     local DHCP_STOP
865    
866     # default gw
867     local GATEWAY
868     local GATEWAY_IF
869    
870     # wireless extensions
871     local WIRELESS_AP
872     local WIRELESS_AUTH_MODE
873     local WIRELESS_BITRATE
874     local WIRELESS_CHANNEL
875     local WIRELESS_DEFAULT_KEY
876     local WIRELESS_ESSID
877     local WIRELESS_FREQUENCY
878     local WIRELESS_KEY
879     local WIRELESS_KEY_ASCII
880     local WIRELESS_KEY_0
881     local WIRELESS_KEY_1
882     local WIRELESS_KEY_2
883     local WIRELESS_KEY_3
884     local WIRELESS_KEY_LENGTH
885     local WIRELESS_MODE
886     local WIRELESS_NICK
887     local WIRELESS_NWID
888     local WIRELESS_POWER
889    
890     source ${file}
891     eval value=\$$(echo ${var})
892     echo "${value}"
893    }
894    
895  case $1 in  case $1 in
896   start)   start)
897   #retrieve or validate current serial   # check for global overrides
898     [ -f ${SETTINGSPATH}/confd-networking ] && ALX_CONFD_NETWORKING=true
899     [ -f /hardware-auto-detection ] && ALX_FORCED_RECHECK=true
900     read_cmdline hardware-auto-detection && ALX_FORCED_RECHECK=true
901     read_cmdline alx-reset-settings && ALX_RESET_SETTINGS=true
902    
903     # kill all settings if requested
904     if [[ ${ALX_RESET_SETTINGS} = true ]]
905     then
906     reset_system_settings
907     fi
908    
909     # retrieve or validate current serial
910   get_system_serial   get_system_serial
911   if [ "${ALX_HW_DETECT}" == "true" ]   if [[ ${ALX_HW_DETECT} = true ]]
912   then   then
913   import_settings_to_db   if [[ ${ALX_FORCED_RECHECK} = true ]]
914     then
915     update_settings_in_db
916     else
917     import_settings_to_db
918     fi
919   import_settings_local   import_settings_local
920    
921     # here we should also exchange the ssh keys
922     # or the system cannot be rebooted after
923     # the first start via the alx-webadmin
924     config_ssh_auth
925   fi   fi
   
  #now setup system configuration  
  #alx_setup_or_whatever_it_will_be_called()  
  [ "${ALX_HW_DETECT}" == "false" ] && update_system_settings  
926    
927   #stop at last the preliminary networking (dhcp)   # now setup system configuration
928     # alx_setup_or_whatever_it_will_be_called()
929     [[ ${ALX_HW_DETECT} = false ]] && update_system_settings
930    
931     # stop at last the preliminary networking (dhcp)
932   preliminary_network stop   preliminary_network stop
933   ;;   ;;
934    
935   stop)   stop)
936   #unset_alx_connected #--> now in alxsetstate-rc6   # unset_alx_connected #--> now in alxsetstate-rc6
937   # ! important !: del systemstate   # ! important !: del systemstate
938   [ -f /etc/alx-config/state/state ] && rm /etc/alx-config/state/state   [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state
939   sleep 0.1   sleep 0.1
940   ;;   ;;
941    
942   *)   *)
943   echo "Usage: $0 {start|stop} ..."   echo "Usage: $0 {start|stop} ..."
944   ;;   ;;

Legend:
Removed from v.221  
changed lines
  Added in v.2471