Magellan Linux

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

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

revision 337 by niro, Thu Sep 22 22:14:38 2005 UTC revision 359 by niro, Mon Oct 10 21:19:08 2005 UTC
# Line 11  Line 11 
11  #%before:  #%before:
12  #%after:  #%after:
13    
14  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.22 2005-09-22 22:14:38 niro Exp $  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.26 2005-10-10 21:19:08 niro Exp $
15    
16  # 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
17  # if not it runs the autoconfiguration script  # if not it runs the autoconfiguration script
# Line 97  update_system_settings() Line 97  update_system_settings()
97    
98  get_system_serial()  get_system_serial()
99  {  {
100     local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE
101    
102   local CUR_IP CUR_MAC CUR_MTIME   if [[ ${ALX_CONFD_NETWORKING} = true ]]
103     then
104     ALX_IFACE="$(< ${SETTINGSPATH}/confd-networking)"
105     else
106     ALX_IFACE="eth0"
107     fi
108    
109   # check if serial file exists   # check if serial file exists
110   if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]]   if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]]
# Line 116  get_system_serial() Line 122  get_system_serial()
122   exit 1   exit 1
123   fi   fi
124    
125   CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp')   CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp')
126   CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11)   CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11)
127   CUR_MTIME=$(date +%s)   CUR_MTIME=$(date +%s)
128    
129   echo -e ${COLOREDSTAR} "Trying to validate my serial ..."   echo -e ${COLOREDSTAR} "Trying to validate my serial ..."
# Line 211  get_system_serial() Line 217  get_system_serial()
217   echo -e ${COLOREDSTAR} "Trying to get new serial ..."   echo -e ${COLOREDSTAR} "Trying to get new serial ..."
218    
219   # request a new serial; one command now (cause must be done in the same session)   # request a new serial; one command now (cause must be done in the same session)
220   ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   ALX_SERIAL=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}');
  "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}');  
221   select last_insert_id();")   select last_insert_id();")
222    
223   if [[ ${ALX_SERIAL} != NULL ]]   if [[ ${ALX_SERIAL} != NULL ]]
# Line 222  get_system_serial() Line 227  get_system_serial()
227   $SET_WCOL   $SET_WCOL
228   echo "[ SN: ${ALX_SERIAL} ]"   echo "[ SN: ${ALX_SERIAL} ]"
229    
230   # set ALX_STATE to ok so everybody that everything was ok   # set ALX_STATE to ok so everybody knows that everything was ok
231   ALX_STATE=ok   ALX_STATE=ok
232    
233   echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial   echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial
# Line 246  get_system_serial() Line 251  get_system_serial()
251    
252   # write current state to temp file   # write current state to temp file
253   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state   echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state
254     echo "ALX_IFACE=${ALX_IFACE}" >> /etc/alxconfig-ng/state/state
255  }  }
256    
257    
# Line 295  import_settings_to_db() Line 301  import_settings_to_db()
301   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || exit 1
302   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"
303    
304   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "insert into cfg_network(
  "insert into cfg_network(  
305   hostname,   hostname,
306   serial,   serial,
307   module,   module,
# Line 347  import_settings_to_db() Line 352  import_settings_to_db()
352   break   break
353   done   done
354   else   else
355   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "insert into cfg_network(
  "insert into cfg_network(  
356   hostname,   hostname,
357   serial,   serial,
358   module,   module,
# Line 368  import_settings_to_db() Line 372  import_settings_to_db()
372   # xserver   # xserver
373   echo -e "      Graphic settings ..."   echo -e "      Graphic settings ..."
374   # xserver general   # xserver general
375   ( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   ( mysqldo "insert into cfg_graphic(
  "insert into cfg_graphic(  
376   serial,   serial,
377   module,   module,
378   resolution,   resolution,
# Line 387  import_settings_to_db() Line 390  import_settings_to_db()
390    
391   # input   # input
392   echo -e "      Input settings ..."   echo -e "      Input settings ..."
393   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');"
  "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');"  
394   evaluate_retval   evaluate_retval
395    
396   # auth   # auth
397   echo -e "      Authentifcation settings ..."   echo -e "      Authentification settings ..."
398   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "insert into client_auth(
  "insert into client_auth(  
399   serial,   serial,
400   username,   username,
401   shell,   shell,
# Line 414  import_settings_to_db() Line 415  import_settings_to_db()
415    
416   # exchange ssh rsa keys - the first boot needs this !   # exchange ssh rsa keys - the first boot needs this !
417   # or no reboot will work via the webadmin   # or no reboot will work via the webadmin
418   echo -e "      SSH authentifcation settings ..."   echo -e "      SSH authentification settings ..."
419   HOME=/root config_ssh_auth   HOME=/root config_ssh_auth
420   evaluate_retval   evaluate_retval
421    
422   # input   # autostart
423   echo -e "      Autostart settings ..."   echo -e "      Autostart settings ..."
424   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"
425   "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"  
426     # screensaver
427     echo -e "      Screensaver settings ..."
428     mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')"
429    
430   evaluate_retval   evaluate_retval
431  }  }
432    
# Line 461  update_settings_in_db() Line 466  update_settings_in_db()
466   source ${network_settings}/net.${iface} || exit 1   source ${network_settings}/net.${iface} || exit 1
467   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"   NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)"
468    
469   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "update cfg_network set
  "update cfg_network set  
