Magellan Linux

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

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

revision 297 by niro, Thu Aug 18 08:10:46 2005 UTC revision 319 by niro, Thu Sep 1 18:30:28 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.17 2005-08-18 08:10:46 niro Exp $  # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.21 2005-09-01 18:30:28 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 114  get_system_serial(){ Line 114  get_system_serial(){
114   then   then
115   ALX_STATE="ok"   ALX_STATE="ok"
116   else   else
117     # abort on non valid serial
118   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
119     echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state
120     show_invalid_serial_msg
121     exit 1
122   fi   fi
123    
124   else   else
# Line 170  get_system_serial(){ Line 174  get_system_serial(){
174   then   then
175   ALX_STATE="ok"   ALX_STATE="ok"
176   else   else
177     # abort on non valid serial
178   ALX_STATE="invalid serial"   ALX_STATE="invalid serial"
179     echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state
180     show_invalid_serial_msg
181     exit 1
182   fi   fi
183    
184   # write current state to temp file   # write current state to temp file
# Line 188  get_system_serial(){ Line 196  get_system_serial(){
196   # request new serial   # request new serial
197   # ALX_REG_DATE="$(date +%F)"   # ALX_REG_DATE="$(date +%F)"
198    
199   # we're using the mtime now (better for vaildating the serial)   # we're using the mtime now (better for validating the serial)
200   mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \  # mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
201   "insert into client_serials(  # "insert into client_serials(
202   mtime,  # mtime,
203   mac  # mac
204   )  # )
205   values(  # values(
206   '${CUR_MTIME}',  # '${CUR_MTIME}',
207   '${CUR_MAC}'  # '${CUR_MAC}'
208   );"  # );"
209    #
210   # then validate and retrieve serial  # # then validate and retrieve serial
211    #
212   ### warning must be changed that only the LAST ID will be fetched,  ###  # ### warning must be changed that only the LAST ID will be fetched,  ###
213   ### or you get error if the computer name and date are the same     ###  # ### or you get error if the computer name and date are the same     ###
214   ### you have more than one serial number then                       ###  # ### you have more than one serial number then                       ###
215    #
216    # # select highest id only (added max)
217    # ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
218    # "select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'")
219    
220   # select highest id only (added max)   # request a new serial; one command now (cause must be done in the same session)
221   ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \   ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
222   "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}');
223     select last_insert_id();")
224    
225   if [ "${ALX_SERIAL}" != NULL ]   if [ "${ALX_SERIAL}" != NULL ]
226   then   then
# Line 436  import_settings_local(){ Line 449  import_settings_local(){
449   # set system state to 'already configured'   # set system state to 'already configured'
450   touch /etc/alxconfig-ng/state/configured   touch /etc/alxconfig-ng/state/configured
451    
452     # if only an recheck was forced than abort now
453     [[ ${ALX_FORCED_RECHECK} = true ]] && return 0
454    
455   # create a fresh fluxbox directory   # create a fresh fluxbox directory
456   [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox   [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox
457   install -d ${ALX_UNPRIV_HOME}/.fluxbox   install -d ${ALX_UNPRIV_HOME}/.fluxbox
# Line 446  import_settings_local(){ Line 462  import_settings_local(){
462   cat ${ALX_SKELETONS}/fluxbox/init \   cat ${ALX_SKELETONS}/fluxbox/init \
463   > ${ALX_UNPRIV_HOME}/.fluxbox/init   > ${ALX_UNPRIV_HOME}/.fluxbox/init
464    
465     # fluxbox autostart
466     cat ${ALX_SKELETONS}/fluxbox/apps \
467     > ${ALX_UNPRIV_HOME}/.fluxbox/apps
468    
469   # fluxbox menu header   # fluxbox menu header
470   cat ${ALX_SKELETONS}/fluxbox/menu.header \   cat ${ALX_SKELETONS}/fluxbox/menu.header \
471   > ${ALX_UNPRIV_HOME}/.fluxbox/menu   > ${ALX_UNPRIV_HOME}/.fluxbox/menu
# Line 465  import_settings_local(){ Line 485  import_settings_local(){
485   # add a newline (maybe there is no crlf in the footer)   # add a newline (maybe there is no crlf in the footer)
486   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu   echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
487    
488    
489     # setup some standart icons (sysinfo.lnk)
490     # basic config
491     cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc
492    
493     # clean desktop icon location
494     [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop
495     install -d ${ALX_UNPRIV_HOME}/.xtdesktop
496    
497     # last but not least gen a icon with some sys informations
498     local sysinfo
499     local osversion
500     local xres
501     local yres
502    
503     osversion="$(< /etc/mageversion)"
504     sysinfo="Hostname: ${ALX_DEFAULT_HOSTNAME} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)"
505    
506     # at first boot we got always a resolution of 1024x768-16@60
507     # middle of the screen
508     # (no txt - length required, xtdesk manage that itself)
509     xres="$((1024 / 2))"
510     # default y pos (full yres -22 !)
511     yres="$((768 - 22 ))"
512    
513     generate_icon \
514     --name "${sysinfo}" \
515     --command "exit 0" \
516     --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \
517     --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \
518     --xres "${xres}" \
519     --yres "${yres}" \
520     --icon-width "1" \
521     --icon-height "1"
522    
523   # set correct permissions   # set correct permissions
524   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
525   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox   chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
526   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox   chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
527     chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop
528     chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc
529    
530   # default passwords are bad   # default passwords are bad
531   #usermod -p $(perl -e "printf(crypt('foobar','AD'))") root   #usermod -p $(perl -e "printf(crypt('foobar','AD'))") root

Legend:
Removed from v.297  
changed lines
  Added in v.319