11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
|
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.7 2005-04-12 20:45:55 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 |
27 |
#mysql settings |
#mysql settings |
28 |
source /etc/alxconfig-ng/config.rc |
source /etc/alxconfig-ng/config.rc |
29 |
source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
30 |
source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
source /usr/lib/alxconfig-ng/functions/serial_functions |
31 |
source /usr/lib/alxconfig-ng/functions/config_network |
source /usr/lib/alxconfig-ng/functions/config_network |
32 |
source /usr/lib/alxconfig-ng/functions/config_printers |
source /usr/lib/alxconfig-ng/functions/config_printers |
33 |
|
source /usr/lib/alxconfig-ng/functions/config_sessions |
34 |
source /usr/lib/alxconfig-ng/functions/config_x11 |
source /usr/lib/alxconfig-ng/functions/config_x11 |
35 |
|
|
36 |
#check if mysql is available |
#check if mysql is available |
124 |
#echo "sessions" |
#echo "sessions" |
125 |
#validate_sessions |
#validate_sessions |
126 |
#echo |
#echo |
127 |
|
config_sessions |
128 |
|
|
129 |
# imports printer settings from db |
# imports printer settings from db |
130 |
config_printing |
config_printing |
131 |
} |
} |
132 |
|
|
|
# 1.serial 2.mtime 3.mac |
|
|
validate_serial() |
|
|
{ |
|
|
local serial |
|
|
local db_serial |
|
|
local mtime |
|
|
local mac |
|
|
|
|
|
# abort if params are missing |
|
|
[ $# -ne 3 ] && return 1 |
|
|
|
|
|
serial=$1 |
|
|
mtime=$2 |
|
|
mac=$3 |
|
|
|
|
|
db_serial=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"select serial from client_serials where mtime='${mtime}' and mac='${mac}'" ) |
|
|
|
|
|
if [[ ${db_serial} = ${serial} ]] |
|
|
then |
|
|
return 0 |
|
|
else |
|
|
return 1 |
|
|
fi |
|
|
} |
|
|
|
|
133 |
get_system_serial(){ |
get_system_serial(){ |
134 |
|
|
135 |
local CUR_IP CUR_MAC CUR_MTIME |
local CUR_IP CUR_MAC CUR_MTIME |
139 |
then |
then |
140 |
source /etc/alxconfig-ng/serial |
source /etc/alxconfig-ng/serial |
141 |
|
|
|
# if system is already configured, it *has* a hostname. |
|
|
# so we take the hostname of this system here |
|
|
source /etc/hostname |
|
|
|
|
142 |
#start preliminary networking (dhcp) |
#start preliminary networking (dhcp) |
143 |
preliminary_network start |
preliminary_network start |
144 |
|
|
172 |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
173 |
|
|
174 |
#update the hostname on the system for sure |
#update the hostname on the system for sure |
175 |
echo "HOSTNAME=${HOSTNAME}" > /etc/hostname |
echo "${HOSTNAME}" > /etc/hostname |
176 |
|
|
177 |
#start preliminary networking (dhcp) |
#start preliminary networking (dhcp) |
178 |
preliminary_network start |
preliminary_network start |
255 |
import_settings_to_db() { |
import_settings_to_db() { |
256 |
#note: networking is always 'dhcp' if hw was autodetected |
#note: networking is always 'dhcp' if hw was autodetected |
257 |
#note: default_domain/hostname is set in config.rc |
#note: default_domain/hostname is set in config.rc |
258 |
|
|
259 |
#to be safe, we do some sanity checks |
#to be safe, we do some sanity checks |
260 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
261 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
262 |
|
|
263 |
#vars used by hwdetect |
#vars used by hwdetect |
264 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
265 |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
266 |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
267 |
|
|
268 |
#get setting from hwdetect |
#get setting from hwdetect |
269 |
source /etc/sysconfig/hwsetup/knoppix |
source /etc/sysconfig/hwsetup/knoppix |
270 |
source /etc/sysconfig/hwsetup/mouse |
source /etc/sysconfig/hwsetup/mouse |
271 |
|
|
272 |
echo |
echo |
273 |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
274 |
|
|
275 |
#network |
#network |
276 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
277 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
290 |
'dhcp' |
'dhcp' |
291 |
);" |
);" |
292 |
evaluate_retval |
evaluate_retval |
293 |
|
|
294 |
#xserver |
#xserver |
295 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
296 |
#xserver general |
#xserver general |
299 |
serial, |
serial, |
300 |
module, |
module, |
301 |
resolution, |
resolution, |
302 |
depth |
depth, |
303 |
|
monitorid |
304 |
) |
) |
305 |
values( |
values( |
306 |
'${ALX_SERIAL}', |
'${ALX_SERIAL}', |
307 |
'${XMODULE}', |
'${XMODULE}', |
308 |
'1024x768', |
'1024x768', |
309 |
'16' |
'16', |
310 |
|
'0' |
311 |
);"; |
);"; |
312 |
#xserver monitor |
|
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
|
|
"insert into cfg_monitor( |
|
|
serial, |
|
|
vendor, |
|
|
model, |
|
|
hsync, |
|
|
vrefresh |
|
|
) |
|
|
values( |
|
|
'${ALX_SERIAL}', |
|
|
'Aamazing', |
|
|
'CM-1528-FS', |
|
|
'28-64', |
|
|
'47-104' |
|
|
);"; |
|
|
|
|
313 |
# input |
# input |
314 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
315 |
"insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');";) |
"insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');";) |