11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
# $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 $ |
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 |
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() + 1;") |
224 |
|
|
225 |
if [ "${ALX_SERIAL}" != NULL ] |
if [ "${ALX_SERIAL}" != NULL ] |
226 |
then |
then |
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 |
481 |
# add a newline (maybe there is no crlf in the footer) |
# add a newline (maybe there is no crlf in the footer) |
482 |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
483 |
|
|
484 |
|
|
485 |
|
# setup some standart icons (sysinfo.lnk) |
486 |
|
# basic config |
487 |
|
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc |
488 |
|
|
489 |
|
# clean desktop icon location |
490 |
|
[ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop |
491 |
|
install -d ${ALX_UNPRIV_HOME}/.xtdesktop |
492 |
|
|
493 |
|
# last but not least gen a icon with some sys informations |
494 |
|
local sysinfo |
495 |
|
local osversion |
496 |
|
local xres |
497 |
|
local yres |
498 |
|
|
499 |
|
osversion="$(< /etc/mageversion)" |
500 |
|
sysinfo="Hostname: ${ALX_DEFAULT_HOSTNAME} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)" |
501 |
|
|
502 |
|
# at first boot we got always a resolution of 1024x768-16@60 |
503 |
|
# middle of the screen |
504 |
|
# (no txt - length required, xtdesk manage that itself) |
505 |
|
xres="$((1024 / 2))" |
506 |
|
# default y pos (full yres -22 !) |
507 |
|
yres="$((768 - 22 ))" |
508 |
|
|
509 |
|
generate_icon \ |
510 |
|
--name "${sysinfo}" \ |
511 |
|
--command "exit 0" \ |
512 |
|
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
513 |
|
--dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ |
514 |
|
--xres "${xres}" \ |
515 |
|
--yres "${yres}" \ |
516 |
|
--icon-width "1" \ |
517 |
|
--icon-height "1" |
518 |
|
|
519 |
# set correct permissions |
# set correct permissions |
520 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
521 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
522 |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
523 |
|
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
524 |
|
chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc |
525 |
|
|
526 |
# default passwords are bad |
# default passwords are bad |
527 |
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") root |
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") root |