Annotation of /alx-src/branches/alxconf_20060908/init.d/alxsettings
Parent Directory | Revision Log
Revision 307 -
(hide annotations)
(download)
Sun Aug 28 19:30:53 2005 UTC (19 years, 1 month ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/init.d/alxsettings
File size: 15536 byte(s)
Sun Aug 28 19:30:53 2005 UTC (19 years, 1 month ago) by niro
Original Path: alx-src/trunk/alxconfig-ng/init.d/alxsettings
File size: 15536 byte(s)
- now aborting on invalid serials
1 | niro | 221 | #!/bin/bash |
2 | |||
3 | # <niro@magellan-linux.de> | ||
4 | |||
5 | #%rlevels: 7:s 0:k 6:k | ||
6 | #%start: 41 | ||
7 | #%stop: 01 | ||
8 | |||
9 | #deps | ||
10 | #%needs: | ||
11 | #%before: | ||
12 | #%after: | ||
13 | |||
14 | niro | 307 | # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.18 2005-08-28 19:30:53 niro Exp $ |
15 | niro | 227 | |
16 | niro | 221 | # checks first if the client was already configured and if it has an valid serial |
17 | # if not it runs the autoconfiguration script | ||
18 | # these settings will be used for client setup | ||
19 | # | ||
20 | # if client was valid it first will check if his settings against the server | ||
21 | # if no changes are at server side they will be kept, if yes the get updated. | ||
22 | # the server settings has higher priority. | ||
23 | |||
24 | source /etc/sysconfig/rc | ||
25 | source $rc_functions | ||
26 | |||
27 | niro | 282 | # mysql settings |
28 | niro | 226 | source /etc/alxconfig-ng/config.rc |
29 | niro | 282 | |
30 | # helper functions | ||
31 | niro | 226 | source /usr/lib/alxconfig-ng/functions/mysqlfunctions |
32 | niro | 227 | source /usr/lib/alxconfig-ng/functions/serial_functions |
33 | niro | 257 | source /usr/lib/alxconfig-ng/functions/config_modules |
34 | niro | 226 | source /usr/lib/alxconfig-ng/functions/config_network |
35 | source /usr/lib/alxconfig-ng/functions/config_printers | ||
36 | niro | 239 | source /usr/lib/alxconfig-ng/functions/config_sessions |
37 | niro | 226 | source /usr/lib/alxconfig-ng/functions/config_x11 |
38 | niro | 248 | source /usr/lib/alxconfig-ng/functions/config_auth |
39 | niro | 252 | source /usr/lib/alxconfig-ng/functions/config_ssh_auth |
40 | niro | 221 | |
41 | niro | 282 | # check if mysql is available |
42 | niro | 221 | [ -x /usr/bin/mysql ] && MYSQL_ALX=true |
43 | |||
44 | niro | 282 | # other needed vars |
45 | niro | 221 | ALX_HW_DETECT=false |
46 | niro | 282 | ALX_FORCED_RECHECK=false |
47 | niro | 221 | |
48 | niro | 282 | # unset vars which may kill us |
49 | niro | 221 | unset ALX_SERIAL ALX_STATE |
50 | |||
51 | |||
52 | niro | 282 | # setup needed directories |
53 | niro | 226 | [ ! -d /etc/alxconfig-ng/state ] && install -d /etc/alxconfig-ng/state |
54 | niro | 221 | |
55 | |||
56 | niro | 226 | update_system_settings(){ |
57 | echo -e ${COLMAGENTA}"Checking system setup ..."${COLDEFAULT} | ||
58 | niro | 221 | |
59 | niro | 257 | # get the modules settings |
60 | # ! is the first thing that must be configured ! | ||
61 | config_modules | ||
62 | |||
63 | niro | 226 | # imports network settings from db |
64 | config_networking | ||
65 | |||
66 | # imports x11 settings from db | ||
67 | config_x11 | ||
68 | |||
69 | niro | 248 | # imports session settings from db |
70 | niro | 239 | config_sessions |
71 | niro | 226 | |
72 | # imports printer settings from db | ||
73 | config_printing | ||
74 | niro | 248 | |
75 | # imports auth settings from db | ||
76 | config_auth | ||
77 | niro | 252 | |
78 | # exchange ssh rsa keys | ||
79 | niro | 265 | HOME=/root config_ssh_auth |
80 | niro | 221 | } |
81 | |||
82 | get_system_serial(){ | ||
83 | |||
84 | local CUR_IP CUR_MAC CUR_MTIME | ||
85 | |||
86 | niro | 282 | # check if serial file exists |
87 | if [ -f /etc/alxconfig-ng/serial ] && [ ! -f /hardware-auto-detection ] | ||
88 | niro | 221 | then |
89 | niro | 226 | source /etc/alxconfig-ng/serial |
90 | |||
91 | niro | 282 | # start preliminary networking (dhcp) |
92 | niro | 295 | preliminary_network start |
93 | niro | 226 | |
94 | niro | 295 | # 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 | niro | 221 | CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
103 | CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) | ||
104 | CUR_MTIME=$(date +%s) | ||
105 | niro | 226 | |
106 | niro | 221 | echo -e ${COLOREDSTAR} "Trying to validate my serial ..." |
107 | niro | 226 | |
108 | niro | 282 | # nice serial output |
109 | niro | 221 | $CURS_UP |
110 | $SET_WCOL | ||
111 | echo "[ SN: ${ALX_SERIAL} ]" | ||
112 | |||
113 | if validate_serial "${ALX_SERIAL}" "${ALX_REG_DATE}" "${CUR_MAC}" | ||
114 | then | ||
115 | ALX_STATE="ok" | ||
116 | else | ||
117 | niro | 307 | # abort on non valid serial |
118 | niro | 221 | ALX_STATE="invalid serial" |
119 | niro | 307 | echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
120 | show_invalid_serial_msg | ||
121 | exit 1 | ||
122 | niro | 221 | fi |
123 | |||
124 | else | ||
125 | niro | 282 | # run hardware detection |
126 | niro | 221 | echo |
127 | niro | 282 | if [ -f /hardware-auto-detection ] |
128 | then | ||
129 | niro | 295 | echo -e ${COLMAGENTA}"Hardware autodetection forced by system-administrator"${COLDEFAULT} |
130 | niro | 282 | else |
131 | echo -e ${COLMAGENTA}"Preparing system for first boot"${COLDEFAULT} | ||
132 | fi | ||
133 | niro | 221 | ALX_HW_DETECT=true |
134 | /etc/init.d/hwdetect start | ||
135 | niro | 226 | |
136 | niro | 282 | # 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 | niro | 221 | [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx |
140 | HOSTNAME="${ALX_DEFAULT_HOSTNAME}" | ||
141 | niro | 226 | |
142 | niro | 282 | # update the hostname on the system for sure |
143 | niro | 230 | echo "${HOSTNAME}" > /etc/hostname |
144 | niro | 226 | |
145 | niro | 282 | # start preliminary networking (dhcp) |
146 | niro | 221 | preliminary_network start |
147 | niro | 226 | |
148 | niro | 295 | # 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 | niro | 221 | CUR_IP=$(/sbin/ifconfig eth0 | sed -n '/addr:/s/ [^r]*..//gp') |
157 | CUR_MAC=$(/sbin/ifconfig eth0 | grep HWaddr | cut -d ' ' -f11) | ||
158 | CUR_MTIME=$(date +%s) | ||
159 | niro | 226 | |
160 | niro | 282 | # 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 | niro | 307 | # abort on non valid serial |
178 | niro | 282 | ALX_STATE="invalid serial" |
179 | niro | 307 | echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
180 | show_invalid_serial_msg | ||
181 | exit 1 | ||
182 | niro | 282 | 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 | niro | 221 | echo -e ${COLOREDSTAR} "Trying to get new serial ..." |
195 | niro | 226 | |
196 | niro | 282 | # request new serial |
197 | # ALX_REG_DATE="$(date +%F)" | ||
198 | niro | 226 | |
199 | niro | 282 | # we're using the mtime now (better for vaildating the serial) |
200 | niro | 221 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
201 | "insert into client_serials( | ||
202 | mtime, | ||
203 | mac | ||
204 | ) | ||
205 | values( | ||
206 | '${CUR_MTIME}', | ||
207 | '${CUR_MAC}' | ||
208 | );" | ||
209 | niro | 226 | |
210 | niro | 282 | # then validate and retrieve serial |
211 | niro | 226 | |
212 | niro | 221 | ### 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 ### | ||
214 | niro | 226 | ### you have more than one serial number then ### |
215 | |||
216 | niro | 282 | # select highest id only (added max) |
217 | niro | 221 | ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
218 | "select max(serial) from client_serials where mtime='${CUR_MTIME}' and mac='${CUR_MAC}'") | ||
219 | |||
220 | if [ "${ALX_SERIAL}" != NULL ] | ||
221 | then | ||
222 | niro | 282 | # nice serial output |
223 | niro | 221 | $CURS_UP |
224 | $SET_WCOL | ||
225 | echo "[ SN: ${ALX_SERIAL} ]" | ||
226 | niro | 226 | |
227 | niro | 282 | # set ALX_STATE to ok so everybody that everything was ok |
228 | niro | 221 | ALX_STATE=ok |
229 | niro | 226 | |
230 | echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial | ||
231 | echo "ALX_REG_DATE=${CUR_MTIME}" >> /etc/alxconfig-ng/serial | ||
232 | |||
233 | niro | 221 | evaluate_retval |
234 | else | ||
235 | niro | 282 | # print false (works only if this is the first statement here) |
236 | niro | 221 | evaluate_retval |
237 | niro | 226 | |
238 | niro | 282 | # set ALX_STATE to error so everybody sees there was an error |
239 | niro | 221 | ALX_STATE=error |
240 | niro | 226 | |
241 | niro | 282 | # show an error that no new serial was found |
242 | # nice serial output | ||
243 | niro | 221 | $CURS_UP |
244 | $SET_WCOL | ||
245 | echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]" | ||
246 | fi | ||
247 | fi | ||
248 | niro | 226 | |
249 | niro | 282 | # write current state to temp file |
250 | niro | 226 | echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state |
251 | niro | 221 | } |
252 | |||
253 | |||
254 | check_is_configured() { | ||
255 | niro | 226 | if [ -f /etc/alxconfig-ng/state/configured ] |
256 | niro | 221 | then |
257 | export ALX_CONFIGURED=true | ||
258 | else | ||
259 | export ALX_CONFIGURED=false | ||
260 | fi | ||
261 | } | ||
262 | |||
263 | |||
264 | # imports current settings to the database resolved by the hardware detection | ||
265 | import_settings_to_db() { | ||
266 | niro | 282 | # note: networking is always 'dhcp' if hw was autodetected |
267 | # note: default_domain/hostname is set in config.rc | ||
268 | niro | 229 | |
269 | niro | 282 | # to be safe, we do some sanity checks |
270 | niro | 221 | [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
271 | [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx | ||
272 | niro | 229 | |
273 | niro | 282 | # vars used by hwdetect |
274 | niro | 221 | local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
275 | local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER | ||
276 | local MOUSETYPE XMOUSETYPE FULLNAME DEVICE | ||
277 | niro | 229 | |
278 | niro | 282 | # get setting from hwdetect |
279 | niro | 221 | source /etc/sysconfig/hwsetup/knoppix |
280 | source /etc/sysconfig/hwsetup/mouse | ||
281 | niro | 229 | |
282 | niro | 221 | echo |
283 | echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT} | ||
284 | niro | 229 | |
285 | niro | 282 | # network |
286 | niro | 221 | echo -e " Network settings ..." |
287 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
288 | "insert into cfg_network( | ||
289 | hostname, | ||
290 | serial, | ||
291 | module, | ||
292 | domain, | ||
293 | networking | ||
294 | ) | ||
295 | values( | ||
296 | '${ALX_DEFAULT_HOSTNAME}', | ||
297 | '${ALX_SERIAL}', | ||
298 | '${NETCARD_DRIVER}', | ||
299 | '${ALX_DEFAULT_DOMAIN}', | ||
300 | 'dhcp' | ||
301 | );" | ||
302 | evaluate_retval | ||
303 | niro | 229 | |
304 | niro | 282 | # xserver |
305 | niro | 221 | echo -e " Graphic settings ..." |
306 | niro | 282 | # xserver general |
307 | niro | 221 | ( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ |
308 | "insert into cfg_graphic( | ||
309 | serial, | ||
310 | module, | ||
311 | resolution, | ||
312 | niro | 229 | depth, |
313 | monitorid | ||
314 | niro | 221 | ) |
315 | values( | ||
316 | '${ALX_SERIAL}', | ||
317 | '${XMODULE}', | ||
318 | '1024x768', | ||
319 | niro | 229 | '16', |
320 | '0' | ||
321 | niro | 252 | );"; ) |
322 | evaluate_retval | ||
323 | niro | 229 | |
324 | niro | 221 | # input |
325 | niro | 252 | echo -e " Input settings ..." |
326 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
327 | "insert into cfg_input(serial,mouse) values('${ALX_SERIAL}','${XMOUSETYPE}');" | ||
328 | niro | 221 | evaluate_retval |
329 | niro | 252 | |
330 | # auth | ||
331 | echo -e " Authentifcation settings ..." | ||
332 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
333 | "insert into client_auth( | ||
334 | serial, | ||
335 | username, | ||
336 | shell, | ||
337 | vnc, | ||
338 | samba, | ||
339 | station | ||
340 | ) | ||
341 | values( | ||
342 | '${ALX_SERIAL}', | ||
343 | '${ALX_UNPRIV_USER}', | ||
344 | '', | ||
345 | '', | ||
346 | '', | ||
347 | '' | ||
348 | );" | ||
349 | evaluate_retval | ||
350 | |||
351 | niro | 263 | # exchange ssh rsa keys - the first boot needs this ! |
352 | # or no reboot will work via the webadmin | ||
353 | echo -e " SSH authentifcation settings ..." | ||
354 | niro | 264 | HOME=/root config_ssh_auth |
355 | niro | 263 | evaluate_retval |
356 | |||
357 | niro | 252 | # input |
358 | echo -e " Autostart settings ..." | ||
359 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
360 | "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');" | ||
361 | evaluate_retval | ||
362 | niro | 221 | } |
363 | |||
364 | niro | 282 | # imports current settings to the database resolved by the hardware detection |
365 | update_settings_in_db() { | ||
366 | # note: networking is always 'dhcp' if hw was autodetected | ||
367 | # note: default_domain/hostname is set in config.rc or exported | ||
368 | # note: we updating only hardware settings here ! | ||
369 | |||
370 | # to be safe, we do some sanity checks | ||
371 | [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain | ||
372 | [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx | ||
373 | |||
374 | # vars used by hwdetect | ||
375 | local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME | ||
376 | local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER | ||
377 | local MOUSETYPE XMOUSETYPE FULLNAME DEVICE | ||
378 | |||
379 | # get setting from hwdetect | ||
380 | source /etc/sysconfig/hwsetup/knoppix | ||
381 | source /etc/sysconfig/hwsetup/mouse | ||
382 | |||
383 | echo | ||
384 | echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT} | ||
385 | |||
386 | # network | ||
387 | echo -e " Network settings ..." | ||
388 | |||
389 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
390 | "update cfg_network set | ||
391 | hostname='${ALX_DEFAULT_HOSTNAME}', | ||
392 | module='${NETCARD_DRIVER}', | ||
393 | domain='${ALX_DEFAULT_DOMAIN}', | ||
394 | networking='dhcp' | ||
395 | where serial=${ALX_SERIAL};" | ||
396 | evaluate_retval | ||
397 | |||
398 | # xserver | ||
399 | echo -e " Graphic settings ..." | ||
400 | # xserver general | ||
401 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
402 | "update cfg_graphic set | ||
403 | module='${XMODULE}', | ||
404 | resolution='1024x768', | ||
405 | depth='16', | ||
406 | monitorid='0' | ||
407 | where serial=${ALX_SERIAL};" | ||
408 | evaluate_retval | ||
409 | |||
410 | # input | ||
411 | echo -e " Input settings ..." | ||
412 | mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \ | ||
413 | "update cfg_input set | ||
414 | mouse='${XMOUSETYPE}' | ||
415 | where serial=${ALX_SERIAL};" | ||
416 | evaluate_retval | ||
417 | } | ||
418 | |||
419 | niro | 221 | # imports current settings to the local system resolved by the hardware detection |
420 | niro | 226 | # we only need the network settings |
421 | niro | 221 | import_settings_local(){ |
422 | niro | 282 | # note: networking is always 'dhcp' if hw was autodetected |
423 | # note: default_domain/hostname is set in config.rc | ||
424 | niro | 226 | |
425 | niro | 282 | # to be safe, we do some sanity checks |
426 | niro | 221 | [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain |
427 | [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx | ||
428 | niro | 226 | |
429 | niro | 282 | # vars used by hwdetect |
430 | niro | 221 | local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
431 | local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER | ||
432 | local MOUSETYPE XMOUSETYPE FULLNAME DEVICE | ||
433 | |||
434 | niro | 282 | # get setting from hwdetect |
435 | niro | 221 | source /etc/sysconfig/hwsetup/knoppix |
436 | niro | 226 | |
437 | niro | 221 | echo |
438 | echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT} | ||
439 | |||
440 | niro | 226 | [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH} |
441 | echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules | ||
442 | evaluate_retval | ||
443 | niro | 221 | |
444 | niro | 282 | # set system state to 'already configured' |
445 | niro | 226 | touch /etc/alxconfig-ng/state/configured |
446 | niro | 252 | |
447 | niro | 275 | # create a fresh fluxbox directory |
448 | [ -d ${ALX_UNPRIV_HOME}/.fluxbox ] && rm -rf ${ALX_UNPRIV_HOME}/.fluxbox | ||
449 | install -d ${ALX_UNPRIV_HOME}/.fluxbox | ||
450 | |||
451 | # now generate fluxbox config files | ||
452 | |||
453 | # fluxbox main config | ||
454 | cat ${ALX_SKELETONS}/fluxbox/init \ | ||
455 | > ${ALX_UNPRIV_HOME}/.fluxbox/init | ||
456 | |||
457 | # fluxbox menu header | ||
458 | cat ${ALX_SKELETONS}/fluxbox/menu.header \ | ||
459 | > ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
460 | |||
461 | niro | 297 | # now fix it with proper messages :P |
462 | local ver="$(< /etc/mageversion)" | ||
463 | sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" \ | ||
464 | ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
465 | |||
466 | niro | 275 | # add a newline (maybe there is no crlf in the header) |
467 | echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
468 | |||
469 | # fluxbox menu footer | ||
470 | cat ${ALX_SKELETONS}/fluxbox/menu.footer \ | ||
471 | >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
472 | |||
473 | # add a newline (maybe there is no crlf in the footer) | ||
474 | echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu | ||
475 | |||
476 | niro | 282 | # set correct permissions |
477 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME} | ||
478 | chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox | ||
479 | chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox | ||
480 | |||
481 | niro | 252 | # default passwords are bad |
482 | #usermod -p $(perl -e "printf(crypt('foobar','AD'))") root | ||
483 | #usermod -p $(perl -e "printf(crypt('foobar','AD'))") ${ALX_UNPRIV_USER} | ||
484 | #smbpasswd -a root foobar | ||
485 | niro | 221 | } |
486 | |||
487 | niro | 282 | # start|stop |
488 | niro | 221 | preliminary_network(){ |
489 | local module | ||
490 | niro | 226 | |
491 | if [ -f /etc/alxconfig-ng/state/configured ] | ||
492 | niro | 221 | then |
493 | niro | 282 | # get module name |
494 | niro | 226 | module=$(cat ${SETTINGSPATH}/modules) |
495 | niro | 221 | modprobe ${module} |
496 | else | ||
497 | niro | 282 | # vars used by hwdetect |
498 | niro | 221 | local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME |
499 | local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER | ||
500 | niro | 226 | |
501 | niro | 282 | # get setting from hwdetect |
502 | niro | 221 | source /etc/sysconfig/hwsetup/knoppix |
503 | modprobe ${NETCARD_DRIVER} | ||
504 | fi | ||
505 | niro | 226 | |
506 | niro | 221 | case $1 in |
507 | start) | ||
508 | # keeping like always safe: | ||
509 | # no network should be startet here, | ||
510 | # so we can delete all pid files if one exists | ||
511 | if ps -A|grep dhcpcd > /dev/null | ||
512 | then | ||
513 | echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT} | ||
514 | dhcpcd -k | ||
515 | sleep 1 | ||
516 | else | ||
517 | rm -f /var/run/dhcpcd-eth?.pid | ||
518 | fi | ||
519 | niro | 226 | |
520 | niro | 221 | echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT} |
521 | niro | 282 | # -t 10 timeout of 10 secs |
522 | dhcpcd -t 10 &> /dev/null | ||
523 | niro | 226 | |
524 | niro | 221 | # aka_fix ######################################## |
525 | niro | 226 | #ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up |
526 | #route del default gw 128.20.50.13 &> /dev/null | ||
527 | #route add default gw 128.20.50.21 &> /dev/null | ||
528 | #echo "nameserver 128.20.50.21" > /etc/resolv.conf | ||
529 | niro | 221 | ################################################## |
530 | niro | 226 | |
531 | niro | 221 | evaluate_retval |
532 | ;; | ||
533 | niro | 226 | |
534 | niro | 221 | stop) |
535 | echo -e ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT} | ||
536 | ifconfig eth0 down | ||
537 | if ps -A|grep dhcpcd > /dev/null | ||
538 | then | ||
539 | dhcpcd -z &> /dev/null | ||
540 | fi | ||
541 | evaluate_retval | ||
542 | ;; | ||
543 | niro | 226 | |
544 | niro | 221 | *) |
545 | echo "Usage: preliminary_network {start|stop}" | ||
546 | ;; | ||
547 | esac | ||
548 | } | ||
549 | |||
550 | case $1 in | ||
551 | start) | ||
552 | niro | 282 | # retrieve or validate current serial |
553 | niro | 221 | get_system_serial |
554 | niro | 282 | if [[ ${ALX_HW_DETECT} = true ]] |
555 | niro | 221 | then |
556 | niro | 282 | if [[ ${ALX_FORCED_RECHECK} = true ]] |
557 | then | ||
558 | update_settings_in_db | ||
559 | else | ||
560 | import_settings_to_db | ||
561 | fi | ||
562 | niro | 221 | import_settings_local |
563 | niro | 252 | |
564 | # here we should also exchange the ssh keys | ||
565 | # or the system cannot be rebooted after | ||
566 | # the first start via the alx-webadmin | ||
567 | config_ssh_auth | ||
568 | niro | 221 | fi |
569 | niro | 252 | |
570 | niro | 282 | # now setup system configuration |
571 | # alx_setup_or_whatever_it_will_be_called() | ||
572 | niro | 221 | [ "${ALX_HW_DETECT}" == "false" ] && update_system_settings |
573 | |||
574 | niro | 282 | # stop at last the preliminary networking (dhcp) |
575 | niro | 221 | preliminary_network stop |
576 | ;; | ||
577 | niro | 282 | |
578 | niro | 221 | stop) |
579 | niro | 282 | # unset_alx_connected #--> now in alxsetstate-rc6 |
580 | niro | 221 | # ! important !: del systemstate |
581 | niro | 226 | [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state |
582 | niro | 221 | sleep 0.1 |
583 | ;; | ||
584 | *) | ||
585 | echo "Usage: $0 {start|stop} ..." | ||
586 | ;; | ||
587 | esac | ||
588 | niro | 252 |
Properties
Name | Value |
---|---|
svn:executable | * |