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 $ |
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 |
18 |
# these settings will be used for client setup |
# these settings will be used for client setup |
21 |
# if no changes are at server side they will be kept, if yes the get updated. |
# if no changes are at server side they will be kept, if yes the get updated. |
22 |
# the server settings has higher priority. |
# the server settings has higher priority. |
23 |
|
|
|
# +-----+ |
|
|
# |start| |
|
|
# +-----+ |
|
|
# | |
|
|
# | |
|
|
# start_preliminary_network |
|
|
# | |
|
|
# | n |
|
|
# serial_check -------> get_new_serial |
|
|
# | | |
|
|
# y| | |
|
|
# | n | |
|
|
# check_is_configured ----> run_hw_detection |
|
|
# | | |
|
|
# y| | |
|
|
# n | | |
|
|
# +--------cfg_equal_to_db import_settings_to_db |
|
|
# | | | |
|
|
# update_from_db y| | |
|
|
# | | | |
|
|
# set_is_configured | set_is_configured |
|
|
# +-----------------| | |
|
|
# +----------------------+ |
|
|
# | |
|
|
# | |
|
|
# stop_preliminary_network |
|
|
# | |
|
|
# | |
|
|
# +----+ |
|
|
# |done| |
|
|
# +----+ |
|
|
# | |
|
|
# | |
|
|
# normal_system_bootup |
|
|
# | |
|
|
# . |
|
|
# . |
|
|
# . |
|
|
# |
|
|
# |
|
|
# |
|
|
|
|
24 |
source /etc/sysconfig/rc |
source /etc/sysconfig/rc |
25 |
source $rc_functions |
source $rc_functions |
26 |
|
|
27 |
#mysql settings |
# mysql settings |
28 |
source /etc/alx-config/config.rc |
source /etc/alxconfig-ng/config.rc |
29 |
source /opt/alx-config/functions/mysqlfunctions |
|
30 |
source /opt/alx-config/functions/alx-mysql-functions |
# helper functions |
31 |
|
source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
32 |
|
source /usr/lib/alxconfig-ng/functions/serial_functions |
33 |
|
source /usr/lib/alxconfig-ng/functions/config_modules |
34 |
|
source /usr/lib/alxconfig-ng/functions/config_network |
35 |
|
source /usr/lib/alxconfig-ng/functions/config_printers |
36 |
|
source /usr/lib/alxconfig-ng/functions/config_sessions |
37 |
|
source /usr/lib/alxconfig-ng/functions/config_x11 |
38 |
|
source /usr/lib/alxconfig-ng/functions/config_auth |
39 |
|
source /usr/lib/alxconfig-ng/functions/config_ssh_auth |
40 |
|
|
41 |
#check if mysql is available |
# check if mysql is available |
42 |
[ -x /usr/bin/mysql ] && MYSQL_ALX=true |
[ -x /usr/bin/mysql ] && MYSQL_ALX=true |
43 |
|
|
44 |
#other needed vars |
# other needed vars |
45 |
ALX_HW_DETECT=false |
ALX_HW_DETECT=false |
46 |
ALX_NETWORK_SETUP=false |
ALX_FORCED_RECHECK=false |
|
ALX_XSERVER_SETUP=false |
|
|
ALX_SESSION_SETUP=false |
|
|
ALX_PRINTER_SETUP=false |
|
47 |
|
|
48 |
#unset vars which may kill us |
# unset vars which may kill us |
49 |
unset ALX_SERIAL ALX_STATE |
unset ALX_SERIAL ALX_STATE |
50 |
|
|
51 |
|
|
52 |
#setup needed directories |
# setup needed directories |
53 |
[ ! -d /etc/alx-config/state ] && install -d /etc/alx-config/state |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
|
|
|
|
|
|
|
# still a need to implement this ? |
|
|
# #needed to detect usb/livecd boot |
|
|
# if [ -e /.bootdev ] |
|
|
# then |
|
|
# source /.bootdev |
|
|
# else |
|
|
# echo "Couldn't find /.bootdev. Aborting." |
|
|
# exit 1 |
|
|
# fi |
|
|
|
|
|
# still a need to implement this ? --> media-check ? |
|
|
settings_import() { |
|
|
if [ "${FSTYPE}" == "vfat" ] |
|
|
then |
|
|
if [ -e /mnt/cdrom/settings/system ] |
|
|
then |
|
|
echo -e ${COLOREDSTAR}"Importing old alx-settings ..." |
|
|
( cp -R /mnt/cdrom/settings/system/* /etc/alx-config/settings/menu && |
|
|
source /etc/alx-config/config.rc && |
|
|
source /opt/alx-config/Configurator/config_functions.sh && |
|
|
setup_xfree > /dev/null 2>&1 && |
|
|
setup_modules > /dev/null 2>&1 && |
|
|
setup_network > /dev/null 2>&1 && |
|
|
#setup_printers > /dev/null 2>&1 && |
|
|
setup_sessions > /dev/null 2>&1 && |
|
|
touch /etc/alx-config/imported ) |
|
|
evaluate_retval |
|
|
fi |
|
|
fi |
|
|
} |
|
|
|
|
54 |
|
|
|
# this thingy needs an complete rewrite. |
|
|
# first get all settings from db server, |
|
|
# than check against local system settings, |
|
|
# if there are any differences, update the local settings, |
|
|
# as the server has a higher priority. |
|
|
# Important: write local settings only if they make sense, |
|
|
# to have a fallback in case the server is down! |
|
|
#get_settings_from_server(){ |
|
|
# #some needed arrays |
|
|
# #ARRAY_NETWORK #module domain networking netmask dns gateway |
|
|
# #SESSION # |
|
|
# #GRAFIK # |
|
|
# |
|
|
# echo "Importing now old Settings ..." |
|
|
# |
|
|
# local serial module domain networking netmask dns gateway i x all |
|
|
# |
|
|
# declare -i i=0 |
|
|
# |
|
|
# #get hostname from database |
|
|
# MY_HOSTNAME=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select hostname from cfg_serial where id='${ALX_SERIAL}'") |
|
|
# |
|
|
# #get network settings from database |
|
|
# all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select module, |
|
|
# domain, |
|
|
# networking, |
|
|
# netmask, |
|
|
# dns, |
|
|
# gateway, |
|
|
# broadcast, |
|
|
# ip |
|
|
# from cfg_network where serial='${ALX_SERIAL}'") |
|
|
# #split'em up and put in array |
|
|
# for x in ${all} |
|
|
# do |
|
|
# ARRAY_NETWORK[${i}]=${x} |
|
|
# ((i++)) |
|
|
# done |
|
|
# echo " Network:" |
|
|
# echo " MODULE: ${ARRAY_NETWORK[0]}" |
|
|
# echo " IP: ${ARRAY_NETWORK[7]}" |
|
|
# echo " HOSTNAME: ${MY_HOSTNAME}" |
|
|
# echo " DOMAIN: ${ARRAY_NETWORK[1]}" |
|
|
# echo " NETWORKING: ${ARRAY_NETWORK[2]}" |
|
|
# echo " NETMASK: ${ARRAY_NETWORK[3]}" |
|
|
# echo " DNS: ${ARRAY_NETWORK[4]}" |
|
|
# echo " GATEWAY: ${ARRAY_NETWORK[5]}" |
|
|
# echo " BROADCAST: ${ARRAY_NETWORK[6]}" |
|
|
# echo |
|
|
# |
|
|
# #get x settings from database |
|
|
# local module resolution |
|
|
# |
|
|
# #reset i |
|
|
# declare -i i=0 |
|
|
# all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select module, |
|
|
# resolution |
|
|
# from cfg_grafik where serial='${ALX_SERIAL}'") |
|
|
# #split'em up and put in array |
|
|
# for x in ${all} |
|
|
# do |
|
|
# ARRAY_GRAFIK[${i}]=${x} |
|
|
# ((i++)) |
|
|
# done |
|
|
# |
|
|
# echo " VGA:" |
|
|
# echo " MODULE: ${ARRAY_GRAFIK[0]}" |
|
|
# echo " RESOLUTION: ${ARRAY_GRAFIK[1]}" |
|
|
# echo |
|
|
# |
|
|
# #get ica-sessions from database |
|
|
# ARRAY_SESSIONS=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select session from cfg_session where serial='${ALX_SERIAL}'") |
|
|
# |
|
|
# echo " SESSIONS:" |
|
|
# declare -i i=0 |
|
|
# for x in ${ARRAY_SESSIONS} |
|
|
# do |
|
|
# ((i++)) |
|
|
# echo " SESSION${i}: ${x}" |
|
|
# done |
|
|
# echo |
|
|
# |
|
|
# #now write these settings |
|
|
# local SETTINGSPATH |
|
|
# |
|
|
# #network |
|
|
# |
|
|
# #settings must be also set on system, so we put this to menu |
|
|
# SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
# |
|
|
# [ ! -d ${SETTINGSPATH}/modules ] && install -d ${SETTINGSPATH}/modules |
|
|
# echo "${ARRAY_NETWORK[0]}" > ${SETTINGSPATH}/modules/modules |
|
|
# |
|
|
# [ ! -d ${SETTINGSPATH}/network ] && install -d ${SETTINGSPATH}/network |
|
|
# echo "${MY_HOSTNAME}" > ${SETTINGSPATH}/network/hostname |
|
|
# echo "${ARRAY_NETWORK[1]}" > ${SETTINGSPATH}/network/domain |
|
|
# echo "${ARRAY_NETWORK[2]}" > ${SETTINGSPATH}/network/networking |
|
|
# [ -n "${ARRAY_NETWORK[3]}" ] && echo "${ARRAY_NETWORK[3]}" > ${SETTINGSPATH}/network/netmask |
|
|
# [ -n "${ARRAY_NETWORK[4]}" ] && echo "${ARRAY_NETWORK[4]}" > ${SETTINGSPATH}/network/dns |
|
|
# [ -n "${ARRAY_NETWORK[5]}" ] && echo "${ARRAY_NETWORK[5]}" > ${SETTINGSPATH}/network/gateway |
|
|
# [ -n "${ARRAY_NETWORK[6]}" ] && echo "${ARRAY_NETWORK[6]}" > ${SETTINGSPATH}/network/broadcast |
|
|
# [ -n "${ARRAY_NETWORK[7]}" ] && echo "${ARRAY_NETWORK[7]}" > ${SETTINGSPATH}/network/ip |
|
|
|
|
|
|
|
|
validate_networking(){ |
|
|
#source /opt/alx-config/Configurator/config_functions.sh |
|
|
|
|
|
local x i all LOCAL_NETWORK DB_NETWORK SETTINGSPATH |
|
|
|
|
|
#all arrays: |
|
|
# -> hostname modules domain networking ip netmask dns gateway broadcast |
|
|
|
|
|
#networking |
|
|
#get settings from local system |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/system |
|
|
declare -i i=0 |
|
|
for x in network/hostname \ |
|
|
modules/modules \ |
|
|
network/domain \ |
|
|
network/networking \ |
|
|
network/ip \ |
|
|
network/netmask \ |
|
|
network/dns \ |
|
|
network/gateway \ |
|
|
network/broadcast |
|
|
do |
|
|
if [ -f ${SETTINGSPATH}/${x} ] |
|
|
then |
|
|
#file exist, then use content |
|
|
LOCAL_NETWORK[${i}]="$(< ${SETTINGSPATH}/${x})" |
|
|
else |
|
|
LOCAL_NETWORK[${i}]="" |
|
|
fi |
|
|
((i++)) |
|
|
done |
|
|
|
|
|
#get settings from database |
|
|
# DB_NETWORK[0]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select hostname from cfg_network where serial='${ALX_SERIAL}'") |
|
|
|
|
|
all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"select hostname, |
|
|
module, |
|
|
domain, |
|
|
networking, |
|
|
ip, |
|
|
netmask, |
|
|
dns, |
|
|
gateway, |
|
|
broadcast |
|
|
from cfg_network where serial='${ALX_SERIAL}'") |
|
|
|
|
|
#split'em up and put in an array |
|
|
declare -i i=0 |
|
|
for x in ${all} |
|
|
do |
|
|
DB_NETWORK[${i}]=${x} |
|
|
((i++)) |
|
|
done |
|
|
|
|
|
#needed by the small hotfix |
|
|
local FIX_ME |
|
|
FIX_ME="${DB_NETWORK[2]}" |
|
|
|
|
|
|
|
|
#now compare this stuff if they are equal |
|
|
for ((i=0; i < 9; i++)) |
|
|
do |
|
|
if [ "${DB_NETWORK[${i}]}" = "${LOCAL_NETWORK[${i}]}" ] |
|
|
then |
|
|
echo "${i}: ${DB_NETWORK[${i}]} == ${LOCAL_NETWORK[${i}]}" |
|
|
|
|
|
#delete equal stuff from DB_NETWORK |
|
|
DB_NETWORK[${i}]="*NULL*" |
|
|
|
|
|
else |
|
|
echo "${i}: ${DB_NETWORK[${i}]} != ${LOCAL_NETWORK[${i}]}" |
|
|
fi |
|
|
done |
|
|
|
|
|
|
|
|
#update configs |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
declare -i i=0 |
|
|
for x in network/hostname \ |
|
|
modules/modules \ |
|
|
network/domain \ |
|
|
network/networking \ |
|
|
network/ip \ |
|
|
network/netmask \ |
|
|
network/dns \ |
|
|
network/gateway \ |
|
|
network/broadcast |
|
|
do |
|
|
#update only staff wich wasn't overwritten |
|
|
if [ "${DB_NETWORK[${i}]}" != "*NULL*" ] |
|
|
then |
|
|
#create directory if not exist |
|
|
if [ ! -d $(dirname ${SETTINGSPATH}/${x}) ] |
|
|
then |
|
|
install -d $(dirname ${SETTINGSPATH}/${x}) |
|
|
fi |
|
|
echo "${DB_NETWORK[${i}]}" > ${SETTINGSPATH}/${x} |
|
|
|
|
|
# theses fucking config functions: |
|
|
# network gets only updated, |
|
|
# if ${SETTINGS_TEMPLATE}/menu/network/networking exist |
|
|
# so we force an update here |
|
|
if [ ! -f ${SETTINGSPATH}/network/networking ] |
|
|
then |
|
|
[ ! -d ${SETTINGSPATH}/network ] && install -d ${SETTINGSPATH}/network |
|
|
echo "${FIX_ME}" > ${SETTINGSPATH}/network/networking |
|
|
fi |
|
|
|
|
|
#set update flag |
|
|
ALX_NETWORK_SETUP=true |
|
|
fi |
|
|
((i++)) |
|
|
done |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
validate_xserver(){ |
|
|
#source /opt/alx-config/Configurator/config_functions.sh |
|
|
|
|
|
local x i all LOCAL_XSERVER DB_XSERVER SETTINGSPATH |
|
|
|
|
|
#all arrays: |
|
|
# -> xmodule resolution depth mouse monvendor monmodel hsync vref |
|
|
|
|
|
#xserver |
|
|
#get settings from local system |
|
|
#vga |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/system |
|
|
declare -i i=0 |
|
|
for x in vga/vga \ |
|
|
vga/vgares \ |
|
|
vga/vgadepth |
|
|
do |
|
|
if [ -f ${SETTINGSPATH}/${x} ] |
|
|
then |
|
|
#file exist, then use content |
|
|
LOCAL_XSERVER[${i}]="$(< ${SETTINGSPATH}/${x})" |
|
|
else |
|
|
LOCAL_XSERVER[${i}]="" |
|
|
fi |
|
|
((i++)) |
|
|
done |
|
|
|
|
|
#mouse |
|
|
if [ -f ${SETTINGSPATH}/mouse/mouse ] |
|
|
then |
|
|
#file exist, then use content |
|
|
LOCAL_XSERVER[3]="$(< ${SETTINGSPATH}/mouse/mouse)" |
|
|
else |
|
|
LOCAL_XSERVER[3]="" |
|
|
fi |
|
|
|
|
|
#monitor |
|
|
local myvendor mymodel hsync vref |
|
|
if [ -f ${SETTINGSPATH}/monitor/monitor ] |
|
|
then |
|
|
source ${SETTINGSPATH}/monitor/monitor |
|
|
|
|
|
declare -i i=4 |
|
|
for x in "${myvendor}" \ |
|
|
"${mymodel}" \ |
|
|
"${hsync}" \ |
|
|
"${vref}" |
|
|
do |
|
|
LOCAL_XSERVER[${i}]="${x}" |
|
|
((i++)) |
|
|
done |
|
|
else |
|
|
LOCAL_XSERVER[4]="" |
|
|
LOCAL_XSERVER[5]="" |
|
|
LOCAL_XSERVER[6]="" |
|
|
LOCAL_XSERVER[7]="" |
|
|
fi |
|
|
|
|
|
|
|
|
#get settings from database |
|
|
all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"select module, |
|
|
resolution, |
|
|
depth |
|
|
from cfg_graphic where serial='${ALX_SERIAL}'") |
|
|
|
|
|
#split'em up and put in an array |
|
|
declare -i i=0 |
|
|
for x in ${all} |
|
|
do |
|
|
DB_XSERVER[${i}]=${x} |
|
|
((i++)) |
|
|
done |
|
|
|
|
|
# read mouse |
|
|
DB_XSERVER[3]=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"select mouse from cfg_input where serial='${ALX_SERIAL}'") |
|
|
|
|
|
#monitors |
|
|
# all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select vendor, |
|
|
# model, |
|
|
# hsync, |
|
|
# vrefresh |
|
|
# from cfg_monitor where serial='${ALX_SERIAL}'") |
|
|
|
|
|
all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"select vendor, |
|
|
model, |
|
|
hsync, |
|
|
vrefresh |
|
|
from list_monitors |
|
|
inner join cfg_graphic |
|
|
on cfg_graphic.monitorid=list_monitors.id;") |
|
|
|
|
|
#split'em up and put in an array |
|
|
declare -i i=4 |
|
|
for x in ${all} |
|
|
do |
|
|
DB_XSERVER[${i}]=${x} |
|
|
((i++)) |
|
|
done |
|
|
|
|
|
# #now compare this stuff if they are equal |
|
|
# for ((i=0; i < 8; i++)) |
|
|
# do |
|
|
# if [ "${DB_XSERVER[${i}]}" = "${LOCAL_XSERVER[${i}]}" ] |
|
|
# then |
|
|
# echo "${i}: ${DB_XSERVER[${i}]} == ${LOCAL_XSERVER[${i}]}" |
|
|
# |
|
|
# #delete equal stuff from DB_NETWORK |
|
|
# DB_XSERVER[${i}]="*NULL*" |
|
|
# |
|
|
# else |
|
|
# echo "${i}: ${DB_XSERVER[${i}]} != ${LOCAL_XSERVER[${i}]}" |
|
|
# fi |
|
|
# done |
|
|
# |
|
|
# |
|
|
# #update configs |
|
|
# SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
# #xserver general |
|
|
# declare -i i=0 |
|
|
# for x in vga/vga \ |
|
|
# vga/vgares \ |
|
|
# vga/vgadepth \ |
|
|
# mouse/mouse |
|
|
# do |
|
|
# #update only staff wich wasn't overwritten |
|
|
# if [ "${DB_XSERVER[${i}]}" != "*NULL*" ] |
|
|
# then |
|
|
# #create directory if not exist |
|
|
# if [ ! -d $(dirname ${SETTINGSPATH}/${x}) ] |
|
|
# then |
|
|
# install -d $(dirname ${SETTINGSPATH}/${x}) |
|
|
# fi |
|
|
# echo "${DB_XSERVER[${i}]}" > ${SETTINGSPATH}/${x} |
|
|
# #set update flag |
|
|
# ALX_XSERVER_SETUP=true |
|
|
# fi |
|
|
# ((i++)) |
|
|
# done |
|
|
# |
|
|
# #xserver monitors |
|
|
# if [ "${DB_XSERVER[4]}" != "*NULL*" \ |
|
|
# -o "${DB_XSERVER[5]}" != "*NULL*" \ |
|
|
# -o "${DB_XSERVER[6]}" != "*NULL*" \ |
|
|
# -o "${DB_XSERVER[7]}" != "*NULL*" ] |
|
|
# then |
|
|
# if [ ! -d ${SETTINGSPATH}/monitor ] |
|
|
# then |
|
|
# install -d ${SETTINGSPATH}/monitor |
|
|
# fi |
|
|
# echo "myvendor=\"${DB_XSERVER[4]}\"" > ${SETTINGSPATH}/monitor/monitor |
|
|
# echo "mymodel=\"${DB_XSERVER[5]}\"" >> ${SETTINGSPATH}/monitor/monitor |
|
|
# echo "hsync=\"${DB_XSERVER[6]}\"" >> ${SETTINGSPATH}/monitor/monitor |
|
|
# echo "vref=\"${DB_XSERVER[7]}\"" >> ${SETTINGSPATH}/monitor/monitor |
|
|
# |
|
|
# #set update flag |
|
|
# ALX_XSERVER_SETUP=true |
|
|
# fi |
|
|
|
|
|
# - damn fucking setup_xfree routine need to rewrite this fucking stuff - |
|
|
# setup_xfree will only run |
|
|
# if ${SETTINGS_TEMPLATE}/menu/vga/vga exist |
|
|
# so we must *always* update *all* settings if something has changed |
|
|
|
|
|
#now compare this stuff if they are equal |
|
|
for ((i=0; i < 8; i++)) |
|
|
do |
|
|
if [ "${DB_XSERVER[${i}]}" = "${LOCAL_XSERVER[${i}]}" ] |
|
|
then |
|
|
echo "${i}: ${DB_XSERVER[${i}]} == ${LOCAL_XSERVER[${i}]}" |
|
|
|
|
|
#delete equal stuff from DB_NETWORK |
|
|
#DB_XSERVER[${i}]="*NULL*" |
|
|
|
|
|
else |
|
|
echo "${i}: ${DB_XSERVER[${i}]} != ${LOCAL_XSERVER[${i}]}" |
|
|
fi |
|
|
done |
|
|
|
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
if [ "${DB_XSERVER[0]}" != "*NULL*" \ |
|
|
-o "${DB_XSERVER[1]}" != "*NULL*" \ |
|
|
-o "${DB_XSERVER[2]}" != "*NULL*" \ |
|
|
-o "${DB_XSERVER[3]}" != "*NULL*" \ |
|
|
-o "${DB_XSERVER[4]}" != "*NULL*" \ |
|
|
-o "${DB_XSERVER[5]}" != "*NULL*" \ |
|
|
-o "${DB_XSERVER[6]}" != "*NULL*" \ |
|
|
-o "${DB_XSERVER[7]}" != "*NULL*" ] |
|
|
then |
|
|
[ ! -d ${SETTINGSPATH}/vga ] && install -d ${SETTINGSPATH}/vga |
|
|
[ ! -d ${SETTINGSPATH}/mouse ] && install -d ${SETTINGSPATH}/mouse |
|
|
[ ! -d ${SETTINGSPATH}/monitor ] && install -d ${SETTINGSPATH}/monitor |
|
|
|
|
|
echo "${DB_XSERVER[0]}" > ${SETTINGSPATH}/vga/vga |
|
|
echo "${DB_XSERVER[1]}" > ${SETTINGSPATH}/vga/vgares |
|
|
echo "${DB_XSERVER[2]}" > ${SETTINGSPATH}/vga/vgadepth |
|
|
echo "${DB_XSERVER[3]}" > ${SETTINGSPATH}/mouse/mouse |
|
|
|
|
|
echo "myvendor=\"${DB_XSERVER[4]}\"" > ${SETTINGSPATH}/monitor/monitor |
|
|
echo "mymodel=\"${DB_XSERVER[5]}\"" >> ${SETTINGSPATH}/monitor/monitor |
|
|
echo "hsync=\"${DB_XSERVER[6]}\"" >> ${SETTINGSPATH}/monitor/monitor |
|
|
echo "vref=\"${DB_XSERVER[7]}\"" >> ${SETTINGSPATH}/monitor/monitor |
|
|
|
|
|
#set update flag |
|
|
ALX_XSERVER_SETUP=true |
|
|
fi |
|
|
} |
|
55 |
|
|
56 |
|
update_system_settings(){ |
57 |
|
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
58 |
|
|
59 |
validate_sessions(){ |
# get the modules settings |
60 |
#source /opt/alx-config/Configurator/config_functions.sh |
# ! is the first thing that must be configured ! |
61 |
|
config_modules |
62 |
|
|
63 |
local x i all LOCAL_SESSIONS DB_SESSIONS SETTINGSPATH count |
# imports network settings from db |
64 |
|
config_networking |
|
#all arrays: |
|
|
# -> session1 session2 ... sessionN |
|
|
|
|
|
|
|
|
#no LOCAL_SESSIONS here, needs bubblesort |
|
|
|
|
|
#get settings from database |
|
|
all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"select session from cfg_sessions where serial='${ALX_SERIAL}'") |
|
|
|
|
|
#split'em up and put in an array (only if $all not zero) |
|
|
declare -i i=0 |
|
|
if [ -n "${all}" ] |
|
|
then |
|
|
for x in ${all} |
|
|
do |
|
|
DB_SESSIONS[${i}]=${x} |
|
|
((i++)) |
|
|
done |
|
|
count=${i} |
|
|
else |
|
|
count=0 |
|
|
fi |
|
|
|
|
|
## no compare here, can only done with bubblesort or s.th like that |
|
|
# shows only the new sessions |
|
|
declare -i i=0 |
|
|
#count=${#DB_SESSIONS[*]} #---> not working gets always 1, why ? |
|
|
|
|
|
echo "Number of new sessions: ${count}" |
|
|
for ((i=0; i < count; i++)) |
|
|
do |
|
|
echo "${i} - ${DB_SESSIONS[${i}]}" |
|
|
done |
|
|
|
|
|
#update local configs |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
declare -i i=0 |
|
|
|
|
|
#count=${#DB_SESSIONS[*]} |
|
|
|
|
|
if [ ${count} -gt 0 ] |
|
|
then |
|
|
#create directory if not exist |
|
|
[ ! -d ${SETTINGSPATH}/sessions ] && install -d ${SETTINGSPATH}/sessions |
|
|
|
|
|
#delete old sessions |
|
|
echo -n > ${SETTINGSPATH}/sessions/sessions |
|
|
|
|
|
for ((i=0; i < count; i++)) |
|
|
do |
|
|
echo "${DB_SESSIONS[${i}]}" >> ${SETTINGSPATH}/sessions/sessions |
|
|
done |
|
|
|
|
|
#set update flag |
|
|
ALX_SESSION_SETUP=true |
|
|
fi |
|
|
} |
|
65 |
|
|
66 |
|
# imports x11 settings from db |
67 |
|
config_x11 |
68 |
|
|
69 |
validate_printing(){ |
# imports session settings from db |
70 |
#source /opt/alx-config/Configurator/config_functions.sh |
config_sessions |
71 |
|
|
72 |
local x i k all LOCAL_PRINTER DB_PRINTER SETTINGSPATH count |
# imports printer settings from db |
73 |
|
config_printing |
|
#all arrays: [2 dimensions !] |
|
|
# -> name1 name2 ... nameN |
|
|
# -> name1 printingport ip share |
|
|
|
|
|
#later on, for now -> name1 port1 ip1 share1 name2 .... |
|
|
# seperator is 4 |
|
|
|
|
|
#local PRINTERNAME PRINTING IP SHARE |
|
|
|
|
|
# update *always* printers from database; |
|
|
# compare with local settings cannot be done yet |
|
|
|
|
|
#get settings from database |
|
|
all=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"select printer_name, |
|
|
port, |
|
|
ip, |
|
|
share |
|
|
from cfg_printers where serial='${ALX_SERIAL}'") |
|
|
|
|
|
#split'em up and put in an array |
|
|
declare -i i=0 |
|
|
declare -i k=0 |
|
|
|
|
|
if [ -n "${all}" ] |
|
|
then |
|
|
for x in ${all} |
|
|
do |
|
|
((k++)) |
|
|
DB_PRINTER[${i}]="${DB_PRINTER[${i}]} ${x}" |
|
|
if [ ${k} -eq 4 ] |
|
|
then |
|
|
((i++)) |
|
|
#reset $k |
|
|
declare -i k=0 |
|
|
fi |
|
|
done |
|
|
count=${i} |
|
|
else |
|
|
count=0 |
|
|
fi |
|
|
|
|
|
#echo settings |
|
|
echo "Number of new printers: ${count}" |
|
|
for ((i=0; i < count; i++)) |
|
|
do |
|
|
echo "${i} printer:" |
|
|
for x in ${DB_PRINTER[${i}]} |
|
|
do |
|
|
echo " ${x}" |
|
|
done |
|
|
done |
|
|
|
|
|
#import settings (only if counter > 0) |
|
|
local prnset |
|
|
|
|
|
#delete all printers (*always*) |
|
|
if [ -d ${SETTINGS_TEMPLATE}/system/printing ] |
|
|
then |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
[ -d ${SETTINGSPATH}/delete ] && rm -rf ${SETTINGSPATH}/delete |
|
|
install -d ${SETTINGSPATH}/delete |
|
|
mv -f ${SETTINGS_TEMPLATE}/system/printing/* ${SETTINGSPATH}/delete |
|
|
rm -rf ${SETTINGS_TEMPLATE}/system/printing |
|
|
|
|
|
#set update flag (*always*) |
|
|
ALX_PRINTER_SETUP=true |
|
|
fi |
|
|
|
|
|
if [ ${count} -gt 0 ] |
|
|
then |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
|
|
|
[ ! -d ${SETTINGSPATH}/printing ] && install -d ${SETTINGSPATH}/printing |
|
|
for ((i=0; i < count; i++)) |
|
|
do |
|
|
declare -i k=0 |
|
|
for x in ${DB_PRINTER[${i}]} |
|
|
do |
|
|
prnset[${k}]=${x} |
|
|
((k++)) |
|
|
done |
|
|
|
|
|
echo "PRINTERNAME=${prnset[0]}" > ${SETTINGSPATH}/printing/${prnset[0]} |
|
|
echo "PRINTING=${prnset[1]}" >> ${SETTINGSPATH}/printing/${prnset[0]} |
|
|
echo "IP=${prnset[2]}" >> ${SETTINGSPATH}/printing/${prnset[0]} |
|
|
echo "SHARE=${prnset[3]}" >> ${SETTINGSPATH}/printing/${prnset[0]} |
|
|
done |
|
|
|
|
|
#set update flag (*always*) |
|
|
ALX_PRINTER_SETUP=true |
|
|
fi |
|
|
|
|
|
} |
|
74 |
|
|
75 |
update_system_settings(){ |
# imports auth settings from db |
76 |
source /opt/alx-config/Configurator/config_functions.sh |
config_auth |
77 |
|
|
78 |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
# exchange ssh rsa keys |
79 |
|
HOME=/root config_ssh_auth |
|
echo |
|
|
echo "network" |
|
|
validate_networking |
|
|
echo |
|
|
echo "xserver" |
|
|
validate_xserver |
|
|
echo |
|
|
echo "sessions" |
|
|
validate_sessions |
|
|
echo |
|
|
#echo "printers" |
|
|
#validate_printing |
|
|
#echo |
|
|
|
|
|
if [ "${ALX_NETWORK_SETUP}" == "true" ] |
|
|
then |
|
|
echo -e ${COLMAGENTA}"Updating network settings"${COLDEFAULT} |
|
|
setup_modules |
|
|
setup_network |
|
|
fi |
|
|
|
|
|
if [ "${ALX_XSERVER_SETUP}" == "true" ] |
|
|
then |
|
|
echo -e ${COLMAGENTA}"Updating xserver settings"${COLDEFAULT} |
|
|
setup_xfree |
|
|
fi |
|
|
|
|
|
if [ "${ALX_SESSION_SETUP}" == "true" ] |
|
|
then |
|
|
echo -e ${COLMAGENTA}"Updating session settings"${COLDEFAULT} |
|
|
setup_sessions |
|
|
fi |
|
|
|
|
|
#if [ "${ALX_PRINTER_SETUP}" == "true" ] |
|
|
#then |
|
|
# echo -e ${COLMAGENTA}"Updating printer settings"${COLDEFAULT} |
|
|
# setup_printers |
|
|
#fi |
|
|
|
|
|
#clean up temp files |
|
|
local SETTINGSPATH |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/menu |
|
|
#[ -d ${SETTINGSPATH} ] && rm -rf ${SETTINGSPATH} |
|
80 |
} |
} |
81 |
|
|
82 |
get_system_serial(){ |
get_system_serial(){ |
83 |
|
|
84 |
local CUR_IP CUR_MAC CUR_MTIME |
local CUR_IP CUR_MAC CUR_MTIME |
85 |
|
|
86 |
#check if serial file exists |
# check if serial file exists |
87 |
if [ -f /etc/alx-config/serial ] |
if [ -f /etc/alxconfig-ng/serial ] && [ ! -f /hardware-auto-detection ] |
88 |
then |
then |
89 |
source /etc/alx-config/serial |
source /etc/alxconfig-ng/serial |
90 |
|
|
91 |
# if system is already configured, it *has* a hostname. |
# start preliminary networking (dhcp) |
|
# so we take the hostname of this system here |
|
|
source /etc/hostname |
|
|
|
|
|
#start preliminary networking (dhcp) |
|
92 |
preliminary_network start |
preliminary_network start |
93 |
|
|
94 |
|
# check if mysql server is reachable |
95 |
|
# if not abort this script |
96 |
|
if ! reach_mysql_server |
97 |
|
then |
98 |
|
preliminary_network stop |
99 |
|
exit 1 |
100 |
|
fi |
101 |
|
|
102 |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
103 |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
104 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
105 |
|
|
106 |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
107 |
|
|
108 |
#nice serial output |
# nice serial output |
109 |
$CURS_UP |
$CURS_UP |
110 |
$SET_WCOL |
$SET_WCOL |
111 |
echo "[ SN: ${ALX_SERIAL} ]" |
echo "[ SN: ${ALX_SERIAL} ]" |
|
|
|
|
# #is this system outdated ? |
|
|
# #MY_HOSTNAME=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# # "select hostname from cfg_serial where id='${ALX_SERIAL}'") |
|
|
# |
|
|
# #we do this now with the date instead of the hostname |
|
|
# local MY_ALX_REG_DATE |
|
|
# MY_ALX_REG_DATE=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
# "select mtime from client_serial where serial='${ALX_SERIAL}'") |
|
|
# |
|
|
# #if [ "${MY_HOSTNAME}" == "${HOSTNAME}" ] |
|
|
# if [ "${MY_ALX_REG_DATE}" == "${ALX_REG_DATE}" ] |
|
|
# then |
|
|
# #set ALX_STATE to ok so everybody that everything was ok |
|
|
# ALX_STATE=ok |
|
|
# |
|
|
# evaluate_retval |
|
|
# else |
|
|
# #print false (works only if this is the first statement here) |
|
|
# evaluate_retval |
|
|
# |
|
|
# #set ALX_STATE to error so everybody sees there was an error |
|
|
# ALX_STATE=error |
|
|
# fi |
|
112 |
|
|
113 |
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
114 |
then |
then |
115 |
ALX_STATE="ok" |
ALX_STATE="ok" |
116 |
else |
else |
117 |
|
# abort on non valid serial |
118 |
ALX_STATE="invalid serial" |
ALX_STATE="invalid serial" |
119 |
|
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
120 |
|
show_invalid_serial_msg |
121 |
|
exit 1 |
122 |
fi |
fi |
123 |
|
|
124 |
else |
else |
125 |
#run hardware detection |
# run hardware detection |
126 |
echo |
echo |
127 |
echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT} |
if [ -f /hardware-auto-detection ] |
128 |
|
then |
129 |
|
echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
130 |
|
else |
131 |
|
echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT} |
132 |
|
fi |
133 |
ALX_HW_DETECT=true |
ALX_HW_DETECT=true |
134 |
/etc/init.d/hwdetect start |
/etc/init.d/hwdetect start |
135 |
|
|
136 |
#set hostname to alx_default_hostname |
# set hostname to alx_default_hostname |
137 |
|
# use old hostname if this is a forced re-check |
138 |
|
[ -f /hardware-auto-detection ] && ALX_DEFAULT_HOSTNAME="$(< /etc/hostname)" |
139 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
140 |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
141 |
|
|
142 |
#update the hostname on the system for sure |
# update the hostname on the system for sure |
143 |
echo "HOSTNAME=${HOSTNAME}" > /etc/hostname |
echo "${HOSTNAME}" > /etc/hostname |
144 |
|
|
145 |
#start preliminary networking (dhcp) |
# start preliminary networking (dhcp) |
146 |
preliminary_network start |
preliminary_network start |
147 |
|
|
148 |
|
# check if mysql server is reachable |
149 |
|
# if not abort this script |
150 |
|
if ! reach_mysql_server |
151 |
|
then |
152 |
|
preliminary_network stop |
153 |
|
exit 1 |
154 |
|
fi |
155 |
|
|
156 |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
157 |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
158 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
159 |
|
|
160 |
|
# abort now if this is a forced re-check |
161 |
|
if [ -f /hardware-auto-detection ] |
162 |
|
then |
163 |
|
# but first check the serial |
164 |
|
source /etc/alxconfig-ng/serial |
165 |
|
|
166 |
|
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
167 |
|
|
168 |
|
# nice serial output |
169 |
|
$CURS_UP |
170 |
|
$SET_WCOL |
171 |
|
echo "[ SN: ${ALX_SERIAL} ]" |
172 |
|
|
173 |
|
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
174 |
|
then |
175 |
|
ALX_STATE="ok" |
176 |
|
else |
177 |
|
# abort on non valid serial |
178 |
|
ALX_STATE="invalid serial" |
179 |
|
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
180 |
|
show_invalid_serial_msg |
181 |
|
exit 1 |
182 |
|
fi |
183 |
|
|
184 |
|
# write current state to temp file |
185 |
|
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
186 |
|
rm /hardware-auto-detection |
187 |
|
|
188 |
|
# now export ALX_FORCED_RECHECK=true |
189 |
|
# that the setting will be updated not inserted ! |
190 |
|
export ALX_FORCED_RECHECK=true |
191 |
|
return 0 |
192 |
|
fi |
193 |
|
|
194 |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
195 |
|
|
196 |
#request new serial |
# request new serial |
197 |
#ALX_REG_DATE="$(date +%F)" |
# ALX_REG_DATE="$(date +%F)" |
198 |
|
|
199 |
#we're using the mtime now (better for vaildating the serial) |
# we're using the mtime now (better for validating the serial) |
200 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
# mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
201 |
"insert into client_serials( |
# "insert into client_serials( |
202 |
mtime, |
# mtime, |
203 |
mac |
# mac |
204 |
) |
# ) |
205 |
values( |
# values( |
206 |
'${CUR_MTIME}', |
# '${CUR_MTIME}', |
207 |
'${CUR_MAC}' |
# '${CUR_MAC}' |
208 |
);" |
# );" |
209 |
|
# |
210 |
#then validate and retrieve serial |
# # then validate and retrieve serial |
211 |
|
# |
212 |
### warning must be changed that only the LAST ID will be fetched, ### |
# ### warning must be changed that only the LAST ID will be fetched, ### |
213 |
### or you get error if the computer name and date are the same ### |
# ### or you get error if the computer name and date are the same ### |
214 |
### you have more then one serial number than ### |
# ### you have more than one serial number then ### |
215 |
|
# |
216 |
#not 100% working may get more than *one* id |
# # select highest id only (added max) |
217 |
#ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
# ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
218 |
# "select id from cfg_serial where datum='${ALX_REG_DATE}' and hostname='${HOSTNAME}'") |
# "select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'") |
219 |
|
|
220 |
#select highest id only (added max) |
# request a new serial; one command now (cause must be done in the same session) |
221 |
ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
222 |
"select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'") |
"insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}'); |
223 |
|
select last_insert_id();") |
224 |
|
|
225 |
if [ "${ALX_SERIAL}" != NULL ] |
if [ "${ALX_SERIAL}" != NULL ] |
226 |
then |
then |
227 |
#nice serial output |
# nice serial output |
228 |
$CURS_UP |
$CURS_UP |
229 |
$SET_WCOL |
$SET_WCOL |
230 |
echo "[ SN: ${ALX_SERIAL} ]" |
echo "[ SN: ${ALX_SERIAL} ]" |
231 |
|
|
232 |
#set ALX_STATE to ok so everybody that everything was ok |
# set ALX_STATE to ok so everybody that everything was ok |
233 |
ALX_STATE=ok |
ALX_STATE=ok |
234 |
|
|
235 |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alx-config/serial |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial |
236 |
echo "ALX_REG_DATE=${CUR_MTIME}" >> /etc/alx-config/serial |
echo "ALX_REG_DATE=${CUR_MTIME}" >> /etc/alxconfig-ng/serial |
237 |
|
|
238 |
evaluate_retval |
evaluate_retval |
239 |
else |
else |
240 |
#print false (works only if this is the first statement here) |
# print false (works only if this is the first statement here) |
241 |
evaluate_retval |
evaluate_retval |
242 |
|
|
243 |
#set ALX_STATE to error so everybody sees there was an error |
# set ALX_STATE to error so everybody sees there was an error |
244 |
ALX_STATE=error |
ALX_STATE=error |
245 |
|
|
246 |
#show an error that no new serial was found |
# show an error that no new serial was found |
247 |
#nice serial output |
# nice serial output |
248 |
$CURS_UP |
$CURS_UP |
249 |
$SET_WCOL |
$SET_WCOL |
250 |
echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]" |
echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]" |
251 |
fi |
fi |
252 |
fi |
fi |
253 |
|
|
254 |
#write current state to temp file |
# write current state to temp file |
255 |
echo "ALX_STATE=${ALX_STATE}" > /etc/alx-config/state/state |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
256 |
} |
} |
257 |
|
|
258 |
|
|
259 |
check_is_configured() { |
check_is_configured() { |
260 |
if [ -f /etc/alx-config/state/configured ] |
if [ -f /etc/alxconfig-ng/state/configured ] |
261 |
then |
then |
262 |
export ALX_CONFIGURED=true |
export ALX_CONFIGURED=true |
263 |
else |
else |
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 |
#note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
272 |
#note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
273 |
|
|
274 |
#to be safe, we do some sanity checks |
# to be safe, we do some sanity checks |
275 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
276 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
277 |
|
|
278 |
#vars used by hwdetect |
# vars used by hwdetect |
279 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
280 |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
281 |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
282 |
|
|
283 |
#get setting from hwdetect |
# get setting from hwdetect |
284 |
source /etc/sysconfig/hwsetup/knoppix |
source /etc/sysconfig/hwsetup/knoppix |
285 |
source /etc/sysconfig/hwsetup/mouse |
source /etc/sysconfig/hwsetup/mouse |
286 |
|
|
287 |
echo |
echo |
288 |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
289 |
|
|
290 |
#network |
# network |
291 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
292 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
293 |
"insert into cfg_network( |
"insert into cfg_network( |
305 |
'dhcp' |
'dhcp' |
306 |
);" |
);" |
307 |
evaluate_retval |
evaluate_retval |
308 |
|
|
309 |
#xserver |
# xserver |
310 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
311 |
#xserver general |
# xserver general |
312 |
( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
313 |
"insert into cfg_graphic( |
"insert into cfg_graphic( |
314 |
serial, |
serial, |
315 |
module, |
module, |
316 |
resolution, |
resolution, |
317 |
depth |
depth, |
318 |
|
monitorid |
319 |
) |
) |
320 |
values( |
values( |
321 |
'${ALX_SERIAL}', |
'${ALX_SERIAL}', |
322 |
'${XMODULE}', |
'${XMODULE}', |
323 |
'1024x768', |
'1024x768', |
324 |
'16' |
'16', |
325 |
);"; |
'0' |
326 |
#xserver monitor |
);"; ) |
327 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
evaluate_retval |
328 |
"insert into cfg_monitor( |
|
329 |
|
# input |
330 |
|
echo -e " Input settings ..." |
331 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
332 |
|
"insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');" |
333 |
|
evaluate_retval |
334 |
|
|
335 |
|
# auth |
336 |
|
echo -e " Authentifcation settings ..." |
337 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
338 |
|
"insert into client_auth( |
339 |
serial, |
serial, |
340 |
vendor, |
username, |
341 |
model, |
shell, |
342 |
hsync, |
vnc, |
343 |
vrefresh |
samba, |
344 |
|
station |
345 |
) |
) |
346 |
values( |
values( |
347 |
'${ALX_SERIAL}', |
'${ALX_SERIAL}', |
348 |
'Aamazing', |
'${ALX_UNPRIV_USER}', |
349 |
'CM-1528-FS', |
'', |
350 |
'28-64', |
'', |
351 |
'47-104' |
'', |
352 |
);"; |
'' |
353 |
|
);" |
354 |
|
evaluate_retval |
355 |
|
|
356 |
|
# exchange ssh rsa keys - the first boot needs this ! |
357 |
|
# or no reboot will work via the webadmin |
358 |
|
echo -e " SSH authentifcation settings ..." |
359 |
|
HOME=/root config_ssh_auth |
360 |
|
evaluate_retval |
361 |
|
|
362 |
# input |
# input |
363 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
echo -e " Autostart settings ..." |
364 |
"insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');";) |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
365 |
|
"insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" |
366 |
evaluate_retval |
evaluate_retval |
367 |
} |
} |
368 |
|
|
369 |
# imports current settings to the local system resolved by the hardware detection |
# imports current settings to the database resolved by the hardware detection |
370 |
import_settings_local(){ |
update_settings_in_db() { |
371 |
#note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
372 |
#note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc or exported |
373 |
|
# note: we updating only hardware settings here ! |
374 |
#to be safe, we do some sanity checks |
|
375 |
|
# to be safe, we do some sanity checks |
376 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
377 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
378 |
|
|
379 |
#vars used by hwdetect |
# vars used by hwdetect |
380 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
381 |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
382 |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
383 |
|
|
384 |
|
# get setting from hwdetect |
|
#get setting from hwdetect |
|
385 |
source /etc/sysconfig/hwsetup/knoppix |
source /etc/sysconfig/hwsetup/knoppix |
386 |
source /etc/sysconfig/hwsetup/mouse |
source /etc/sysconfig/hwsetup/mouse |
387 |
|
|
388 |
echo |
echo |
389 |
echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT} |
390 |
|
|
391 |
|
# network |
|
#allready configured, no update needed so we put it to system |
|
|
SETTINGSPATH=${SETTINGS_TEMPLATE}/system |
|
|
|
|
|
|
|
|
#network |
|
392 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
393 |
|
|
394 |
[ ! -d ${SETTINGSPATH}/modules ] && install -d ${SETTINGSPATH}/modules |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
395 |
echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules/modules |
"update cfg_network set |
396 |
|
hostname='${ALX_DEFAULT_HOSTNAME}', |
397 |
[ ! -d ${SETTINGSPATH}/network ] && install -d ${SETTINGSPATH}/network |
module='${NETCARD_DRIVER}', |
398 |
( echo "${ALX_DEFAULT_HOSTNAME}" > ${SETTINGSPATH}/network/hostname; |
domain='${ALX_DEFAULT_DOMAIN}', |
399 |
echo "${ALX_DEFAULT_DOMAIN}" > ${SETTINGSPATH}/network/domain; |
networking='dhcp' |
400 |
echo "dhcp" > ${SETTINGSPATH}/network/networking ) |
where serial=${ALX_SERIAL};" |
401 |
evaluate_retval |
evaluate_retval |
402 |
|
|
403 |
|
# xserver |
|
#xserver |
|
404 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
405 |
|
# xserver general |
406 |
[ ! -d ${SETTINGSPATH}/vga ] && install -d ${SETTINGSPATH}/vga |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
407 |
[ ! -d ${SETTINGSPATH}/mouse ] && install -d ${SETTINGSPATH}/mouse |
"update cfg_graphic set |
408 |
[ ! -d ${SETTINGSPATH}/monitor ] && install -d ${SETTINGSPATH}/monitor |
module='${XMODULE}', |
409 |
( echo "${XMODULE}" > ${SETTINGSPATH}/vga/vga; |
resolution='1024x768', |
410 |
echo "16" > ${SETTINGSPATH}/vga/vgadepth; |
depth='16', |
411 |
echo "1024x768" > ${SETTINGSPATH}/vga/vgares; |
monitorid='0' |
412 |
echo "${XMOUSETYPE}" > ${SETTINGSPATH}/mouse/mouse; |
where serial=${ALX_SERIAL};" |
413 |
echo "myvendor=\"Aamazing\"" > ${SETTINGSPATH}/monitor/monitor; |
evaluate_retval |
414 |
echo "mymodel=\"CM-1528-FS\"" >> ${SETTINGSPATH}/monitor/monitor; |
|
415 |
echo "hsync=\"28-64\"" >> ${SETTINGSPATH}/monitor/monitor; |
# input |
416 |
echo "vref=\"47-104\"" >> ${SETTINGSPATH}/monitor/monitor;) |
echo -e " Input settings ..." |
417 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
418 |
|
"update cfg_input set |
419 |
|
mouse='${XMOUSETYPE}' |
420 |
|
where serial=${ALX_SERIAL};" |
421 |
|
evaluate_retval |
422 |
|
} |
423 |
|
|
424 |
|
# imports current settings to the local system resolved by the hardware detection |
425 |
|
# we only need the network settings |
426 |
|
import_settings_local(){ |
427 |
|
# note: networking is always 'dhcp' if hw was autodetected |
428 |
|
# note: default_domain/hostname is set in config.rc |
429 |
|
|
430 |
|
# to be safe, we do some sanity checks |
431 |
|
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
432 |
|
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
433 |
|
|
434 |
|
# vars used by hwdetect |
435 |
|
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
436 |
|
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
437 |
|
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
438 |
|
|
439 |
|
# get setting from hwdetect |
440 |
|
source /etc/sysconfig/hwsetup/knoppix |
441 |
|
|
442 |
|
echo |
443 |
|
echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} |
444 |
|
|
445 |
|
[ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} |
446 |
|
echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules |
447 |
evaluate_retval |
evaluate_retval |
448 |
|
|
449 |
#set system state to 'already configured' |
# set system state to 'already configured' |
450 |
touch /etc/alx-config/state/configured |
touch /etc/alxconfig-ng/state/configured |
451 |
|
|
452 |
|
# if only an recheck was forced than abort now |
453 |
|
[[ ${ALX_FORCED_RECHECK} = true ]] && return 0 |
454 |
|
|
455 |
|
# create a fresh fluxbox directory |
456 |
|
[ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox |
457 |
|
install -d ${ALX_UNPRIV_HOME}/.fluxbox |
458 |
|
|
459 |
|
# now generate fluxbox config files |
460 |
|
|
461 |
|
# fluxbox main config |
462 |
|
cat ${ALX_SKELETONS}/fluxbox/init \ |
463 |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/init |
464 |
|
|
465 |
|
# fluxbox menu header |
466 |
|
cat ${ALX_SKELETONS}/fluxbox/menu.header \ |
467 |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
468 |
|
|
469 |
|
# now fix it with proper messages :P |
470 |
|
local ver="$(< /etc/mageversion)" |
471 |
|
sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" \ |
472 |
|
${ALX_UNPRIV_HOME}/.fluxbox/menu |
473 |
|
|
474 |
|
# add a newline (maybe there is no crlf in the header) |
475 |
|
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
476 |
|
|
477 |
|
# fluxbox menu footer |
478 |
|
cat ${ALX_SKELETONS}/fluxbox/menu.footer \ |
479 |
|
>> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
480 |
|
|
481 |
|
# add a newline (maybe there is no crlf in the footer) |
482 |
|
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
483 |
|
|
484 |
|
|
485 |
|
# setup some standart icons (sysinfo.lnk) |
486 |
|
# basic config |
487 |
|
cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc |
488 |
|
|
489 |
|
# clean desktop icon location |
490 |
|
[ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop |
491 |
|
install -d ${ALX_UNPRIV_HOME}/.xtdesktop |
492 |
|
|
493 |
|
# last but not least gen a icon with some sys informations |
494 |
|
local sysinfo |
495 |
|
local osversion |
496 |
|
local xres |
497 |
|
local yres |
498 |
|
|
499 |
|
osversion="$(< /etc/mageversion)" |
500 |
|
sysinfo="Hostname: ${ALX_DEFAULT_HOSTNAME} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)" |
501 |
|
|
502 |
|
# at first boot we got always a resolution of 1024x768-16@60 |
503 |
|
# middle of the screen |
504 |
|
# (no txt - length required, xtdesk manage that itself) |
505 |
|
xres="$((1024 / 2))" |
506 |
|
# default y pos (full yres -22 !) |
507 |
|
yres="$((768 - 22 ))" |
508 |
|
|
509 |
|
generate_icon \ |
510 |
|
--name "${sysinfo}" \ |
511 |
|
--command "exit 0" \ |
512 |
|
--icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \ |
513 |
|
--dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \ |
514 |
|
--xres "${xres}" \ |
515 |
|
--yres "${yres}" \ |
516 |
|
--icon-width "1" \ |
517 |
|
--icon-height "1" |
518 |
|
|
519 |
|
# set correct permissions |
520 |
|
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
521 |
|
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
522 |
|
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
523 |
|
chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop |
524 |
|
chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc |
525 |
|
|
526 |
|
# default passwords are bad |
527 |
|
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") root |
528 |
|
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") ${ALX_UNPRIV_USER} |
529 |
|
#smbpasswd -a root foobar |
530 |
} |
} |
531 |
|
|
532 |
#start|stop |
# start|stop |
533 |
preliminary_network(){ |
preliminary_network(){ |
534 |
local module |
local module |
535 |
|
|
536 |
if [ -f /etc/alx-config/state/configured ] |
if [ -f /etc/alxconfig-ng/state/configured ] |
537 |
then |
then |
538 |
#get module name |
# get module name |
539 |
module=$(cat ${SETTINGS_TEMPLATE}/system/modules/modules) |
module=$(cat ${SETTINGSPATH}/modules) |
540 |
modprobe ${module} |
modprobe ${module} |
541 |
else |
else |
542 |
#vars used by hwdetect |
# vars used by hwdetect |
543 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
544 |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
545 |
|
|
546 |
#get setting from hwdetect |
# get setting from hwdetect |
547 |
source /etc/sysconfig/hwsetup/knoppix |
source /etc/sysconfig/hwsetup/knoppix |
548 |
modprobe ${NETCARD_DRIVER} |
modprobe ${NETCARD_DRIVER} |
549 |
fi |
fi |
550 |
|
|
551 |
case $1 in |
case $1 in |
552 |
start) |
start) |
553 |
# keeping like always safe: |
# keeping like always safe: |
561 |
else |
else |
562 |
rm -f /var/run/dhcpcd-eth?.pid |
rm -f /var/run/dhcpcd-eth?.pid |
563 |
fi |
fi |
564 |
|
|
565 |
echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT} |
566 |
#dhcpcd &> /dev/null #&& echo "ok" || echo "false" |
# -t 10 timeout of 10 secs |
567 |
|
dhcpcd -t 10 &> /dev/null |
568 |
|
|
569 |
# aka_fix ######################################## |
# aka_fix ######################################## |
570 |
ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up |
#ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up |
571 |
route del default gw 128.20.50.13 &> /dev/null |
#route del default gw 128.20.50.13 &> /dev/null |
572 |
route add default gw 128.20.50.21 &> /dev/null |
#route add default gw 128.20.50.21 &> /dev/null |
573 |
echo "nameserver 128.20.50.21" > /etc/resolv.conf |
#echo "nameserver 128.20.50.21" > /etc/resolv.conf |
574 |
################################################## |
################################################## |
575 |
|
|
576 |
evaluate_retval |
evaluate_retval |
577 |
;; |
;; |
578 |
|
|
579 |
stop) |
stop) |
580 |
echo -e ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT} |
581 |
ifconfig eth0 down |
ifconfig eth0 down |
582 |
if ps -A|grep dhcpcd > /dev/null |
if ps -A|grep dhcpcd > /dev/null |
583 |
then |
then |
|
#echo -en ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT} |
|
584 |
dhcpcd -z &> /dev/null |
dhcpcd -z &> /dev/null |
585 |
fi |
fi |
586 |
evaluate_retval |
evaluate_retval |
587 |
;; |
;; |
588 |
|
|
589 |
*) |
*) |
590 |
echo "Usage: preliminary_network {start|stop}" |
echo "Usage: preliminary_network {start|stop}" |
591 |
;; |
;; |
594 |
|
|
595 |
case $1 in |
case $1 in |
596 |
start) |
start) |
597 |
#retrieve or validate current serial |
# retrieve or validate current serial |
598 |
get_system_serial |
get_system_serial |
599 |
if [ "${ALX_HW_DETECT}" == "true" ] |
if [[ ${ALX_HW_DETECT} = true ]] |
600 |
then |
then |
601 |
import_settings_to_db |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
602 |
|
then |
603 |
|
update_settings_in_db |
604 |
|
else |
605 |
|
import_settings_to_db |
606 |
|
fi |
607 |
import_settings_local |
import_settings_local |
608 |
|
|
609 |
|
# here we should also exchange the ssh keys |
610 |
|
# or the system cannot be rebooted after |
611 |
|
# the first start via the alx-webadmin |
612 |
|
config_ssh_auth |
613 |
fi |
fi |
614 |
|
|
615 |
#now setup system configuration |
# now setup system configuration |
616 |
#alx_setup_or_whatever_it_will_be_called() |
# alx_setup_or_whatever_it_will_be_called() |
617 |
[ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
[ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
618 |
|
|
619 |
#stop at last the preliminary networking (dhcp) |
# stop at last the preliminary networking (dhcp) |
620 |
preliminary_network stop |
preliminary_network stop |
621 |
;; |
;; |
622 |
|
|
623 |
stop) |
stop) |
624 |
#unset_alx_connected #--> now in alxsetstate-rc6 |
# unset_alx_connected #--> now in alxsetstate-rc6 |
625 |
# ! important !: del systemstate |
# ! important !: del systemstate |
626 |
[ -f /etc/alx-config/state/state ] && rm /etc/alx-config/state/state |
[ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state |
627 |
sleep 0.1 |
sleep 0.1 |
628 |
;; |
;; |
629 |
*) |
*) |
630 |
echo "Usage: $0 {start|stop} ..." |
echo "Usage: $0 {start|stop} ..." |
631 |
;; |
;; |
632 |
esac |
esac |
633 |
|
|