11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/init.d/alxsettings,v 1.13 2008-06-07 18:25:00 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/init.d/alxsettings,v 1.20 2008-06-10 23:13:06 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 |
21 |
# if no changes are at server side they will be kept, if yes the get updated. |
# if no changes are at server side they will be kept, if yes the get updated. |
22 |
# the server settings has higher priority. |
# the server settings has higher priority. |
23 |
|
|
24 |
source /etc/sysconfig/rc |
source /etc/conf.d/rc |
25 |
source $rc_functions |
source ${rc_functions} |
26 |
|
|
27 |
# mysql settings |
# mysql settings |
28 |
source /etc/alxconfig-ng/config.rc |
source /etc/alxconfig-ng/config.rc |
30 |
# helper functions |
# helper functions |
31 |
source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
32 |
source /usr/lib/alxconfig-ng/functions/serial_functions |
source /usr/lib/alxconfig-ng/functions/serial_functions |
33 |
|
source /usr/lib/alxconfig-ng/functions/config_driverkits |
34 |
source /usr/lib/alxconfig-ng/functions/config_modules |
source /usr/lib/alxconfig-ng/functions/config_modules |
35 |
source /usr/lib/alxconfig-ng/functions/config_network |
source /usr/lib/alxconfig-ng/functions/config_network |
36 |
source /usr/lib/alxconfig-ng/functions/config_printers |
source /usr/lib/alxconfig-ng/functions/config_printers |
69 |
{ |
{ |
70 |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
71 |
|
|
72 |
|
# install neccessary driverkits |
73 |
|
config_driverkits |
74 |
|
|
75 |
# get the modules settings |
# get the modules settings |
76 |
# ! is the first thing that must be configured ! |
# ! is the first thing that must be configured ! |
77 |
config_modules |
config_modules |
272 |
# note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
273 |
|
|
274 |
# to be safe, we do some sanity checks |
# to be safe, we do some sanity checks |
275 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[[ -z ${ALX_DEFAULT_DOMAIN} ]] && ALX_DEFAULT_DOMAIN=localdomain |
276 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[[ -z ${ALX_DEFAULT_HOSTNAME} ]] && ALX_DEFAULT_HOSTNAME=magellan-alx |
277 |
|
|
278 |
# vars used by hwdetect |
# vars used by hwdetect |
279 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
288 |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
289 |
|
|
290 |
# network |
# network |
291 |
echo -e " Network settings ..." |
echo " Network settings ..." |
292 |
# global settings |
# global settings |
293 |
mysqldo "insert into cfg_network(serial, hostname, domain ) |
mysqldo "insert into cfg_network(serial, hostname, domain ) |
294 |
values('${ALX_SERIAL}', '${ALX_DEFAULT_HOSTNAME}','${ALX_DEFAULT_DOMAIN}');" |
values('${ALX_SERIAL}', '${ALX_DEFAULT_HOSTNAME}','${ALX_DEFAULT_DOMAIN}');" |
317 |
evaluate_retval |
evaluate_retval |
318 |
|
|
319 |
# xserver |
# xserver |
320 |
echo -e " Graphic settings ..." |
echo " Graphic settings ..." |
321 |
# xserver general |
# xserver general |
322 |
( mysqldo "insert into cfg_graphic( |
( mysqldo "insert into cfg_graphic( |
323 |
serial, |
serial, |
336 |
evaluate_retval |
evaluate_retval |
337 |
|
|
338 |
# input |
# input |
339 |
echo -e " Input settings ..." |
echo " Input settings ..." |
340 |
mysqldo "insert into cfg_input(serial,mouse,keyboard) values('${ALX_SERIAL}','${XMOUSETYPE}','kbd');" |
mysqldo "insert into cfg_input(serial,mouse,keyboard) values('${ALX_SERIAL}','${XMOUSETYPE}','kbd');" |
341 |
evaluate_retval |
evaluate_retval |
342 |
|
|
343 |
# auth |
# auth |
344 |
echo -e " Authentification settings ..." |
echo " Authentification settings ..." |
345 |
mysqldo "insert into client_auth( |
mysqldo "insert into client_auth( |
346 |
serial, |
serial, |
347 |
username, |
username, |
362 |
|
|
363 |
# exchange ssh rsa keys - the first boot needs this ! |
# exchange ssh rsa keys - the first boot needs this ! |
364 |
# or no reboot will work via the webadmin |
# or no reboot will work via the webadmin |
365 |
echo -e " SSH authentification settings ..." |
echo " SSH authentification settings ..." |
366 |
HOME=/root config_ssh_auth |
HOME=/root config_ssh_auth |
367 |
evaluate_retval |
evaluate_retval |
368 |
|
|
369 |
# autostart |
# autostart |
370 |
echo -e " Autostart settings ..." |
echo " Autostart settings ..." |
371 |
mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
372 |
|
|
373 |
# screensaver |
# screensaver |
374 |
echo -e " Screensaver settings ..." |
echo " Screensaver settings ..." |
375 |
mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')" |
mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')" |
376 |
|
|
377 |
|
# theme |
378 |
|
echo " Theme settings ..." |
379 |
|
mysqldo "insert into cfg_theme(serial,theme) values('${ALX_SERIAL}','${ALX_DEFAULT_THEME}')" |
380 |
|
|
381 |
evaluate_retval |
evaluate_retval |
382 |
} |
} |
383 |
|
|
389 |
# note: we updating only hardware settings here ! |
# note: we updating only hardware settings here ! |
390 |
|
|
391 |
# to be safe, we do some sanity checks |
# to be safe, we do some sanity checks |
392 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[[ -z ${ALX_DEFAULT_DOMAIN} ]] && ALX_DEFAULT_DOMAIN=localdomain |
393 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[[ -z ${ALX_DEFAULT_HOSTNAME} ]] && ALX_DEFAULT_HOSTNAME=magellan-alx |
394 |
|
|
395 |
# vars used by hwdetect |
# vars used by hwdetect |
396 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
405 |
echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT} |
406 |
|
|
407 |
# network |
# network |
408 |
echo -e " Network settings ..." |
echo " Network settings ..." |
409 |
mysqldo "update cfg_network set |
mysqldo "update cfg_network set |
410 |
hostname='${ALX_DEFAULT_HOSTNAME}', |
hostname='${ALX_DEFAULT_HOSTNAME}', |
411 |
domain='${ALX_DEFAULT_DOMAIN}'; |
domain='${ALX_DEFAULT_DOMAIN}'; |
431 |
evaluate_retval |
evaluate_retval |
432 |
|
|
433 |
# xserver |
# xserver |
434 |
echo -e " Graphic settings ..." |
echo " Graphic settings ..." |
435 |
# xserver general |
# xserver general |
436 |
mysqldo "update cfg_graphic set |
mysqldo "update cfg_graphic set |
437 |
module='${XMODULE}', |
module='${XMODULE}', |
442 |
evaluate_retval |
evaluate_retval |
443 |
|
|
444 |
# input |
# input |
445 |
echo -e " Input settings ..." |
echo " Input settings ..." |
446 |
mysqldo "update cfg_input set mouse='${XMOUSETYPE}', keyboard='kbd' where serial=${ALX_SERIAL};" |
mysqldo "update cfg_input set mouse='${XMOUSETYPE}', keyboard='kbd' where serial=${ALX_SERIAL};" |
447 |
evaluate_retval |
evaluate_retval |
448 |
} |
} |
455 |
# note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
456 |
|
|
457 |
# to be safe, we do some sanity checks |
# to be safe, we do some sanity checks |
458 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[[ -z ${ALX_DEFAULT_DOMAIN} ]] && ALX_DEFAULT_DOMAIN=localdomain |
459 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[[ -z ${ALX_DEFAULT_HOSTNAME} ]] && ALX_DEFAULT_HOSTNAME=magellan-alx |
460 |
|
|
461 |
# vars used by hwdetect |
# vars used by hwdetect |
462 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
481 |
|
|
482 |
# now generate fluxbox config files |
# now generate fluxbox config files |
483 |
|
|
484 |
|
# fluxbox theme |
485 |
|
[[ ! -d /usr/share/fluxbox/styles ]] && install -d /usr/share/fluxbox/styles |
486 |
|
cat ${ALX_SKELETONS}/fluxbox/themes/${ALX_DEFAULT_THEME} > /usr/share/fluxbox/styles/default |
487 |
|
|
488 |
# fluxbox main config |
# fluxbox main config |
489 |
cat ${ALX_SKELETONS}/fluxbox/init \ |
cat ${ALX_SKELETONS}/fluxbox/init > ${ALX_UNPRIV_HOME}/.fluxbox/init |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/init |
|
490 |
|
|
491 |
# fluxbox autostart |
# fluxbox autostart |
492 |
cat ${ALX_SKELETONS}/fluxbox/apps \ |
cat ${ALX_SKELETONS}/fluxbox/apps > ${ALX_UNPRIV_HOME}/.fluxbox/apps |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/apps |
|
493 |
|
|
494 |
# fluxbox menu header |
# fluxbox menu header |
495 |
cat ${ALX_SKELETONS}/fluxbox/menu.header \ |
cat ${ALX_SKELETONS}/fluxbox/menu.header > ${ALX_UNPRIV_HOME}/.fluxbox/menu |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
|
496 |
|
|
497 |
# now fix it with proper messages :P |
# now fix it with proper messages :P |
498 |
local ver="$(< /etc/mageversion)" |
local ver="$(< /etc/mageversion)" |
499 |
sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" \ |
sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" ${ALX_UNPRIV_HOME}/.fluxbox/menu |
|
${ALX_UNPRIV_HOME}/.fluxbox/menu |
|
500 |
|
|
501 |
# add a newline (maybe there is no crlf in the header) |
# add a newline (maybe there is no crlf in the header) |
502 |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
503 |
|
|
504 |
# fluxbox menu footer |
# fluxbox menu footer |
505 |
cat ${ALX_SKELETONS}/fluxbox/menu.footer \ |
cat ${ALX_SKELETONS}/fluxbox/menu.footer >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
|
>> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
|
506 |
|
|
507 |
# add a newline (maybe there is no crlf in the footer) |
# add a newline (maybe there is no crlf in the footer) |
508 |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
509 |
|
|
510 |
# setup some standart icons (sysinfo.lnk) |
# setup some standart icons (sysinfo.lnk) |
511 |
# basic config |
# basic config |
512 |
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc |
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc-${ALX_DEFAULT_THEME} > ${ALX_UNPRIV_HOME}/.xtdeskrc |
513 |
|
|
514 |
# clean desktop icon location |
# clean desktop icon location |
515 |
[ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop |
[ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop |
605 |
rm -f /etc/alxconfig-ng/serial |
rm -f /etc/alxconfig-ng/serial |
606 |
rm -rf /etc/alxconfig-ng/state |
rm -rf /etc/alxconfig-ng/state |
607 |
|
|
608 |
# clear all printers & net-shares |
# clear all printers |
609 |
:> /etc/cups/printers.conf |
:> /etc/printcap |
610 |
:> /etc/samba/smb.conf |
find /var/spool/lpd/* -type d | xargs rm -rf &> /dev/null |
|
|
|
|
# remove inetd, cups & smb from init |
|
|
rc-config del inetd &> /dev/null |
|
|
rc-config del cups &> /dev/null |
|
|
rc-config del samba &> /dev/null |
|
611 |
|
|
612 |
# remove all user settings |
# remove all user settings |
613 |
[ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME} |
[ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME} |
678 |
echo "Usage: $0 {start|stop} ..." |
echo "Usage: $0 {start|stop} ..." |
679 |
;; |
;; |
680 |
esac |
esac |
|
|
|