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.24 2005-10-09 23:20:17 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 ALX_IFACE |
101 |
|
|
102 |
local CUR_IP CUR_MAC CUR_MTIME |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
103 |
|
then |
104 |
|
ALX_IFACE="$(< ${SETTINGSPATH}/confd-networking)" |
105 |
|
else |
106 |
|
ALX_IFACE="eth0" |
107 |
|
fi |
108 |
|
|
109 |
# check if serial file exists |
# check if serial file exists |
110 |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
122 |
exit 1 |
exit 1 |
123 |
fi |
fi |
124 |
|
|
125 |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
CUR_IP=$(/sbin/ifconfig ${ALX_IFACE} | sed -n '/addr:/s/ [^r]*..//gp') |
126 |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(/sbin/ifconfig ${ALX_IFACE} | grep HWaddr | cut -d ' ' -f11) |
127 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
128 |
|
|
129 |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
217 |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
218 |
|
|
219 |
# 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) |
220 |
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}'); |
|
221 |
select last_insert_id();") |
select last_insert_id();") |
222 |
|
|
223 |
if [[ ${ALX_SERIAL} != NULL ]] |
if [[ ${ALX_SERIAL} != NULL ]] |
227 |
$SET_WCOL |
$SET_WCOL |
228 |
echo "[ SN: ${ALX_SERIAL} ]" |
echo "[ SN: ${ALX_SERIAL} ]" |
229 |
|
|
230 |
# set ALX_STATE to ok so everybody that everything was ok |
# set ALX_STATE to ok so everybody knows that everything was ok |
231 |
ALX_STATE=ok |
ALX_STATE=ok |
232 |
|
|
233 |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial |
251 |
|
|
252 |
# write current state to temp file |
# write current state to temp file |
253 |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
254 |
|
echo "ALX_IFACE=${ALX_IFACE}" >> /etc/alxconfig-ng/state/state |
255 |
} |
} |
256 |
|
|
257 |
|
|
301 |
source ${network_settings}/net.${iface} || exit 1 |
source ${network_settings}/net.${iface} || exit 1 |
302 |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
303 |
|
|
304 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into cfg_network( |
|
"insert into cfg_network( |
|
305 |
hostname, |
hostname, |
306 |
serial, |
serial, |
307 |
module, |
module, |
352 |
break |
break |
353 |
done |
done |
354 |
else |
else |
355 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into cfg_network( |
|
"insert into cfg_network( |
|
356 |
hostname, |
hostname, |
357 |
serial, |
serial, |
358 |
module, |
module, |
372 |
# xserver |
# xserver |
373 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
374 |
# xserver general |
# xserver general |
375 |
( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
( mysqldo "insert into cfg_graphic( |
|
"insert into cfg_graphic( |
|
376 |
serial, |
serial, |
377 |
module, |
module, |
378 |
resolution, |
resolution, |
390 |
|
|
391 |
# input |
# input |
392 |
echo -e " Input settings ..." |
echo -e " Input settings ..." |
393 |
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}');" |
|
394 |
evaluate_retval |
evaluate_retval |
395 |
|
|
396 |
# auth |
# auth |
397 |
echo -e " Authentifcation settings ..." |
echo -e " Authentification settings ..." |
398 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into client_auth( |
|
"insert into client_auth( |
|
399 |
serial, |
serial, |
400 |
username, |
username, |
401 |
shell, |
shell, |
415 |
|
|
416 |
# exchange ssh rsa keys - the first boot needs this ! |
# exchange ssh rsa keys - the first boot needs this ! |
417 |
# or no reboot will work via the webadmin |
# or no reboot will work via the webadmin |
418 |
echo -e " SSH authentifcation settings ..." |
echo -e " SSH authentification settings ..." |
419 |
HOME=/root config_ssh_auth |
HOME=/root config_ssh_auth |
420 |
evaluate_retval |
evaluate_retval |
421 |
|
|
422 |
# input |
# autostart |
423 |
echo -e " Autostart settings ..." |
echo -e " Autostart settings ..." |
424 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
425 |
"insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
|
426 |
|
# screensaver |
427 |
|
echo -e " Screensaver settings ..." |
428 |
|
mysqldo "insert into cfg_screensaver(serial,screensaver) values('${ALX_SERIAL}','')" |
429 |
|
|
430 |
evaluate_retval |
evaluate_retval |
431 |
} |
} |
432 |
|
|
466 |
source ${network_settings}/net.${iface} || exit 1 |
source ${network_settings}/net.${iface} || exit 1 |
467 |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
468 |
|
|
469 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "update cfg_network set |
|
"update cfg_network set |
|
470 |
hostname='${ALX_DEFAULT_HOSTNAME}', |
hostname='${ALX_DEFAULT_HOSTNAME}', |
471 |
module='${NETCARD_DRIVER}', |
module='${NETCARD_DRIVER}', |
472 |
domain='${ALX_DEFAULT_DOMAIN}', |
domain='${ALX_DEFAULT_DOMAIN}', |
493 |
break |
break |
494 |
done |
done |
495 |
else |
else |
496 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "update cfg_network set |
|
"update cfg_network set |
|
497 |
hostname='${ALX_DEFAULT_HOSTNAME}', |
hostname='${ALX_DEFAULT_HOSTNAME}', |
498 |
module='${NETCARD_DRIVER}', |
module='${NETCARD_DRIVER}', |
499 |
domain='${ALX_DEFAULT_DOMAIN}', |
domain='${ALX_DEFAULT_DOMAIN}', |
505 |
# xserver |
# xserver |
506 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
507 |
# xserver general |
# xserver general |
508 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysqldo "update cfg_graphic set |
|
"update cfg_graphic set |
|
509 |
module='${XMODULE}', |
module='${XMODULE}', |
510 |
resolution='1024x768', |
resolution='1024x768', |
511 |
depth='16', |
depth='16', |
515 |
|
|
516 |
# input |
# input |
517 |
echo -e " Input settings ..." |
echo -e " Input settings ..." |
518 |
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};" |
|
519 |
evaluate_retval |
evaluate_retval |
520 |
} |
} |
521 |
|
|
633 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
634 |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
635 |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
636 |
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
637 |
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 |
|
638 |
} |
} |
639 |
|
|
640 |
# start|stop |
# start|stop |
674 |
else |
else |
675 |
rm -f /var/run/dhcpcd-eth?.pid |
rm -f /var/run/dhcpcd-eth?.pid |
676 |
fi |
fi |
677 |
[[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop |
[[ ${ALX_CONFD_NETWORKING} = true ]] && [[ ${RUNLEVEL} != S ]] && \ |
678 |
|
${rc_base}/init.d/network stop |
679 |
|
|
680 |
echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} |
681 |
|
|
741 |
rm -rf /etc/alxconfig-ng/state |
rm -rf /etc/alxconfig-ng/state |
742 |
|
|
743 |
echo "I am done now, press [Enter] to reboot system ..." |
echo "I am done now, press [Enter] to reboot system ..." |
744 |
read |
else |
745 |
reboot |
echo "Aborted, press [Enter] to reboot system ..." |
746 |
fi |
fi |
747 |
|
read |
748 |
|
reboot |
749 |
} |
} |
750 |
|
|
751 |
onboot_interface_list() |
onboot_interface_list() |
771 |
echo "${devices}" |
echo "${devices}" |
772 |
} |
} |
773 |
|
|
774 |
# read values from files |
# read values from net.* files |
775 |
read_value() |
read_value() |
776 |
{ |
{ |
777 |
local var="$1" |
local var="$1" |
858 |
|
|
859 |
# now setup system configuration |
# now setup system configuration |
860 |
# alx_setup_or_whatever_it_will_be_called() |
# alx_setup_or_whatever_it_will_be_called() |
861 |
[ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
[[ ${ALX_HW_DETECT} = false ]] && update_system_settings |
862 |
|
|
863 |
# stop at last the preliminary networking (dhcp) |
# stop at last the preliminary networking (dhcp) |
864 |
preliminary_network stop |
preliminary_network stop |