11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
# $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 $ |
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 |
97 |
|
|
98 |
get_system_serial() |
get_system_serial() |
99 |
{ |
{ |
|
|
|
100 |
local CUR_IP CUR_MAC CUR_MTIME |
local CUR_IP CUR_MAC CUR_MTIME |
101 |
|
|
102 |
# check if serial file exists |
# check if serial file exists |
115 |
exit 1 |
exit 1 |
116 |
fi |
fi |
117 |
|
|
118 |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp') |
119 |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) |
120 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
121 |
|
|
122 |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
210 |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
211 |
|
|
212 |
# request a new serial; one command now (cause must be done in the same session) |
# request a new serial; one command now (cause must be done in the same session) |
213 |
ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_SERIAL=$(mysqldo "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); |
|
"insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); |
|
214 |
select last_insert_id();") |
select last_insert_id();") |
215 |
|
|
216 |
if [[ ${ALX_SERIAL} != NULL ]] |
if [[ ${ALX_SERIAL} != NULL ]] |
220 |
$SET_WCOL |
$SET_WCOL |
221 |
echo "[ SN: ${ALX_SERIAL} ]" |
echo "[ SN: ${ALX_SERIAL} ]" |
222 |
|
|
223 |
# set ALX_STATE to ok so everybody that everything was ok |
# set ALX_STATE to ok so everybody knows that everything was ok |
224 |
ALX_STATE=ok |
ALX_STATE=ok |
225 |
|
|
226 |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial |
244 |
|
|
245 |
# write current state to temp file |
# write current state to temp file |
246 |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
247 |
|
echo "ALX_IFACE=${ALX_IFACE}" >> /etc/alxconfig-ng/state/state |
248 |
} |
} |
249 |
|
|
250 |
|
|
294 |
source ${network_settings}/net.${iface} || exit 1 |
source ${network_settings}/net.${iface} || exit 1 |
295 |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
296 |
|
|
297 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into cfg_network( |
|
"insert into cfg_network( |
|
298 |
hostname, |
hostname, |
299 |
serial, |
serial, |
300 |
module, |
module, |
345 |
break |
break |
346 |
done |
done |
347 |
else |
else |
348 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into cfg_network( |
|
"insert into cfg_network( |
|
349 |
hostname, |
hostname, |
350 |
serial, |
serial, |
351 |
module, |
module, |
365 |
# xserver |
# xserver |
366 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
367 |
# xserver general |
# xserver general |
368 |
( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
( mysqldo "insert into cfg_graphic( |
|
"insert into cfg_graphic( |
|
369 |
serial, |
serial, |
370 |
module, |
module, |
371 |
resolution, |
resolution, |
383 |
|
|
384 |
# input |
# input |
385 |
echo -e " Input settings ..." |
echo -e " Input settings ..." |
386 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');" |
|
"insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');" |
|
387 |
evaluate_retval |
evaluate_retval |
388 |
|
|
389 |
# auth |
# auth |
390 |
echo -e " Authentifcation settings ..." |
echo -e " Authentification settings ..." |
391 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into client_auth( |
|
"insert into client_auth( |
|
392 |
serial, |
serial, |
393 |
username, |
username, |
394 |
shell, |
shell, |
408 |
|
|
409 |
# exchange ssh rsa keys - the first boot needs this ! |
# exchange ssh rsa keys - the first boot needs this ! |
410 |
# or no reboot will work via the webadmin |
# or no reboot will work via the webadmin |
411 |
echo -e " SSH authentifcation settings ..." |
echo -e " SSH authentification settings ..." |
412 |
HOME=/root config_ssh_auth |
HOME=/root config_ssh_auth |
413 |
evaluate_retval |
evaluate_retval |
414 |
|
|
415 |
# input |
# autostart |
416 |
echo -e " Autostart settings ..." |
echo -e " Autostart settings ..." |
417 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
418 |
"insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
|
419 |
|
# screensaver |
420 |
|
echo -e " Screensaver settings ..." |
421 |
|
mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')" |
422 |
|
|
423 |
evaluate_retval |
evaluate_retval |
424 |
} |
} |
425 |
|
|
459 |
source ${network_settings}/net.${iface} || exit 1 |
source ${network_settings}/net.${iface} || exit 1 |
460 |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
461 |
|
|
462 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "update cfg_network set |
|
"update cfg_network set |
|
463 |
hostname='${ALX_DEFAULT_HOSTNAME}', |
hostname='${ALX_DEFAULT_HOSTNAME}', |
464 |
module='${NETCARD_DRIVER}', |
module='${NETCARD_DRIVER}', |
465 |
domain='${ALX_DEFAULT_DOMAIN}', |
domain='${ALX_DEFAULT_DOMAIN}', |
486 |
break |
break |
487 |
done |
done |
488 |
else |
else |
489 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "update cfg_network set |
|
"update cfg_network set |
|
490 |
hostname='${ALX_DEFAULT_HOSTNAME}', |
hostname='${ALX_DEFAULT_HOSTNAME}', |
491 |
module='${NETCARD_DRIVER}', |
module='${NETCARD_DRIVER}', |
492 |
domain='${ALX_DEFAULT_DOMAIN}', |
domain='${ALX_DEFAULT_DOMAIN}', |
498 |
# xserver |
# xserver |
499 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
500 |
# xserver general |
# xserver general |
501 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "update cfg_graphic set |
|
"update cfg_graphic set |
|
502 |
module='${XMODULE}', |
module='${XMODULE}', |
503 |
resolution='1024x768', |
resolution='1024x768', |
504 |
depth='16', |
depth='16', |
508 |
|
|
509 |
# input |
# input |
510 |
echo -e " Input settings ..." |
echo -e " Input settings ..." |
511 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "update cfg_input set mouse='${XMOUSETYPE}' where serial=${ALX_SERIAL};" |
|
"update cfg_input set |
|
|
mouse='${XMOUSETYPE}' |
|
|
where serial=${ALX_SERIAL};" |
|
512 |
evaluate_retval |
evaluate_retval |
513 |
} |
} |
514 |
|
|
626 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
627 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
628 |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
629 |
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
630 |
chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc |
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 |
|
631 |
} |
} |
632 |
|
|
633 |
# start|stop |
# start|stop |
667 |
else |
else |
668 |
rm -f /var/run/dhcpcd-eth?.pid |
rm -f /var/run/dhcpcd-eth?.pid |
669 |
fi |
fi |
670 |
[[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop |
[[ ${ALX_CONFD_NETWORKING} = true ]] && [[ ${RUNLEVEL} != S ]] && \ |
671 |
|
${rc_base}/init.d/network stop |
672 |
|
|
673 |
echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} |
674 |
|
|
734 |
rm -rf /etc/alxconfig-ng/state |
rm -rf /etc/alxconfig-ng/state |
735 |
|
|
736 |
echo "I am done now, press [Enter] to reboot system ..." |
echo "I am done now, press [Enter] to reboot system ..." |
737 |
read |
else |
738 |
reboot |
echo "Aborted, press [Enter] to reboot system ..." |
739 |
fi |
fi |
740 |
|
read |
741 |
|
reboot |
742 |
} |
} |
743 |
|
|
744 |
onboot_interface_list() |
onboot_interface_list() |
764 |
echo "${devices}" |
echo "${devices}" |
765 |
} |
} |
766 |
|
|
767 |
# read values from files |
# read values from net.* files |
768 |
read_value() |
read_value() |
769 |
{ |
{ |
770 |
local var="$1" |
local var="$1" |
851 |
|
|
852 |
# now setup system configuration |
# now setup system configuration |
853 |
# alx_setup_or_whatever_it_will_be_called() |
# alx_setup_or_whatever_it_will_be_called() |
854 |
[ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
[[ ${ALX_HW_DETECT} = false ]] && update_system_settings |
855 |
|
|
856 |
# stop at last the preliminary networking (dhcp) |
# stop at last the preliminary networking (dhcp) |
857 |
preliminary_network stop |
preliminary_network stop |