11 |
#%before: |
#%before: |
12 |
#%after: |
#%after: |
13 |
|
|
14 |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.9 2005-04-14 19:12:21 niro Exp $ |
# $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.17 2005-08-18 08:10:46 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 |
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/alxconfig-ng/config.rc |
source /etc/alxconfig-ng/config.rc |
29 |
|
|
30 |
|
# 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_modules |
34 |
source /usr/lib/alxconfig-ng/functions/config_network |
source /usr/lib/alxconfig-ng/functions/config_network |
35 |
source /usr/lib/alxconfig-ng/functions/config_printers |
source /usr/lib/alxconfig-ng/functions/config_printers |
36 |
source /usr/lib/alxconfig-ng/functions/config_sessions |
source /usr/lib/alxconfig-ng/functions/config_sessions |
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 |
|
|
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_FORCED_RECHECK=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/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
[ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
54 |
|
|
55 |
|
|
56 |
update_system_settings(){ |
update_system_settings(){ |
57 |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} |
58 |
|
|
59 |
|
# get the modules settings |
60 |
|
# ! is the first thing that must be configured ! |
61 |
|
config_modules |
62 |
|
|
63 |
# imports network settings from db |
# imports network settings from db |
64 |
config_networking |
config_networking |
65 |
|
|
76 |
config_auth |
config_auth |
77 |
|
|
78 |
# exchange ssh rsa keys |
# exchange ssh rsa keys |
79 |
config_ssh_auth |
HOME=/root config_ssh_auth |
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/alxconfig-ng/serial ] |
if [ -f /etc/alxconfig-ng/serial ] && [ ! -f /hardware-auto-detection ] |
88 |
then |
then |
89 |
source /etc/alxconfig-ng/serial |
source /etc/alxconfig-ng/serial |
90 |
|
|
91 |
#start preliminary networking (dhcp) |
# 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} ]" |
118 |
fi |
fi |
119 |
|
|
120 |
else |
else |
121 |
#run hardware detection |
# run hardware detection |
122 |
echo |
echo |
123 |
echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT} |
if [ -f /hardware-auto-detection ] |
124 |
|
then |
125 |
|
echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
126 |
|
else |
127 |
|
echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT} |
128 |
|
fi |
129 |
ALX_HW_DETECT=true |
ALX_HW_DETECT=true |
130 |
/etc/init.d/hwdetect start |
/etc/init.d/hwdetect start |
131 |
|
|
132 |
#set hostname to alx_default_hostname |
# set hostname to alx_default_hostname |
133 |
|
# use old hostname if this is a forced re-check |
134 |
|
[ -f /hardware-auto-detection ] && ALX_DEFAULT_HOSTNAME="$(< /etc/hostname)" |
135 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
136 |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
HOSTNAME="${ALX_DEFAULT_HOSTNAME}" |
137 |
|
|
138 |
#update the hostname on the system for sure |
# update the hostname on the system for sure |
139 |
echo "${HOSTNAME}" > /etc/hostname |
echo "${HOSTNAME}" > /etc/hostname |
140 |
|
|
141 |
#start preliminary networking (dhcp) |
# start preliminary networking (dhcp) |
142 |
preliminary_network start |
preliminary_network start |
143 |
|
|
144 |
|
# check if mysql server is reachable |
145 |
|
# if not abort this script |
146 |
|
if ! reach_mysql_server |
147 |
|
then |
148 |
|
preliminary_network stop |
149 |
|
exit 1 |
150 |
|
fi |
151 |
|
|
152 |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
153 |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) |
154 |
CUR_MTIME=$(date +%s) |
CUR_MTIME=$(date +%s) |
155 |
|
|
156 |
|
# abort now if this is a forced re-check |
157 |
|
if [ -f /hardware-auto-detection ] |
158 |
|
then |
159 |
|
# but first check the serial |
160 |
|
source /etc/alxconfig-ng/serial |
161 |
|
|
162 |
|
echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
163 |
|
|
164 |
|
# nice serial output |
165 |
|
$CURS_UP |
166 |
|
$SET_WCOL |
167 |
|
echo "[ SN: ${ALX_SERIAL} ]" |
168 |
|
|
169 |
|
if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" |
170 |
|
then |
171 |
|
ALX_STATE="ok" |
172 |
|
else |
173 |
|
ALX_STATE="invalid serial" |
174 |
|
fi |
175 |
|
|
176 |
|
# write current state to temp file |
177 |
|
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
178 |
|
rm /hardware-auto-detection |
179 |
|
|
180 |
|
# now export ALX_FORCED_RECHECK=true |
181 |
|
# that the setting will be updated not inserted ! |
182 |
|
export ALX_FORCED_RECHECK=true |
183 |
|
return 0 |
184 |
|
fi |
185 |
|
|
186 |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
187 |
|
|
188 |
#request new serial |
# request new serial |
189 |
#ALX_REG_DATE="$(date +%F)" |
# ALX_REG_DATE="$(date +%F)" |
190 |
|
|
191 |
#we're using the mtime now (better for vaildating the serial) |
# we're using the mtime now (better for vaildating the serial) |
192 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
193 |
"insert into client_serials( |
"insert into client_serials( |
194 |
mtime, |
mtime, |
199 |
'${CUR_MAC}' |
'${CUR_MAC}' |
200 |
);" |
);" |
201 |
|
|
202 |
#then validate and retrieve serial |
# then validate and retrieve serial |
203 |
|
|
204 |
### warning must be changed that only the LAST ID will be fetched, ### |
### warning must be changed that only the LAST ID will be fetched, ### |
205 |
### 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 ### |
206 |
### you have more than one serial number then ### |
### you have more than one serial number then ### |
207 |
|
|
208 |
#select highest id only (added max) |
# select highest id only (added max) |
209 |
ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
210 |
"select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'") |
"select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'") |
211 |
|
|
212 |
if [ "${ALX_SERIAL}" != NULL ] |
if [ "${ALX_SERIAL}" != NULL ] |
213 |
then |
then |
214 |
#nice serial output |
# nice serial output |
215 |
$CURS_UP |
$CURS_UP |
216 |
$SET_WCOL |
$SET_WCOL |
217 |
echo "[ SN: ${ALX_SERIAL} ]" |
echo "[ SN: ${ALX_SERIAL} ]" |
218 |
|
|
219 |
#set ALX_STATE to ok so everybody that everything was ok |
# set ALX_STATE to ok so everybody that everything was ok |
220 |
ALX_STATE=ok |
ALX_STATE=ok |
221 |
|
|
222 |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial |
echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial |
224 |
|
|
225 |
evaluate_retval |
evaluate_retval |
226 |
else |
else |
227 |
#print false (works only if this is the first statement here) |
# print false (works only if this is the first statement here) |
228 |
evaluate_retval |
evaluate_retval |
229 |
|
|
230 |
#set ALX_STATE to error so everybody sees there was an error |
# set ALX_STATE to error so everybody sees there was an error |
231 |
ALX_STATE=error |
ALX_STATE=error |
232 |
|
|
233 |
#show an error that no new serial was found |
# show an error that no new serial was found |
234 |
#nice serial output |
# nice serial output |
235 |
$CURS_UP |
$CURS_UP |
236 |
$SET_WCOL |
$SET_WCOL |
237 |
echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]" |
echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]" |
238 |
fi |
fi |
239 |
fi |
fi |
240 |
|
|
241 |
#write current state to temp file |
# write current state to temp file |
242 |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
243 |
} |
} |
244 |
|
|
255 |
|
|
256 |
# imports current settings to the database resolved by the hardware detection |
# imports current settings to the database resolved by the hardware detection |
257 |
import_settings_to_db() { |
import_settings_to_db() { |
258 |
#note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
259 |
#note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
260 |
|
|
261 |
#to be safe, we do some sanity checks |
# to be safe, we do some sanity checks |
262 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
263 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
264 |
|
|
265 |
#vars used by hwdetect |
# vars used by hwdetect |
266 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
267 |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
268 |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
269 |
|
|
270 |
#get setting from hwdetect |
# get setting from hwdetect |
271 |
source /etc/sysconfig/hwsetup/knoppix |
source /etc/sysconfig/hwsetup/knoppix |
272 |
source /etc/sysconfig/hwsetup/mouse |
source /etc/sysconfig/hwsetup/mouse |
273 |
|
|
274 |
echo |
echo |
275 |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} |
276 |
|
|
277 |
#network |
# network |
278 |
echo -e " Network settings ..." |
echo -e " Network settings ..." |
279 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
280 |
"insert into cfg_network( |
"insert into cfg_network( |
293 |
);" |
);" |
294 |
evaluate_retval |
evaluate_retval |
295 |
|
|
296 |
#xserver |
# xserver |
297 |
echo -e " Graphic settings ..." |
echo -e " Graphic settings ..." |
298 |
#xserver general |
# xserver general |
299 |
( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
300 |
"insert into cfg_graphic( |
"insert into cfg_graphic( |
301 |
serial, |
serial, |
340 |
);" |
);" |
341 |
evaluate_retval |
evaluate_retval |
342 |
|
|
343 |
|
# exchange ssh rsa keys - the first boot needs this ! |
344 |
|
# or no reboot will work via the webadmin |
345 |
|
echo -e " SSH authentifcation settings ..." |
346 |
|
HOME=/root config_ssh_auth |
347 |
|
evaluate_retval |
348 |
|
|
349 |
# input |
# input |
350 |
echo -e " Autostart settings ..." |
echo -e " Autostart settings ..." |
351 |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
353 |
evaluate_retval |
evaluate_retval |
354 |
} |
} |
355 |
|
|
356 |
|
# imports current settings to the database resolved by the hardware detection |
357 |
|
update_settings_in_db() { |
358 |
|
# note: networking is always 'dhcp' if hw was autodetected |
359 |
|
# note: default_domain/hostname is set in config.rc or exported |
360 |
|
# note: we updating only hardware settings here ! |
361 |
|
|
362 |
|
# to be safe, we do some sanity checks |
363 |
|
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
364 |
|
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
365 |
|
|
366 |
|
# vars used by hwdetect |
367 |
|
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
368 |
|
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
369 |
|
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
370 |
|
|
371 |
|
# get setting from hwdetect |
372 |
|
source /etc/sysconfig/hwsetup/knoppix |
373 |
|
source /etc/sysconfig/hwsetup/mouse |
374 |
|
|
375 |
|
echo |
376 |
|
echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT} |
377 |
|
|
378 |
|
# network |
379 |
|
echo -e " Network settings ..." |
380 |
|
|
381 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
382 |
|
"update cfg_network set |
383 |
|
hostname='${ALX_DEFAULT_HOSTNAME}', |
384 |
|
module='${NETCARD_DRIVER}', |
385 |
|
domain='${ALX_DEFAULT_DOMAIN}', |
386 |
|
networking='dhcp' |
387 |
|
where serial=${ALX_SERIAL};" |
388 |
|
evaluate_retval |
389 |
|
|
390 |
|
# xserver |
391 |
|
echo -e " Graphic settings ..." |
392 |
|
# xserver general |
393 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
394 |
|
"update cfg_graphic set |
395 |
|
module='${XMODULE}', |
396 |
|
resolution='1024x768', |
397 |
|
depth='16', |
398 |
|
monitorid='0' |
399 |
|
where serial=${ALX_SERIAL};" |
400 |
|
evaluate_retval |
401 |
|
|
402 |
|
# input |
403 |
|
echo -e " Input settings ..." |
404 |
|
mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
405 |
|
"update cfg_input set |
406 |
|
mouse='${XMOUSETYPE}' |
407 |
|
where serial=${ALX_SERIAL};" |
408 |
|
evaluate_retval |
409 |
|
} |
410 |
|
|
411 |
# imports current settings to the local system resolved by the hardware detection |
# imports current settings to the local system resolved by the hardware detection |
412 |
# we only need the network settings |
# we only need the network settings |
413 |
import_settings_local(){ |
import_settings_local(){ |
414 |
#note: networking is always 'dhcp' if hw was autodetected |
# note: networking is always 'dhcp' if hw was autodetected |
415 |
#note: default_domain/hostname is set in config.rc |
# note: default_domain/hostname is set in config.rc |
416 |
|
|
417 |
#to be safe, we do some sanity checks |
# to be safe, we do some sanity checks |
418 |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
[ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
419 |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
[ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
420 |
|
|
421 |
#vars used by hwdetect |
# vars used by hwdetect |
422 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
423 |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
424 |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
local MOUSETYPE XMOUSETYPE FULLNAME DEVICE |
425 |
|
|
426 |
#get setting from hwdetect |
# get setting from hwdetect |
427 |
source /etc/sysconfig/hwsetup/knoppix |
source /etc/sysconfig/hwsetup/knoppix |
428 |
|
|
429 |
echo |
echo |
433 |
echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules |
echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules |
434 |
evaluate_retval |
evaluate_retval |
435 |
|
|
436 |
#set system state to 'already configured' |
# set system state to 'already configured' |
437 |
touch /etc/alxconfig-ng/state/configured |
touch /etc/alxconfig-ng/state/configured |
438 |
|
|
439 |
|
# create a fresh fluxbox directory |
440 |
|
[ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox |
441 |
|
install -d ${ALX_UNPRIV_HOME}/.fluxbox |
442 |
|
|
443 |
|
# now generate fluxbox config files |
444 |
|
|
445 |
|
# fluxbox main config |
446 |
|
cat ${ALX_SKELETONS}/fluxbox/init \ |
447 |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/init |
448 |
|
|
449 |
|
# fluxbox menu header |
450 |
|
cat ${ALX_SKELETONS}/fluxbox/menu.header \ |
451 |
|
> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
452 |
|
|
453 |
|
# now fix it with proper messages :P |
454 |
|
local ver="$(< /etc/mageversion)" |
455 |
|
sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" \ |
456 |
|
${ALX_UNPRIV_HOME}/.fluxbox/menu |
457 |
|
|
458 |
|
# add a newline (maybe there is no crlf in the header) |
459 |
|
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
460 |
|
|
461 |
|
# fluxbox menu footer |
462 |
|
cat ${ALX_SKELETONS}/fluxbox/menu.footer \ |
463 |
|
>> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
464 |
|
|
465 |
|
# add a newline (maybe there is no crlf in the footer) |
466 |
|
echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu |
467 |
|
|
468 |
|
# set correct permissions |
469 |
|
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} |
470 |
|
chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox |
471 |
|
chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox |
472 |
|
|
473 |
# default passwords are bad |
# default passwords are bad |
474 |
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") root |
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") root |
475 |
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") ${ALX_UNPRIV_USER} |
#usermod -p $(perl -e "printf(crypt('foobar','AD'))") ${ALX_UNPRIV_USER} |
476 |
#smbpasswd -a root foobar |
#smbpasswd -a root foobar |
477 |
} |
} |
478 |
|
|
479 |
#start|stop |
# start|stop |
480 |
preliminary_network(){ |
preliminary_network(){ |
481 |
local module |
local module |
482 |
|
|
483 |
if [ -f /etc/alxconfig-ng/state/configured ] |
if [ -f /etc/alxconfig-ng/state/configured ] |
484 |
then |
then |
485 |
#get module name |
# get module name |
486 |
module=$(cat ${SETTINGSPATH}/modules) |
module=$(cat ${SETTINGSPATH}/modules) |
487 |
modprobe ${module} |
modprobe ${module} |
488 |
else |
else |
489 |
#vars used by hwdetect |
# vars used by hwdetect |
490 |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
491 |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER |
492 |
|
|
493 |
#get setting from hwdetect |
# get setting from hwdetect |
494 |
source /etc/sysconfig/hwsetup/knoppix |
source /etc/sysconfig/hwsetup/knoppix |
495 |
modprobe ${NETCARD_DRIVER} |
modprobe ${NETCARD_DRIVER} |
496 |
fi |
fi |
510 |
fi |
fi |
511 |
|
|
512 |
echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT} |
echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT} |
513 |
dhcpcd &> /dev/null |
# -t 10 timeout of 10 secs |
514 |
|
dhcpcd -t 10 &> /dev/null |
515 |
|
|
516 |
# aka_fix ######################################## |
# aka_fix ######################################## |
517 |
#ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up |
#ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up |
541 |
|
|
542 |
case $1 in |
case $1 in |
543 |
start) |
start) |
544 |
#retrieve or validate current serial |
# retrieve or validate current serial |
545 |
get_system_serial |
get_system_serial |
546 |
if [ "${ALX_HW_DETECT}" == "true" ] |
if [[ ${ALX_HW_DETECT} = true ]] |
547 |
then |
then |
548 |
import_settings_to_db |
if [[ ${ALX_FORCED_RECHECK} = true ]] |
549 |
|
then |
550 |
|
update_settings_in_db |
551 |
|
else |
552 |
|
import_settings_to_db |
553 |
|
fi |
554 |
import_settings_local |
import_settings_local |
555 |
|
|
556 |
# here we should also exchange the ssh keys |
# here we should also exchange the ssh keys |
559 |
config_ssh_auth |
config_ssh_auth |
560 |
fi |
fi |
561 |
|
|
562 |
#now setup system configuration |
# now setup system configuration |
563 |
#alx_setup_or_whatever_it_will_be_called() |
# alx_setup_or_whatever_it_will_be_called() |
564 |
[ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
[ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
565 |
|
|
566 |
#stop at last the preliminary networking (dhcp) |
# stop at last the preliminary networking (dhcp) |
567 |
preliminary_network stop |
preliminary_network stop |
568 |
;; |
;; |
569 |
|
|
570 |
stop) |
stop) |
571 |
#unset_alx_connected #--> now in alxsetstate-rc6 |
# unset_alx_connected #--> now in alxsetstate-rc6 |
572 |
# ! important !: del systemstate |
# ! important !: del systemstate |
573 |
[ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state |
[ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state |
574 |
sleep 0.1 |
sleep 0.1 |