470   hostname='${ALX_DEFAULT_HOSTNAME}',   hostname='${ALX_DEFAULT_HOSTNAME}',
471   module='${NETCARD_DRIVER}',   module='${NETCARD_DRIVER}',
472   domain='${ALX_DEFAULT_DOMAIN}',   domain='${ALX_DEFAULT_DOMAIN}',
# Line 489  update_settings_in_db() Line 493  update_settings_in_db()
493   break   break
494   done   done
495   else   else
496   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "update cfg_network set
  "update cfg_network set  
497   hostname='${ALX_DEFAULT_HOSTNAME}',   hostname='${ALX_DEFAULT_HOSTNAME}',
498   module='${NETCARD_DRIVER}',   module='${NETCARD_DRIVER}',
499   domain='${ALX_DEFAULT_DOMAIN}',   domain='${ALX_DEFAULT_DOMAIN}',
# Line 502  update_settings_in_db() Line 505  update_settings_in_db()
505   # xserver   # xserver
506   echo -e "      Graphic settings ..."   echo -e "      Graphic settings ..."
507   # xserver general   # xserver general
508   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "update cfg_graphic set
  "update cfg_graphic set  
509   module='${XMODULE}',   module='${XMODULE}',
510   resolution='1024x768',   resolution='1024x768',
511   depth='16',   depth='16',
# Line 513  update_settings_in_db() Line 515  update_settings_in_db()
515    
516   # input   # input
517   echo -e "      Input settings ..."   echo -e "      Input settings ..."
518   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};"
  "update cfg_input set  
  mouse='${XMOUSETYPE}'  
  where serial=${ALX_SERIAL};"  
519   evaluate_retval   evaluate_retval
520  }  }
521    
# Line 634  import_settings_local() Line 633  import_settings_local()
633   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
634   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
635   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
636   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop   chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop
637   chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc   chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc
   
  # default passwords are bad  
  #usermod -p $(perl -e "printf(crypt('foobar','AD'))") root  
  #usermod -p $(perl -e "printf(crypt('foobar','AD'))") ${ALX_UNPRIV_USER}  
  #smbpasswd -a root foobar  
638  }  }
639    
640  # start|stop  # start|stop
# Line 680  preliminary_network() Line 674  preliminary_network()
674   else   else
675   rm -f /var/run/dhcpcd-eth?.pid   rm -f /var/run/dhcpcd-eth?.pid
676   fi   fi
677   [[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop   [[ ${ALX_CONFD_NETWORKING} = true ]] && [[ ${RUNLEVEL} != S ]] && \
678     ${rc_base}/init.d/network stop
679    
680   echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT}   echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT}
681    
# Line 746  reset_system_settings() Line 740  reset_system_settings()
740   rm -f /etc/alxconfig-ng/serial   rm -f /etc/alxconfig-ng/serial
741   rm -rf /etc/alxconfig-ng/state   rm -rf /etc/alxconfig-ng/state
742    
743     # clear all printers & net-shares
744     :> /etc/cups/printers.conf
745     :> /etc/samba/smb.conf
746    
747     # remove inetd, cups & smb from init
748     rc-config del inetd &> /dev/null
749     rc-config del cups &> /dev/null
750     rc-config del samba &> /dev/null
751    
752     # remove all user settings
753     [ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME}
754    
755     # remove all ica-sessions
756     find ${ALX_ICA_SESSIONS} -type f -name '*.ica' | xargs rm
757    
758     # remove all old nics and modules configs
759     find /etc/conf.d -type f -name 'net.*' | xargs rm
760     find /etc/modules.d -type f -name 'net.*' | xargs rm
761    
762     # restore default networking
763     cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0
764    
765   echo "I am done now, press [Enter] to reboot system ..."   echo "I am done now, press [Enter] to reboot system ..."
766   read   else
767   reboot   echo "Aborted, press [Enter] to reboot system ..."
768   fi   fi
769     read
770     reboot
771  }  }
772    
773  onboot_interface_list()  onboot_interface_list()
# Line 775  onboot_interface_list() Line 793  onboot_interface_list()
793   echo "${devices}"   echo "${devices}"
794  }  }
795    
796  # read values from files  # read values from net.* files
797  read_value()  read_value()
798  {  {
799   local var="$1"   local var="$1"
# Line 862  case $1 in Line 880  case $1 in
880    
881   # now setup system configuration   # now setup system configuration
882   # alx_setup_or_whatever_it_will_be_called()   # alx_setup_or_whatever_it_will_be_called()
883   [ "${ALX_HW_DETECT}" == "false" ] && update_system_settings   [[ ${ALX_HW_DETECT} = false ]] && update_system_settings
884    
885   # stop at last the preliminary networking (dhcp)   # stop at last the preliminary networking (dhcp)
886   preliminary_network stop   preliminary_network stop

Legend:
Removed from v.337  
changed lines
  Added in v.359