--- alx-src/trunk/alxconfig-ng/init.d/alxsettings 2005/04/13 16:15:28 248 +++ alx-src/trunk/alxconfig-ng/init.d/alxsettings 2005/07/10 17:55:03 275 @@ -11,7 +11,7 @@ #%before: #%after: -# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.8 2005-04-13 16:15:28 niro Exp $ +# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.14 2005-07-10 17:55:03 niro Exp $ # checks first if the client was already configured and if it has an valid serial # if not it runs the autoconfiguration script @@ -28,11 +28,13 @@ source /etc/alxconfig-ng/config.rc source /usr/lib/alxconfig-ng/functions/mysqlfunctions source /usr/lib/alxconfig-ng/functions/serial_functions +source /usr/lib/alxconfig-ng/functions/config_modules source /usr/lib/alxconfig-ng/functions/config_network source /usr/lib/alxconfig-ng/functions/config_printers source /usr/lib/alxconfig-ng/functions/config_sessions source /usr/lib/alxconfig-ng/functions/config_x11 source /usr/lib/alxconfig-ng/functions/config_auth +source /usr/lib/alxconfig-ng/functions/config_ssh_auth #check if mysql is available [ -x /usr/bin/mysql ] && MYSQL_ALX=true @@ -51,6 +53,10 @@ update_system_settings(){ echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} + # get the modules settings + # ! is the first thing that must be configured ! + config_modules + # imports network settings from db config_networking @@ -65,6 +71,9 @@ # imports auth settings from db config_auth + + # exchange ssh rsa keys + HOME=/root config_ssh_auth } get_system_serial(){ @@ -245,11 +254,46 @@ '1024x768', '16', '0' - );"; + );"; ) + evaluate_retval + + # input + echo -e " Input settings ..." + mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ + "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');" + evaluate_retval + + # auth + echo -e " Authentifcation settings ..." + mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ + "insert into client_auth( + serial, + username, + shell, + vnc, + samba, + station + ) + values( + '${ALX_SERIAL}', + '${ALX_UNPRIV_USER}', + '', + '', + '', + '' + );" + evaluate_retval + + # exchange ssh rsa keys - the first boot needs this ! + # or no reboot will work via the webadmin + echo -e " SSH authentifcation settings ..." + HOME=/root config_ssh_auth + evaluate_retval # input - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');";) + echo -e " Autostart settings ..." + mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ + "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" evaluate_retval } @@ -280,6 +324,35 @@ #set system state to 'already configured' touch /etc/alxconfig-ng/state/configured + + # create a fresh fluxbox directory + [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox + install -d ${ALX_UNPRIV_HOME}/.fluxbox + + # now generate fluxbox config files + + # fluxbox main config + cat ${ALX_SKELETONS}/fluxbox/init \ + > ${ALX_UNPRIV_HOME}/.fluxbox/init + + # fluxbox menu header + cat ${ALX_SKELETONS}/fluxbox/menu.header \ + > ${ALX_UNPRIV_HOME}/.fluxbox/menu + + # add a newline (maybe there is no crlf in the header) + echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu + + # fluxbox menu footer + cat ${ALX_SKELETONS}/fluxbox/menu.footer \ + >> ${ALX_UNPRIV_HOME}/.fluxbox/menu + + # add a newline (maybe there is no crlf in the footer) + echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu + + # 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 } #start|stop @@ -352,8 +425,13 @@ then import_settings_to_db import_settings_local + + # here we should also exchange the ssh keys + # or the system cannot be rebooted after + # the first start via the alx-webadmin + config_ssh_auth fi - + #now setup system configuration #alx_setup_or_whatever_it_will_be_called() [ "${ALX_HW_DETECT}" == "false" ] && update_system_settings @@ -372,3 +450,4 @@ echo "Usage: $0 {start|stop} ..." ;; esac +