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.13 2008-06-07 18:25:00 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 |
38 |
source /usr/lib/alxconfig-ng/functions/config_auth |
source /usr/lib/alxconfig-ng/functions/config_auth |
39 |
source /usr/lib/alxconfig-ng/functions/config_ssh_auth |
source /usr/lib/alxconfig-ng/functions/config_ssh_auth |
40 |
|
|
|
# check if mysql is available |
|
|
[ -x /usr/bin/mysql ] && MYSQL_ALX=true |
|
|
|
|
41 |
# other needed vars |
# other needed vars |
42 |
ALX_HW_DETECT=false |
ALX_HW_DETECT=false |
43 |
ALX_FORCED_RECHECK=false |
ALX_FORCED_RECHECK=false |
44 |
ALX_RESET_SETTINGS=false |
ALX_RESET_SETTINGS=false |
|
ALX_CONFD_NETWORKING=false |
|
45 |
|
|
46 |
# unset vars which may kill us |
# unset vars which may kill us |
47 |
unset ALX_SERIAL ALX_STATE |
unset ALX_SERIAL ALX_STATE |
95 |
{ |
{ |
96 |
local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE |
local CUR_IP CUR_MAC CUR_MTIME ALX_IFACE |
97 |
|
|
|
if [[ -f ${SETTINGSPATH}/confd-networking ]] |
|
|
then |
|
|
ALX_IFACE="$(< ${SETTINGSPATH}/confd-networking)" |
|
|
else |
|
|
ALX_IFACE="eth0" |
|
|
fi |
|
|
|
|
98 |
# check if serial file exists |
# check if serial file exists |
99 |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
if [ -f /etc/alxconfig-ng/serial ] && [[ ${ALX_FORCED_RECHECK} = false ]] |
100 |
then |
then |
628 |
reboot |
reboot |
629 |
} |
} |
630 |
|
|
|
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}" |
|
|
} |
|
|
|
|
631 |
case $1 in |
case $1 in |
632 |
start) |
start) |
633 |
# check for global overrides |
# check for global overrides |
|
[ -f ${SETTINGSPATH}/confd-networking ] && ALX_CONFD_NETWORKING=true |
|
634 |
[ -f /hardware-auto-detection ] && ALX_FORCED_RECHECK=true |
[ -f /hardware-auto-detection ] && ALX_FORCED_RECHECK=true |
635 |
read_cmdline hardware-auto-detection && ALX_FORCED_RECHECK=true |
read_cmdline hardware-auto-detection && ALX_FORCED_RECHECK=true |
636 |
read_cmdline alx-reset-settings && ALX_RESET_SETTINGS=true |
read_cmdline alx-reset-settings && ALX_RESET_SETTINGS=true |