11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.21 2005-09-01 18:30:28 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.22 2005-09-22 22:14:38 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 |
|
|
101 |
local CUR_IP CUR_MAC CUR_MTIME |
local CUR_IP CUR_MAC CUR_MTIME |
102 |
|
|
103 |
# check if serial file exists |
# check if serial file exists |
104 |
if [ -f /etc/alxconfig-ng/serial ] && [ ! -f /hardware-auto-detection ] |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
105 |
then |
then |
106 |
source /etc/alxconfig-ng/serial |
source /etc/alxconfig-ng/serial |
107 |
|
|
141 |
else |
else |
142 |
# run hardware detection |
# run hardware detection |
143 |
echo |
echo |
144 |
if [ -f /hardware-auto-detection ] |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
145 |
then |
then |
146 |
echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
147 |
else |
else |
152 |
|
|
153 |
# set hostname to alx_default_hostname |
# set hostname to alx_default_hostname |
154 |
# use old hostname if this is a forced re-check |
# use old hostname if this is a forced re-check |
155 |
[ -f /hardware-auto-detection ] && ALX_DEFAULT_HOSTNAME="$(< /etc/hostname)" |
[[ ${ALX_FORCED_RECHECK} = true ]] && ALX_DEFAULT_HOSTNAME="$(< /etc/hostname)" |
156 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
157 |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
158 |
|
|
175 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
176 |
|
|
177 |
# abort now if this is a forced re-check |
# abort now if this is a forced re-check |
178 |
if [ -f /hardware-auto-detection ] |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
179 |
then |
then |
180 |
# but first check the serial |
# but first check the serial |
181 |
source /etc/alxconfig-ng/serial |
source /etc/alxconfig-ng/serial |
200 |
|
|
201 |
# write current state to temp file |
# write current state to temp file |
202 |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
203 |
rm /hardware-auto-detection |
[ -f /hardware-auto-detection ] && rm /hardware-auto-detection |
204 |
|
|
205 |
# now export ALX_FORCED_RECHECK=true |
# now export ALX_FORCED_RECHECK=true |
206 |
# that the setting will be updated not inserted ! |
# that the setting will be updated not inserted ! |
210 |
|
|
211 |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
212 |
|
|
|
# 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}'") |
|
|
|
|
213 |
# 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) |
214 |
ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
215 |
"insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); |
"insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); |
216 |
select last_insert_id();") |
select last_insert_id();") |
217 |
|
|
218 |
if [ "${ALX_SERIAL}" != NULL ] |
if [[ ${ALX_SERIAL} != NULL ]] |
219 |
then |
then |
220 |
# nice serial output |
# nice serial output |
221 |
$CURS_UP |
$CURS_UP |
249 |
} |
} |
250 |
|
|
251 |
|
|
252 |
check_is_configured() { |
check_is_configured() |
253 |
|
{ |
254 |
if [ -f /etc/alxconfig-ng/state/configured ] |
if [ -f /etc/alxconfig-ng/state/configured ] |
255 |
then |
then |
256 |
export ALX_CONFIGURED=true |
export ALX_CONFIGURED=true |
261 |
|
|
262 |
|
|
263 |
# imports current settings to the database resolved by the hardware detection |
# imports current settings to the database resolved by the hardware detection |
264 |
import_settings_to_db() { |
import_settings_to_db() |
265 |
|
{ |
266 |
# note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
267 |
# note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
268 |
|
|
284 |
|
|
285 |
# network |
# network |
286 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
287 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
288 |
"insert into cfg_network( |
then |
289 |
hostname, |
# get settings |
290 |
serial, |
#source ${rc_base}/init.d/network &> /dev/null |
291 |
module, |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
292 |
domain, |
do |
293 |
networking |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
294 |
) |
echo "WARNING: only importing settings for interface [ ${iface} ] !" |
295 |
values( |
source ${network_settings}/net.${iface} || exit 1 |
296 |
'${ALX_DEFAULT_HOSTNAME}', |
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
297 |
'${ALX_SERIAL}', |
|
298 |
'${NETCARD_DRIVER}', |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
299 |
'${ALX_DEFAULT_DOMAIN}', |
"insert into cfg_network( |
300 |
'dhcp' |
hostname, |
301 |
);" |
serial, |
302 |
|
module, |
303 |
|
domain, |
304 |
|
networking, |
305 |
|
netmask, |
306 |
|
dns, |
307 |
|
gateway, |
308 |
|
broadcast, |
309 |
|
ip, |
310 |
|
forcemacto, |
311 |
|
wireless_bitrate, |
312 |
|
wireless_channel, |
313 |
|
wireless_essid, |
314 |
|
wireless_frequency, |
315 |
|
wireless_mode, |
316 |
|
wireless_nick, |
317 |
|
wireless_auth_mode, |
318 |
|
wireless_key_length, |
319 |
|
wireless_key, |
320 |
|
wireless_key_ascii |
321 |
|
) |
322 |
|
values( |
323 |
|
'${ALX_DEFAULT_HOSTNAME}', |
324 |
|
'${ALX_SERIAL}', |
325 |
|
'${NETCARD_DRIVER}', |
326 |
|
'${ALX_DEFAULT_DOMAIN}', |
327 |
|
'${NETWORKING}', |
328 |
|
'${NETMASK}', |
329 |
|
'${NAMESERVER}', |
330 |
|
'${GATEWAY}', |
331 |
|
'${BROADCAST}', |
332 |
|
'${IP}', |
333 |
|
'${FORCE_MAC_TO}', |
334 |
|
'${WIRELESS_BITRATE}', |
335 |
|
'${WIRELESS_CHANNEL}', |
336 |
|
'${WIRELESS_ESSID}', |
337 |
|
'${WIRELESS_FREQUENCY}', |
338 |
|
'${WIRELESS_MODE}', |
339 |
|
'${WIRELESS_NICK}', |
340 |
|
'${WIRELESS_AUTH_MODE}', |
341 |
|
'${WIRELESS_KEY_LENGTH}', |
342 |
|
'${WIRELESS_KEY}', |
343 |
|
'${WIRELESS_KEY_ASCII}' |
344 |
|
);" |
345 |
|
|
346 |
|
# only insert the *FIRST* iface |
347 |
|
break |
348 |
|
done |
349 |
|
else |
350 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
351 |
|
"insert into cfg_network( |
352 |
|
hostname, |
353 |
|
serial, |
354 |
|
module, |
355 |
|
domain, |
356 |
|
networking |
357 |
|
) |
358 |
|
values( |
359 |
|
'${ALX_DEFAULT_HOSTNAME}', |
360 |
|
'${ALX_SERIAL}', |
361 |
|
'${NETCARD_DRIVER}', |
362 |
|
'${ALX_DEFAULT_DOMAIN}', |
363 |
|
'dhcp' |
364 |
|
);" |
365 |
|
fi |
366 |
evaluate_retval |
evaluate_retval |
367 |
|
|
368 |
# xserver |
# xserver |
426 |
} |
} |
427 |
|
|
428 |
# imports current settings to the database resolved by the hardware detection |
# imports current settings to the database resolved by the hardware detection |
429 |
update_settings_in_db() { |
update_settings_in_db() |
430 |
|
{ |
431 |
# note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
432 |
# note: default_domain/hostname is set in config.rc or exported |
# note: default_domain/hostname is set in config.rc or exported |
433 |
# note: we updating only hardware settings here ! |
# note: we updating only hardware settings here ! |
450 |
|
|
451 |
# network |
# network |
452 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
453 |
|
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
454 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
then |
455 |
"update cfg_network set |
# get settings |
456 |
hostname='${ALX_DEFAULT_HOSTNAME}', |
#source ${rc_base}/init.d/network &> /dev/null |
457 |
module='${NETCARD_DRIVER}', |
for iface in $(onboot_interface_list ${network_settings}/net.*) |
458 |
domain='${ALX_DEFAULT_DOMAIN}', |
do |
459 |
networking='dhcp' |
[[ $(< ${SETTINGSPATH}/confd-networking) != ${iface} ]] && continue |
460 |
where serial=${ALX_SERIAL};" |
echo "WARNING: only importing settings for interface [ ${iface} ] !" |
461 |
|
source ${network_settings}/net.${iface} || exit 1 |
462 |
|
NETCARD_DRIVER="$(cat /etc/modules.d/net.${iface} | cut -d' ' -f3)" |
463 |
|
|
464 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
465 |
|
"update cfg_network set |
466 |
|
hostname='${ALX_DEFAULT_HOSTNAME}', |
467 |
|
module='${NETCARD_DRIVER}', |
468 |
|
domain='${ALX_DEFAULT_DOMAIN}', |
469 |
|
networking='${NETWORKING}', |
470 |
|
netmask='${NETMASK}', |
471 |
|
dns='${NAMESERVER}', |
472 |
|
gateway='${GATEWAY}', |
473 |
|
broadcast='${BROADCAST}', |
474 |
|
ip='${IP}', |
475 |
|
forcemacto='${FORCE_MAC_TO}', |
476 |
|
wireless_bitrate='${WIRELESS_BITRATE}', |
477 |
|
wireless_channel='${WIRELESS_CHANNEL}', |
478 |
|
wireless_essid='${WIRELESS_ESSID}', |
479 |
|
wireless_frequency='${WIRELESS_FREQUENCY}', |
480 |
|
wireless_mode='${WIRELESS_MODE}', |
481 |
|
wireless_nick='${WIRELESS_NICK}', |
482 |
|
wireless_auth_mode='${WIRELESS_AUTH_MODE}', |
483 |
|
wireless_key_length='${WIRELESS_KEY_LENGTH}', |
484 |
|
wireless_key='${WIRELESS_KEY}', |
485 |
|
wireless_key_ascii='${WIRELESS_KEY_ASCII}' |
486 |
|
where serial=${ALX_SERIAL};" |
487 |
|
|
488 |
|
# only insert the *FIRST* iface |
489 |
|
break |
490 |
|
done |
491 |
|
else |
492 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
493 |
|
"update cfg_network set |
494 |
|
hostname='${ALX_DEFAULT_HOSTNAME}', |
495 |
|
module='${NETCARD_DRIVER}', |
496 |
|
domain='${ALX_DEFAULT_DOMAIN}', |
497 |
|
networking='dhcp' |
498 |
|
where serial=${ALX_SERIAL};" |
499 |
|
fi |
500 |
evaluate_retval |
evaluate_retval |
501 |
|
|
502 |
# xserver |
# xserver |
521 |
} |
} |
522 |
|
|
523 |
# imports current settings to the local system resolved by the hardware detection |
# imports current settings to the local system resolved by the hardware detection |
524 |
# we only need the network settings |
# we only need the network settings |
525 |
import_settings_local(){ |
import_settings_local() |
526 |
|
{ |
527 |
# note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
528 |
# note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
529 |
|
|
542 |
echo |
echo |
543 |
echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} |
544 |
|
|
545 |
[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} |
if [[ ${ALX_CONFD_NETWORKING} = false ]] |
546 |
echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules |
then |
547 |
evaluate_retval |
#[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} |
548 |
|
#echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules |
549 |
|
|
550 |
|
# set an device alias for modprobe.conf |
551 |
|
[ ! -d /etc/modules.d ] && install -d /etc/modules.d |
552 |
|
echo "alias eth0 ${NETCARD_DRIVER}" > /etc/modules.d/net.eth0 |
553 |
|
|
554 |
|
# regenerate modprobe.conf |
555 |
|
[ -x $(which modules-update) ] && modules-update || echo "cannot regen modprobe.conf" |
556 |
|
evaluate_retval |
557 |
|
fi |
558 |
|
|
559 |
# set system state to 'already configured' |
# set system state to 'already configured' |
560 |
touch /etc/alxconfig-ng/state/configured |
touch /etc/alxconfig-ng/state/configured |
644 |
} |
} |
645 |
|
|
646 |
# start|stop |
# start|stop |
647 |
preliminary_network(){ |
preliminary_network() |
648 |
|
{ |
649 |
local module |
local module |
650 |
|
|
651 |
if [ -f /etc/alxconfig-ng/state/configured ] |
if [ -f /etc/alxconfig-ng/state/configured ] |
652 |
then |
then |
653 |
# get module name |
# compat for old clients |
654 |
module=$(cat ${SETTINGSPATH}/modules) |
if [ -f ${SETTINGSPATH}/modules ] |
655 |
modprobe ${module} |
then |
656 |
|
# get module name |
657 |
|
module=$(cat ${SETTINGSPATH}/modules) |
658 |
|
modprobe ${module} |
659 |
|
fi |
660 |
else |
else |
661 |
# vars used by hwdetect |
# vars used by hwdetect |
662 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
680 |
else |
else |
681 |
rm -f /var/run/dhcpcd-eth?.pid |
rm -f /var/run/dhcpcd-eth?.pid |
682 |
fi |
fi |
683 |
|
[[ ${ALX_CONFD_NETWORKING} = true ]] && ${rc_base}/init.d/network stop |
684 |
|
|
|
echo -e ${COLMAGENTA}"Starting preliminary network ... "${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 |
|
|
################################################## |
|
685 |
|
|
686 |
evaluate_retval |
echo -e ${COLMAGENTA}"Starting preliminary networking ... "${COLDEFAULT} |
687 |
|
|
688 |
|
# start network configured from /etc/conf.d |
689 |
|
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
690 |
|
then |
691 |
|
${rc_base}/init.d/network start |
692 |
|
else |
693 |
|
echo -e ${COLOREDSTAR}"Starting default dhcp based networking ... "${COLDEFAULT} |
694 |
|
# -t 10 timeout of 10 secs |
695 |
|
dhcpcd -t 10 &> /dev/null |
696 |
|
evaluate_retval |
697 |
|
fi |
698 |
;; |
;; |
699 |
|
|
700 |
stop) |
stop) |
701 |
echo -e ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Stopping preliminary networking ... "${COLDEFAULT} |
702 |
ifconfig eth0 down |
if [[ ${ALX_CONFD_NETWORKING} = true ]] |
703 |
|
then |
704 |
|
${rc_base}/init.d/network stop |
705 |
|
else |
706 |
|
echo -e ${COLOREDSTAR}"Stopping default dhcp based networking ... "${COLDEFAULT} |
707 |
|
ifconfig eth0 down |
708 |
|
fi |
709 |
if ps -A|grep dhcpcd > /dev/null |
if ps -A|grep dhcpcd > /dev/null |
710 |
then |
then |
711 |
dhcpcd -z &> /dev/null |
dhcpcd -z &> /dev/null |
719 |
esac |
esac |
720 |
} |
} |
721 |
|
|
722 |
|
reset_system_settings() |
723 |
|
{ |
724 |
|
# force load of de kbdkeys |
725 |
|
loadkeys -q de |
726 |
|
echo |
727 |
|
echo -en ${COLRED} |
728 |
|
echo -n "*** Warning: you are about to reset *all* local settings on this system!" |
729 |
|
echo -e ${COLDEFAULT} |
730 |
|
echo "*** Do you really want to continue ?" |
731 |
|
echo -n "*** Enter 'yes' to continue, anything else to abort: " |
732 |
|
read kbinsert |
733 |
|
if [[ ${kbinsert} = yes ]] |
734 |
|
then |
735 |
|
echo -en ${COLRED} |
736 |
|
echo -n "*** OK, you really want it ... killing all settings: " |
737 |
|
for i in 3 2 1 now |
738 |
|
do |
739 |
|
echo -n " ${i}" |
740 |
|
sleep 1 |
741 |
|
done |
742 |
|
echo -e ${COLDEFAULT} |
743 |
|
|
744 |
|
## reset all settings: |
745 |
|
rm -rf ${SETTINGSPATH}/* |
746 |
|
rm -f /etc/alxconfig-ng/serial |
747 |
|
rm -rf /etc/alxconfig-ng/state |
748 |
|
|
749 |
|
echo "I am done now, press [Enter] to reboot system ..." |
750 |
|
read |
751 |
|
reboot |
752 |
|
fi |
753 |
|
} |
754 |
|
|
755 |
|
onboot_interface_list() |
756 |
|
{ |
757 |
|
local file |
758 |
|
local devices |
759 |
|
local iface |
760 |
|
|
761 |
|
# get list of all devices |
762 |
|
for file in $@ |
763 |
|
do |
764 |
|
if [[ $(read_value ONBOOT ${file}) = yes ]] |
765 |
|
then |
766 |
|
iface="$(basename ${file} | sed s/net.//)" |
767 |
|
# exclude backup files |
768 |
|
case "${iface}" in |
769 |
|
*~) ;; |
770 |
|
*) devices="${devices} $(basename ${file} | sed s/net.//)" ;; |
771 |
|
esac |
772 |
|
fi |
773 |
|
done |
774 |
|
|
775 |
|
echo "${devices}" |
776 |
|
} |
777 |
|
|
778 |
|
# read values from files |
779 |
|
read_value() |
780 |
|
{ |
781 |
|
local var="$1" |
782 |
|
local file="$2" |
783 |
|
local value |
784 |
|
|
785 |
|
# local all possible vars |
786 |
|
# global |
787 |
|
local ONBOOT |
788 |
|
local NETWORKING |
789 |
|
|
790 |
|
# static |
791 |
|
local IP |
792 |
|
local NETMASK |
793 |
|
local BROADCAST |
794 |
|
local NETWORKING |
795 |
|
local FORCE_MAC_TO |
796 |
|
|
797 |
|
# dhcp |
798 |
|
local DHCP_PROG |
799 |
|
local DHCP_START |
800 |
|
local DHCP_STOP |
801 |
|
|
802 |
|
# default gw |
803 |
|
local GATEWAY |
804 |
|
local GATEWAY_IF |
805 |
|
|
806 |
|
# wireless extensions |
807 |
|
local WIRELESS_AP |
808 |
|
local WIRELESS_AUTH_MODE |
809 |
|
local WIRELESS_BITRATE |
810 |
|
local WIRELESS_CHANNEL |
811 |
|
local WIRELESS_DEFAULT_KEY |
812 |
|
local WIRELESS_ESSID |
813 |
|
local WIRELESS_FREQUENCY |
814 |
|
local WIRELESS_KEY |
815 |
|
local WIRELESS_KEY_ASCII |
816 |
|
local WIRELESS_KEY_0 |
817 |
|
local WIRELESS_KEY_1 |
818 |
|
local WIRELESS_KEY_2 |
819 |
|
local WIRELESS_KEY_3 |
820 |
|
local WIRELESS_KEY_LENGTH |
821 |
|
local WIRELESS_MODE |
822 |
|
local WIRELESS_NICK |
823 |
|
local WIRELESS_NWID |
824 |
|
local WIRELESS_POWER |
825 |
|
|
826 |
|
source ${file} |
827 |
|
eval value=\$$(echo ${var}) |
828 |
|
echo "${value}" |
829 |
|
} |
830 |
|
|
831 |
case $1 in |
case $1 in |
832 |
start) |
start) |
833 |
|
# check for global overrides |
834 |
|
[ -f ${SETTINGSPATH}/confd-networking ] && ALX_CONFD_NETWORKING=true |
835 |
|
[ -f /hardware-auto-detection ] && ALX_FORCED_RECHECK=true |
836 |
|
read_cmdline hardware-auto-detection && ALX_FORCED_RECHECK=true |
837 |
|
read_cmdline alx-reset-settings && ALX_RESET_SETTINGS=true |
838 |
|
|
839 |
|
# kill all settings if requested |
840 |
|
if [[ ${ALX_RESET_SETTINGS} = true ]] |
841 |
|
then |
842 |
|
reset_system_settings |
843 |
|
fi |
844 |
|
|
845 |
# retrieve or validate current serial |
# retrieve or validate current serial |
846 |
get_system_serial |
get_system_serial |
847 |
if [[ ${ALX_HW_DETECT} = true ]] |
if [[ ${ALX_HW_DETECT} = true ]] |