--- alx-src/trunk/alxconfig-ng/init.d/alxsettings 2005/08/28 19:30:53 307 +++ alx-src/trunk/alxconfig-ng/init.d/alxsettings 2005/08/31 21:31:09 313 @@ -11,7 +11,7 @@ #%before: #%after: -# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.18 2005-08-28 19:30:53 niro Exp $ +# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.19 2005-08-31 21:31:09 niro Exp $ # checks first if the client was already configured and if it has an valid serial # if not it runs the autoconfiguration script @@ -196,26 +196,31 @@ # 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 than one serial number then ### + # we're using the mtime now (better for validating 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 than one serial number then ### +# +# # 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}'") - # select highest id only (added max) + # 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} \ - "select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'") + "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); + select last_insert_id() + 1;") if [ "${ALX_SERIAL}" != NULL ] then @@ -444,6 +449,9 @@ # set system state to 'already configured' touch /etc/alxconfig-ng/state/configured + # if only an recheck was forced than abort now + [[ ${ALX_FORCED_RECHECK} = true ]] && return 0 + # create a fresh fluxbox directory [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox install -d ${ALX_UNPRIV_HOME}/.fluxbox @@ -473,10 +481,47 @@ # add a newline (maybe there is no crlf in the footer) echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu + + # setup some standart icons (sysinfo.lnk) + # basic config + cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc + + # clean desktop icon location + [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop + install -d ${ALX_UNPRIV_HOME}/.xtdesktop + + # last but not least gen a icon with some sys informations + local sysinfo + local osversion + local xres + local yres + + osversion="$(< /etc/mageversion)" + sysinfo="Hostname: ${ALX_DEFAULT_HOSTNAME} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)" + + # at first boot we got always a resolution of 1024x768-16@60 + # middle of the screen + # (no txt - length required, xtdesk manage that itself) + xres="$((1024 / 2))" + # default y pos (full yres -22 !) + yres="$((768 - 22 ))" + + generate_icon \ + --name "${sysinfo}" \ + --command "exit 0" \ + --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ + --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ + --xres "${xres}" \ + --yres "${yres}" \ + --icon-width "1" \ + --icon-height "1" + # set correct permissions 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