--- alx-src/trunk/alxconfig-ng/init.d/alxsettings 2005/09/22 22:14:38 337 +++ alx-src/trunk/alxconfig-ng/init.d/alxsettings 2005/10/09 21:38:14 348 @@ -11,7 +11,7 @@ #%before: #%after: -# $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.23 2005-10-09 21:38:14 niro Exp $ # checks first if the client was already configured and if it has an valid serial # if not it runs the autoconfiguration script @@ -97,7 +97,6 @@ get_system_serial() { - local CUR_IP CUR_MAC CUR_MTIME # check if serial file exists @@ -116,8 +115,8 @@ exit 1 fi - CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') - CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) + CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp') + CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) CUR_MTIME=$(date +%s) echo -e ${COLOREDSTAR} "Trying to validate my serial ..." @@ -211,8 +210,7 @@ echo -e ${COLOREDSTAR} "Trying to get new serial ..." # request a new serial; one command now (cause must be done in the same session) - ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "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}'); select last_insert_id();") if [[ ${ALX_SERIAL} != NULL ]] @@ -222,7 +220,7 @@ $SET_WCOL echo "[ SN: ${ALX_SERIAL} ]" - # set ALX_STATE to ok so everybody that everything was ok + # set ALX_STATE to ok so everybody knows that everything was ok ALX_STATE=ok echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial @@ -246,6 +244,7 @@ # write current state to temp file echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state + echo "ALX_IFACE=${ALX_IFACE}" >> /etc/alxconfig-ng/state/state } @@ -295,8 +294,7 @@ source ${network_settings}/net.${iface} || exit 1 NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "insert into cfg_network( + mysqldo "insert into cfg_network( hostname, serial, module, @@ -347,8 +345,7 @@ break done else - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "insert into cfg_network( + mysqldo "insert into cfg_network( hostname, serial, module, @@ -368,8 +365,7 @@ # xserver echo -e " Graphic settings ..." # xserver general - ( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "insert into cfg_graphic( + ( mysqldo "insert into cfg_graphic( serial, module, resolution, @@ -387,14 +383,12 @@ # 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}');" + mysqldo "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( + echo -e " Authentification settings ..." + mysqldo "insert into client_auth( serial, username, shell, @@ -414,14 +408,18 @@ # exchange ssh rsa keys - the first boot needs this ! # or no reboot will work via the webadmin - echo -e " SSH authentifcation settings ..." + echo -e " SSH authentification settings ..." HOME=/root config_ssh_auth evaluate_retval - # input + # autostart echo -e " Autostart settings ..." - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" + mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" + + # screensaver + echo -e " Screensaver settings ..." + mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')" + evaluate_retval } @@ -461,8 +459,7 @@ source ${network_settings}/net.${iface} || exit 1 NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "update cfg_network set + mysqldo "update cfg_network set hostname='${ALX_DEFAULT_HOSTNAME}', module='${NETCARD_DRIVER}', domain='${ALX_DEFAULT_DOMAIN}', @@ -489,8 +486,7 @@ break done else - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "update cfg_network set + mysqldo "update cfg_network set hostname='${ALX_DEFAULT_HOSTNAME}', module='${NETCARD_DRIVER}', domain='${ALX_DEFAULT_DOMAIN}', @@ -502,8 +498,7 @@ # xserver echo -e " Graphic settings ..." # xserver general - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "update cfg_graphic set + mysqldo "update cfg_graphic set module='${XMODULE}', resolution='1024x768', depth='16', @@ -513,10 +508,7 @@ # input echo -e " Input settings ..." - mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ - "update cfg_input set - mouse='${XMOUSETYPE}' - where serial=${ALX_SERIAL};" + mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};" evaluate_retval } @@ -634,13 +626,8 @@ chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox - chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop - 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 + chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop + chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc } # start|stop @@ -680,8 +667,8 @@ else rm -f /var/run/dhcpcd-eth?.pid fi - [[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop - + [[ ${ALX_CONFD_NETWORKING} = true ]] && [[ ${RUNLEVEL} != S ]] && \ + ${rc_base}/init.d/network stop echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} @@ -747,9 +734,11 @@ rm -rf /etc/alxconfig-ng/state echo "I am done now, press [Enter] to reboot system ..." - read - reboot + else + echo "Aborted, press [Enter] to reboot system ..." fi + read + reboot } onboot_interface_list() @@ -775,7 +764,7 @@ echo "${devices}" } -# read values from files +# read values from net.* files read_value() { local var="$1" @@ -862,7 +851,7 @@ # now setup system configuration # alx_setup_or_whatever_it_will_be_called() - [ "${ALX_HW_DETECT}" == "false" ] && update_system_settings + [[ ${ALX_HW_DETECT} = false ]] && update_system_settings # stop at last the preliminary networking (dhcp) preliminary_network stop