11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/init.d/alxsettings,v 1.9 2008-06-05 17:17:49 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/tinyalxconfig-ng/init.d/alxsettings,v 1.14 2008-06-08 10:05:01 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 |
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 |
39 |
source /usr/lib/alxconfig-ng/functions/config_auth |
source /usr/lib/alxconfig-ng/functions/config_auth |
40 |
source /usr/lib/alxconfig-ng/functions/config_ssh_auth |
source /usr/lib/alxconfig-ng/functions/config_ssh_auth |
41 |
|
|
|
# check if mysql is available |
|
|
[ -x /usr/bin/mysql ] && MYSQL_ALX=true |
|
|
|
|
42 |
# other needed vars |
# other needed vars |
43 |
ALX_HW_DETECT=false |
ALX_HW_DETECT=false |
44 |
ALX_FORCED_RECHECK=false |
ALX_FORCED_RECHECK=false |
45 |
ALX_RESET_SETTINGS=false |
ALX_RESET_SETTINGS=false |
|
ALX_CONFD_NETWORKING=false |
|
46 |
|
|
47 |
# unset vars which may kill us |
# unset vars which may kill us |
48 |
unset ALX_SERIAL ALX_STATE |
unset ALX_SERIAL ALX_STATE |
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 |
99 |
{ |
{ |
100 |
local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE |
local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE |
101 |
|
|
|
if [[ -f ${SETTINGSPATH}/confd-networking ]] |
|
|
then |
|
|
ALX_IFACE="$(< ${SETTINGSPATH}/confd-networking)" |
|
|
else |
|
|
ALX_IFACE="eth0" |
|
|
fi |
|
|
|
|
102 |
# check if serial file exists |
# check if serial file exists |
103 |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
104 |
then |
then |
632 |
reboot |
reboot |
633 |
} |
} |
634 |
|
|
|
onboot_interface_list() |
|
|
{ |
|
|
local file |
|
|
local devices |
|
|
local iface |
|
|
|
|
|
# get list of all devices |
|
|
for file in $@ |
|
|
do |
|
|
if [[ $(read_value ONBOOT ${file}) = yes ]] |
|
|
then |
|
|
iface="$(basename ${file} | sed s/net.//)" |
|
|
# exclude backup files |
|
|
case "${iface}" in |
|
|
*~) ;; |
|
|
*) devices="${devices} $(basename ${file} | sed s/net.//)" ;; |
|
|
esac |
|
|
fi |
|
|
done |
|
|
|
|
|
echo "${devices}" |
|
|
} |
|
|
|
|
|
# read values from net.* files |
|
|
read_value() |
|
|
{ |
|
|
local var="$1" |
|
|
local file="$2" |
|
|
local value |
|
|
|
|
|
# local all possible vars |
|
|
# global |
|
|
local ONBOOT |
|
|
local NETWORKING |
|
|
|
|
|
# static |
|
|
local IP |
|
|
local NETMASK |
|
|
local BROADCAST |
|
|
local NETWORKING |
|
|
local FORCE_MAC_TO |
|
|
|
|
|
# dhcp |
|
|
local DHCP_PROG |
|
|
local DHCP_START |
|
|
local DHCP_STOP |
|
|
|
|
|
# default gw |
|
|
local GATEWAY |
|
|
local GATEWAY_IF |
|
|
|
|
|
# wireless extensions |
|
|
local WIRELESS_AP |
|
|
local WIRELESS_AUTH_MODE |
|
|
local WIRELESS_BITRATE |
|
|
local WIRELESS_CHANNEL |
|
|
local WIRELESS_DEFAULT_KEY |
|
|
local WIRELESS_ESSID |
|
|
local WIRELESS_FREQUENCY |
|
|
local WIRELESS_KEY |
|
|
local WIRELESS_KEY_ASCII |
|
|
local WIRELESS_KEY_0 |
|
|
local WIRELESS_KEY_1 |
|
|
local WIRELESS_KEY_2 |
|
|
local WIRELESS_KEY_3 |
|
|
local WIRELESS_KEY_LENGTH |
|
|
local WIRELESS_MODE |
|
|
local WIRELESS_NICK |
|
|
local WIRELESS_NWID |
|
|
local WIRELESS_POWER |
|
|
|
|
|
source ${file} |
|
|
eval value=\$$(echo ${var}) |
|
|
echo "${value}" |
|
|
} |
|
|
|
|
635 |
case $1 in |
case $1 in |
636 |
start) |
start) |
637 |
# check for global overrides |
# check for global overrides |
|
[ -f ${SETTINGSPATH}/confd-networking ] && ALX_CONFD_NETWORKING=true |
|
638 |
[ -f /hardware-auto-detection ] && ALX_FORCED_RECHECK=true |
[ -f /hardware-auto-detection ] && ALX_FORCED_RECHECK=true |
639 |
read_cmdline hardware-auto-detection && ALX_FORCED_RECHECK=true |
read_cmdline hardware-auto-detection && ALX_FORCED_RECHECK=true |
640 |
read_cmdline alx-reset-settings && ALX_RESET_SETTINGS=true |
read_cmdline alx-reset-settings && ALX_RESET_SETTINGS=true |