11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.20 2005-08-31 23:55:22 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.25 2005-10-10 21:06:03 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 |
44 |
# other needed vars |
# other needed vars |
45 |
ALX_HW_DETECT=false |
ALX_HW_DETECT=false |
46 |
ALX_FORCED_RECHECK=false |
ALX_FORCED_RECHECK=false |
47 |
|
ALX_RESET_SETTINGS=false |
48 |
|
ALX_CONFD_NETWORKING=false |
49 |
|
|
50 |
# unset vars which may kill us |
# unset vars which may kill us |
51 |
unset ALX_SERIAL ALX_STATE |
unset ALX_SERIAL ALX_STATE |
55 |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
56 |
|
|
57 |
|
|
58 |
update_system_settings(){ |
# read_cmdline ${item} |
59 |
|
read_cmdline() |
60 |
|
{ |
61 |
|
local i |
62 |
|
|
63 |
|
for i in $(< /proc/cmdline) |
64 |
|
do |
65 |
|
[[ ${i} = $1 ]] && return 0 |
66 |
|
done |
67 |
|
|
68 |
|
return 1 |
69 |
|
} |
70 |
|
|
71 |
|
update_system_settings() |
72 |
|
{ |
73 |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
74 |
|
|
75 |
# get the modules settings |
# get the modules settings |
95 |
HOME=/root config_ssh_auth |
HOME=/root config_ssh_auth |
96 |
} |
} |
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 ] && [ ! -f /hardware-auto-detection ] |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
111 |
then |
then |
112 |
source /etc/alxconfig-ng/serial |
source /etc/alxconfig-ng/serial |
113 |
|
|
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 ..." |
147 |
else |
else |
148 |
# run hardware detection |
# run hardware detection |
149 |
echo |
echo |
150 |
if [ -f /hardware-auto-detection ] |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
151 |
then |
then |
152 |
echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
153 |
else |
else |
158 |
|
|
159 |
# set hostname to alx_default_hostname |
# set hostname to alx_default_hostname |
160 |
# use old hostname if this is a forced re-check |
# use old hostname if this is a forced re-check |
161 |
[ -f /hardware-auto-detection ] && ALX_DEFAULT_HOSTNAME="$(< /etc/hostname)" |
[[ ${ALX_FORCED_RECHECK} = true ]] && ALX_DEFAULT_HOSTNAME="$(< /etc/hostname)" |
162 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
163 |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
164 |
|
|
181 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
182 |
|
|
183 |
# abort now if this is a forced re-check |
# abort now if this is a forced re-check |
184 |
if [ -f /hardware-auto-detection ] |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
185 |
then |
then |
186 |
# but first check the serial |
# but first check the serial |
187 |
source /etc/alxconfig-ng/serial |
source /etc/alxconfig-ng/serial |
206 |
|
|
207 |
# write current state to temp file |
# write current state to temp file |
208 |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
209 |
rm /hardware-auto-detection |
[ -f /hardware-auto-detection ] && rm /hardware-auto-detection |
210 |
|
|
211 |
# now export ALX_FORCED_RECHECK=true |
# now export ALX_FORCED_RECHECK=true |
212 |
# that the setting will be updated not inserted ! |
# that the setting will be updated not inserted ! |
216 |
|
|
217 |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
218 |
|
|
|
# request new serial |
|
|
# ALX_REG_DATE="$(date +%F)" |
|
|
|
|
|
# we're using the mtime now (better for validating the serial) |
|
|
# mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "insert into client_serials( |
|
|
# mtime, |
|
|
# mac |
|
|
# ) |
|
|
# values( |
|
|
# '${CUR_MTIME}', |
|
|
# '${CUR_MAC}' |
|
|
# );" |
|
|
# |
|
|
# # then validate and retrieve serial |
|
|
# |
|
|
# ### warning must be changed that only the LAST ID will be fetched, ### |
|
|
# ### or you get error if the computer name and date are the same ### |
|
|
# ### you have more than one serial number then ### |
|
|
# |
|
|
# # select highest id only (added max) |
|
|
# ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'") |
|
|
|
|
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 ]] |
224 |
then |
then |
225 |
# nice serial output |
# nice serial output |
226 |
$CURS_UP |
$CURS_UP |
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 |
|
|
258 |
check_is_configured() { |
check_is_configured() |
259 |
|
{ |
260 |
if [ -f /etc/alxconfig-ng/state/configured ] |
if [ -f /etc/alxconfig-ng/state/configured ] |
261 |
then |
then |
262 |
export ALX_CONFIGURED=true |
export ALX_CONFIGURED=true |
267 |
|
|
268 |
|
|
269 |
# imports current settings to the database resolved by the hardware detection |
# imports current settings to the database resolved by the hardware detection |
270 |
import_settings_to_db() { |
import_settings_to_db() |
271 |
|
{ |
272 |
# note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
273 |
# note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
274 |
|
|
290 |
|
|
291 |
# network |
# network |
292 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
293 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
294 |
"insert into cfg_network( |
then |
295 |
hostname, |
# get settings |
296 |
serial, |
#source ${rc_base}/init.d/network &> /dev/null |
297 |
module, |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
298 |
domain, |
do |
299 |
networking |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
300 |
) |
echo "WARNING: only importing settings for interface [ ${iface} ] !" |
301 |
values( |
source ${network_settings}/net.${iface} || exit 1 |
302 |
'${ALX_DEFAULT_HOSTNAME}', |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
303 |
'${ALX_SERIAL}', |
|
304 |
'${NETCARD_DRIVER}', |
mysqldo "insert into cfg_network( |
305 |
'${ALX_DEFAULT_DOMAIN}', |
hostname, |
306 |
'dhcp' |
serial, |
307 |
);" |
module, |
308 |
|
domain, |
309 |
|
networking, |
310 |
|
netmask, |
311 |
|
dns, |
312 |
|
gateway, |
313 |
|
broadcast, |
314 |
|
ip, |
315 |
|
forcemacto, |
316 |
|
wireless_bitrate, |
317 |
|
wireless_channel, |
318 |
|
wireless_essid, |
319 |
|
wireless_frequency, |
320 |
|
wireless_mode, |
321 |
|
wireless_nick, |
322 |
|
wireless_auth_mode, |
323 |
|
wireless_key_length, |
324 |
|
wireless_key, |
325 |
|
wireless_key_ascii |
326 |
|
) |
327 |
|
values( |
328 |
|
'${ALX_DEFAULT_HOSTNAME}', |
329 |
|
'${ALX_SERIAL}', |
330 |
|
'${NETCARD_DRIVER}', |
331 |
|
'${ALX_DEFAULT_DOMAIN}', |
332 |
|
'${NETWORKING}', |
333 |
|
'${NETMASK}', |
334 |
|
'${NAMESERVER}', |
335 |
|
'${GATEWAY}', |
336 |
|
'${BROADCAST}', |
337 |
|
'${IP}', |
338 |
|
'${FORCE_MAC_TO}', |
339 |
|
'${WIRELESS_BITRATE}', |
340 |
|
'${WIRELESS_CHANNEL}', |
341 |
|
'${WIRELESS_ESSID}', |
342 |
|
'${WIRELESS_FREQUENCY}', |
343 |
|
'${WIRELESS_MODE}', |
344 |
|
'${WIRELESS_NICK}', |
345 |
|
'${WIRELESS_AUTH_MODE}', |
346 |
|
'${WIRELESS_KEY_LENGTH}', |
347 |
|
'${WIRELESS_KEY}', |
348 |
|
'${WIRELESS_KEY_ASCII}' |
349 |
|
);" |
350 |
|
|
351 |
|
# only insert the *FIRST* iface |
352 |
|
break |
353 |
|
done |
354 |
|
else |
355 |
|
mysqldo "insert into cfg_network( |
356 |
|
hostname, |
357 |
|
serial, |
358 |
|
module, |
359 |
|
domain, |
360 |
|
networking |
361 |
|
) |
362 |
|
values( |
363 |
|
'${ALX_DEFAULT_HOSTNAME}', |
364 |
|
'${ALX_SERIAL}', |
365 |
|
'${NETCARD_DRIVER}', |
366 |
|
'${ALX_DEFAULT_DOMAIN}', |
367 |
|
'dhcp' |
368 |
|
);" |
369 |
|
fi |
370 |
evaluate_retval |
evaluate_retval |
371 |
|
|
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 |
|
|
433 |
# imports current settings to the database resolved by the hardware detection |
# imports current settings to the database resolved by the hardware detection |
434 |
update_settings_in_db() { |
update_settings_in_db() |
435 |
|
{ |
436 |
# note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
437 |
# note: default_domain/hostname is set in config.rc or exported |
# note: default_domain/hostname is set in config.rc or exported |
438 |
# note: we updating only hardware settings here ! |
# note: we updating only hardware settings here ! |
455 |
|
|
456 |
# network |
# network |
457 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
458 |
|
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
459 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
then |
460 |
"update cfg_network set |
# get settings |
461 |
hostname='${ALX_DEFAULT_HOSTNAME}', |
#source ${rc_base}/init.d/network &> /dev/null |
462 |
module='${NETCARD_DRIVER}', |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
463 |
domain='${ALX_DEFAULT_DOMAIN}', |
do |
464 |
networking='dhcp' |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
465 |
where serial=${ALX_SERIAL};" |
echo "WARNING: only importing settings for interface [ ${iface} ] !" |
466 |
|
source ${network_settings}/net.${iface} || exit 1 |
467 |
|
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
468 |
|
|
469 |
|
mysqldo "update cfg_network set |
470 |
|
hostname='${ALX_DEFAULT_HOSTNAME}', |
471 |
|
module='${NETCARD_DRIVER}', |
472 |
|
domain='${ALX_DEFAULT_DOMAIN}', |
473 |
|
networking='${NETWORKING}', |
474 |
|
netmask='${NETMASK}', |
475 |
|
dns='${NAMESERVER}', |
476 |
|
gateway='${GATEWAY}', |
477 |
|
broadcast='${BROADCAST}', |
478 |
|
ip='${IP}', |
479 |
|
forcemacto='${FORCE_MAC_TO}', |
480 |
|
wireless_bitrate='${WIRELESS_BITRATE}', |
481 |
|
wireless_channel='${WIRELESS_CHANNEL}', |
482 |
|
wireless_essid='${WIRELESS_ESSID}', |
483 |
|
wireless_frequency='${WIRELESS_FREQUENCY}', |
484 |
|
wireless_mode='${WIRELESS_MODE}', |
485 |
|
wireless_nick='${WIRELESS_NICK}', |
486 |
|
wireless_auth_mode='${WIRELESS_AUTH_MODE}', |
487 |
|
wireless_key_length='${WIRELESS_KEY_LENGTH}', |
488 |
|
wireless_key='${WIRELESS_KEY}', |
489 |
|
wireless_key_ascii='${WIRELESS_KEY_ASCII}' |
490 |
|
where serial=${ALX_SERIAL};" |
491 |
|
|
492 |
|
# only insert the *FIRST* iface |
493 |
|
break |
494 |
|
done |
495 |
|
else |
496 |
|
mysqldo "update cfg_network set |
497 |
|
hostname='${ALX_DEFAULT_HOSTNAME}', |
498 |
|
module='${NETCARD_DRIVER}', |
499 |
|
domain='${ALX_DEFAULT_DOMAIN}', |
500 |
|
networking='dhcp' |
501 |
|
where serial=${ALX_SERIAL};" |
502 |
|
fi |
503 |
evaluate_retval |
evaluate_retval |
504 |
|
|
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 |
|
|
522 |
# imports current settings to the local system resolved by the hardware detection |
# imports current settings to the local system resolved by the hardware detection |
523 |
# we only need the network settings |
# we only need the network settings |
524 |
import_settings_local(){ |
import_settings_local() |
525 |
|
{ |
526 |
# note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
527 |
# note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
528 |
|
|
541 |
echo |
echo |
542 |
echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} |
543 |
|
|
544 |
[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} |
if [[ ${ALX_CONFD_NETWORKING} = false ]] |
545 |
echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules |
then |
546 |
evaluate_retval |
#[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} |
547 |
|
#echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules |
548 |
|
|
549 |
|
# set an device alias for modprobe.conf |
550 |
|
[ ! -d /etc/modules.d ] && install -d /etc/modules.d |
551 |
|
echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modules.d/net.eth0 |
552 |
|
|
553 |
|
# regenerate modprobe.conf |
554 |
|
[ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf" |
555 |
|
evaluate_retval |
556 |
|
fi |
557 |
|
|
558 |
# set system state to 'already configured' |
# set system state to 'already configured' |
559 |
touch /etc/alxconfig-ng/state/configured |
touch /etc/alxconfig-ng/state/configured |
571 |
cat ${ALX_SKELETONS}/fluxbox/init \ |
cat ${ALX_SKELETONS}/fluxbox/init \ |
572 |
> ${ALX_UNPRIV_HOME}/.fluxbox/init |
> ${ALX_UNPRIV_HOME}/.fluxbox/init |
573 |
|
|
574 |
|
# fluxbox autostart |
575 |
|
cat ${ALX_SKELETONS}/fluxbox/apps \ |
576 |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/apps |
577 |
|
|
578 |
# fluxbox menu header |
# fluxbox menu header |
579 |
cat ${ALX_SKELETONS}/fluxbox/menu.header \ |
cat ${ALX_SKELETONS}/fluxbox/menu.header \ |
580 |
> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
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 |
641 |
preliminary_network(){ |
preliminary_network() |
642 |
|
{ |
643 |
local module |
local module |
644 |
|
|
645 |
if [ -f /etc/alxconfig-ng/state/configured ] |
if [ -f /etc/alxconfig-ng/state/configured ] |
646 |
then |
then |
647 |
# get module name |
# compat for old clients |
648 |
module=$(cat ${SETTINGSPATH}/modules) |
if [ -f ${SETTINGSPATH}/modules ] |
649 |
modprobe ${module} |
then |
650 |
|
# get module name |
651 |
|
module=$(cat ${SETTINGSPATH}/modules) |
652 |
|
modprobe ${module} |
653 |
|
fi |
654 |
else |
else |
655 |
# vars used by hwdetect |
# vars used by hwdetect |
656 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
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 ]] && [[ ${RUNLEVEL} != S ]] && \ |
678 |
|
${rc_base}/init.d/network stop |
679 |
|
|
680 |
echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} |
|
# -t 10 timeout of 10 secs |
|
|
dhcpcd -t 10 &> /dev/null |
|
|
|
|
|
# aka_fix ######################################## |
|
|
#ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up |
|
|
#route del default gw 128.20.50.13 &> /dev/null |
|
|
#route add default gw 128.20.50.21 &> /dev/null |
|
|
#echo "nameserver 128.20.50.21" > /etc/resolv.conf |
|
|
################################################## |
|
681 |
|
|
682 |
evaluate_retval |
# start network configured from /etc/conf.d |
683 |
|
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
684 |
|
then |
685 |
|
${rc_base}/init.d/network start |
686 |
|
else |
687 |
|
echo -e ${COLOREDSTAR}"Starting default dhcp based networking ... "${COLDEFAULT} |
688 |
|
# -t 10 timeout of 10 secs |
689 |
|
dhcpcd -t 10 &> /dev/null |
690 |
|
evaluate_retval |
691 |
|
fi |
692 |
;; |
;; |
693 |
|
|
694 |
stop) |
stop) |
695 |
echo -e ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Stopping preliminary networking ... "${COLDEFAULT} |
696 |
ifconfig eth0 down |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
697 |
|
then |
698 |
|
${rc_base}/init.d/network stop |
699 |
|
else |
700 |
|
echo -e ${COLOREDSTAR}"Stopping default dhcp based networking ... "${COLDEFAULT} |
701 |
|
ifconfig eth0 down |
702 |
|
fi |
703 |
if ps -A|grep dhcpcd > /dev/null |
if ps -A|grep dhcpcd > /dev/null |
704 |
then |
then |
705 |
dhcpcd -z &> /dev/null |
dhcpcd -z &> /dev/null |
713 |
esac |
esac |
714 |
} |
} |
715 |
|
|
716 |
|
reset_system_settings() |
717 |
|
{ |
718 |
|
# force load of de kbdkeys |
719 |
|
loadkeys -q de |
720 |
|
echo |
721 |
|
echo -en ${COLRED} |
722 |
|
echo -n "*** Warning: you are about to reset *all* local settings on this system!" |
723 |
|
echo -e ${COLDEFAULT} |
724 |
|
echo "*** Do you really want to continue ?" |
725 |
|
echo -n "*** Enter 'yes' to continue, anything else to abort: " |
726 |
|
read kbinsert |
727 |
|
if [[ ${kbinsert} = yes ]] |
728 |
|
then |
729 |
|
echo -en ${COLRED} |
730 |
|
echo -n "*** OK, you really want it ... killing all settings: " |
731 |
|
for i in 3 2 1 now |
732 |
|
do |
733 |
|
echo -n " ${i}" |
734 |
|
sleep 1 |
735 |
|
done |
736 |
|
echo -e ${COLDEFAULT} |
737 |
|
|
738 |
|
## reset all settings: |
739 |
|
rm -rf ${SETTINGSPATH}/* |
740 |
|
rm -f /etc/alxconfig-ng/serial |
741 |
|
rm -rf /etc/alxconfig-ng/state |
742 |
|
|
743 |
|
# clear all printers & net-shares |
744 |
|
:> /etc/cups/printers.conf |
745 |
|
:> /etc/samba/smb.conf |
746 |
|
|
747 |
|
# remove inetd, cups & smb from init |
748 |
|
rc-config del inetd &> /dev/null |
749 |
|
rc-config del cups &> /dev/null |
750 |
|
rc-config del samba &> /dev/null |
751 |
|
|
752 |
|
# remove all user settings |
753 |
|
[ -d ${ALX_UNPRIV_HOME} ] && rm -rf ${ALX_UNPRIV_HOME} |
754 |
|
|
755 |
|
# remove all ica-sessions |
756 |
|
find ${ALX_ICA_SESSIONS} -type -f -name '*.ica' | xargs rm |
757 |
|
|
758 |
|
# remove all old nics and modules configs |
759 |
|
find /etc/conf.d -type f -name 'net.*' | xargs rm |
760 |
|
find /etc/modules.d -type f -name 'net.*' | xargs rm |
761 |
|
|
762 |
|
# restore default networking |
763 |
|
cat ${ALX_SKELETONS}/net/net.eth0 > /etc/conf.d/net.eth0 |
764 |
|
|
765 |
|
echo "I am done now, press [Enter] to reboot system ..." |
766 |
|
else |
767 |
|
echo "Aborted, press [Enter] to reboot system ..." |
768 |
|
fi |
769 |
|
read |
770 |
|
reboot |
771 |
|
} |
772 |
|
|
773 |
|
onboot_interface_list() |
774 |
|
{ |
775 |
|
local file |
776 |
|
local devices |
777 |
|
local iface |
778 |
|
|
779 |
|
# get list of all devices |
780 |
|
for file in $@ |
781 |
|
do |
782 |
|
if [[ $(read_value ONBOOT ${file}) = yes ]] |
783 |
|
then |
784 |
|
iface="$(basename ${file} | sed s/net.//)" |
785 |
|
# exclude backup files |
786 |
|
case "${iface}" in |
787 |
|
*~) ;; |
788 |
|
*) devices="${devices} $(basename ${file} | sed s/net.//)" ;; |
789 |
|
esac |
790 |
|
fi |
791 |
|
done |
792 |
|
|
793 |
|
echo "${devices}" |
794 |
|
} |
795 |
|
|
796 |
|
# read values from net.* files |
797 |
|
read_value() |
798 |
|
{ |
799 |
|
local var="$1" |
800 |
|
local file="$2" |
801 |
|
local value |
802 |
|
|
803 |
|
# local all possible vars |
804 |
|
# global |
805 |
|
local ONBOOT |
806 |
|
local NETWORKING |
807 |
|
|
808 |
|
# static |
809 |
|
local IP |
810 |
|
local NETMASK |
811 |
|
local BROADCAST |
812 |
|
local NETWORKING |
813 |
|
local FORCE_MAC_TO |
814 |
|
|
815 |
|
# dhcp |
816 |
|
local DHCP_PROG |
817 |
|
local DHCP_START |
818 |
|
local DHCP_STOP |
819 |
|
|
820 |
|
# default gw |
821 |
|
local GATEWAY |
822 |
|
local GATEWAY_IF |
823 |
|
|
824 |
|
# wireless extensions |
825 |
|
local WIRELESS_AP |
826 |
|
local WIRELESS_AUTH_MODE |
827 |
|
local WIRELESS_BITRATE |
828 |
|
local WIRELESS_CHANNEL |
829 |
|
local WIRELESS_DEFAULT_KEY |
830 |
|
local WIRELESS_ESSID |
831 |
|
local WIRELESS_FREQUENCY |
832 |
|
local WIRELESS_KEY |
833 |
|
local WIRELESS_KEY_ASCII |
834 |
|
local WIRELESS_KEY_0 |
835 |
|
local WIRELESS_KEY_1 |
836 |
|
local WIRELESS_KEY_2 |
837 |
|
local WIRELESS_KEY_3 |
838 |
|
local WIRELESS_KEY_LENGTH |
839 |
|
local WIRELESS_MODE |
840 |
|
local WIRELESS_NICK |
841 |
|
local WIRELESS_NWID |
842 |
|
local WIRELESS_POWER |
843 |
|
|
844 |
|
source ${file} |
845 |
|
eval value=\$$(echo ${var}) |
846 |
|
echo "${value}" |
847 |
|
} |
848 |
|
|
849 |
case $1 in |
case $1 in |
850 |
start) |
start) |
851 |
|
# check for global overrides |
852 |
|
[ -f ${SETTINGSPATH}/confd-networking ] && ALX_CONFD_NETWORKING=true |
853 |
|
[ -f /hardware-auto-detection ] && ALX_FORCED_RECHECK=true |
854 |
|
read_cmdline hardware-auto-detection && ALX_FORCED_RECHECK=true |
855 |
|
read_cmdline alx-reset-settings && ALX_RESET_SETTINGS=true |
856 |
|
|
857 |
|
# kill all settings if requested |
858 |
|
if [[ ${ALX_RESET_SETTINGS} = true ]] |
859 |
|
then |
860 |
|
reset_system_settings |
861 |
|
fi |
862 |
|
|
863 |
# retrieve or validate current serial |
# retrieve or validate current serial |
864 |
get_system_serial |
get_system_serial |
865 |
if [[ ${ALX_HW_DETECT} = true ]] |
if [[ ${ALX_HW_DETECT} = true ]] |
880 |
|
|
881 |
# now setup system configuration |
# now setup system configuration |
882 |
# alx_setup_or_whatever_it_will_be_called() |
# alx_setup_or_whatever_it_will_be_called() |
883 |
[ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
[[ ${ALX_HW_DETECT} = false ]] && update_system_settings |
884 |
|
|
885 |
# stop at last the preliminary networking (dhcp) |
# stop at last the preliminary networking (dhcp) |
886 |
preliminary_network stop |
preliminary_network stop |