Magellan Linux

Annotation of /alx-src/trunk/alxconfig-ng/init.d/alxsettings

Parent Directory Parent Directory | Revision Log Revision Log


Revision 319 - (hide annotations) (download)
Thu Sep 1 18:30:28 2005 UTC (18 years, 8 months ago) by niro
File size: 17126 byte(s)
added missing .fluxbos/app for autostart

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 319 # $Header: /home/cvsd/alx-cvs/alx-src/alxconfig-ng/init.d/alxsettings,v 1.21 2005-09-01 18:30:28 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 313 # we're using the mtime now (better for validating the serial)
200     # 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     #
210     # # then validate and retrieve serial
211     #
212     # ### 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     # ### you have more than one serial number then ###
215     #
216     # # select highest id only (added max)
217     # 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 niro 226
220 niro 313 # request a new serial; one command now (cause must be done in the same session)
221 niro 221 ALX_SERIAL=$(mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
222 niro 313 "insert into client_serials (mtime, mac) values('${CUR_MTIME}','${CUR_MAC}');
223 niro 314 select last_insert_id();")
224 niro 221
225     if [ "${ALX_SERIAL}" != NULL ]
226     then
227 niro 282 # nice serial output
228 niro 221 $CURS_UP
229     $SET_WCOL
230     echo "[ SN: ${ALX_SERIAL} ]"
231 niro 226
232 niro 282 # set ALX_STATE to ok so everybody that everything was ok
233 niro 221 ALX_STATE=ok
234 niro 226
235     echo "ALX_SERIAL=${ALX_SERIAL}" > /etc/alxconfig-ng/serial
236     echo "ALX_REG_DATE=${CUR_MTIME}" >> /etc/alxconfig-ng/serial
237    
238 niro 221 evaluate_retval
239     else
240 niro 282 # print false (works only if this is the first statement here)
241 niro 221 evaluate_retval
242 niro 226
243 niro 282 # set ALX_STATE to error so everybody sees there was an error
244 niro 221 ALX_STATE=error
245 niro 226
246 niro 282 # show an error that no new serial was found
247     # nice serial output
248 niro 221 $CURS_UP
249     $SET_WCOL
250     echo -e "[ SN: ${COLRED}None, 0${COLDEFAULT} ]"
251     fi
252     fi
253 niro 226
254 niro 282 # write current state to temp file
255 niro 226 echo "ALX_STATE=${ALX_STATE}" > /etc/alxconfig-ng/state/state
256 niro 221 }
257    
258    
259     check_is_configured() {
260 niro 226 if [ -f /etc/alxconfig-ng/state/configured ]
261 niro 221 then
262     export ALX_CONFIGURED=true
263     else
264     export ALX_CONFIGURED=false
265     fi
266     }
267    
268    
269     # imports current settings to the database resolved by the hardware detection
270     import_settings_to_db() {
271 niro 282 # note: networking is always 'dhcp' if hw was autodetected
272     # note: default_domain/hostname is set in config.rc
273 niro 229
274 niro 282 # to be safe, we do some sanity checks
275 niro 221 [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
276     [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
277 niro 229
278 niro 282 # vars used by hwdetect
279 niro 221 local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
280     local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
281     local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
282 niro 229
283 niro 282 # get setting from hwdetect
284 niro 221 source /etc/sysconfig/hwsetup/knoppix
285     source /etc/sysconfig/hwsetup/mouse
286 niro 229
287 niro 221 echo
288     echo -e ${COLMAGENTA}"Importing detected settings to database"${COLDEFAULT}
289 niro 229
290 niro 282 # network
291 niro 221 echo -e " Network settings ..."
292     mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
293     "insert into cfg_network(
294     hostname,
295     serial,
296     module,
297     domain,
298     networking
299     )
300     values(
301     '${ALX_DEFAULT_HOSTNAME}',
302     '${ALX_SERIAL}',
303     '${NETCARD_DRIVER}',
304     '${ALX_DEFAULT_DOMAIN}',
305     'dhcp'
306     );"
307     evaluate_retval
308 niro 229
309 niro 282 # xserver
310 niro 221 echo -e " Graphic settings ..."
311 niro 282 # xserver general
312 niro 221 ( mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
313     "insert into cfg_graphic(
314     serial,
315     module,
316     resolution,
317 niro 229 depth,
318     monitorid
319 niro 221 )
320     values(
321     '${ALX_SERIAL}',
322     '${XMODULE}',
323     '1024x768',
324 niro 229 '16',
325     '0'
326 niro 252 );"; )
327     evaluate_retval
328 niro 229
329 niro 221 # input
330 niro 252 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 niro 221 evaluate_retval
334 niro 252
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,
340     username,
341     shell,
342     vnc,
343     samba,
344     station
345     )
346     values(
347     '${ALX_SERIAL}',
348     '${ALX_UNPRIV_USER}',
349     '',
350     '',
351     '',
352     ''
353     );"
354     evaluate_retval
355    
356 niro 263 # 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 niro 264 HOME=/root config_ssh_auth
360 niro 263 evaluate_retval
361    
362 niro 252 # input
363     echo -e " Autostart settings ..."
364     mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
365     "insert into cfg_autostart(serial,session) values('${ALX_SERIAL}','');"
366     evaluate_retval
367 niro 221 }
368    
369 niro 282 # imports current settings to the database resolved by the hardware detection
370     update_settings_in_db() {
371     # note: networking is always 'dhcp' if hw was autodetected
372     # note: default_domain/hostname is set in config.rc or exported
373     # note: we updating only hardware settings here !
374    
375     # to be safe, we do some sanity checks
376     [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
377     [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
378    
379     # vars used by hwdetect
380     local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
381     local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
382     local MOUSETYPE XMOUSETYPE FULLNAME DEVICE
383    
384     # get setting from hwdetect
385     source /etc/sysconfig/hwsetup/knoppix
386     source /etc/sysconfig/hwsetup/mouse
387    
388     echo
389     echo -e ${COLMAGENTA}"Updating detected settings in database"${COLDEFAULT}
390    
391     # network
392     echo -e " Network settings ..."
393    
394     mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
395     "update cfg_network set
396     hostname='${ALX_DEFAULT_HOSTNAME}',
397     module='${NETCARD_DRIVER}',
398     domain='${ALX_DEFAULT_DOMAIN}',
399     networking='dhcp'
400     where serial=${ALX_SERIAL};"
401     evaluate_retval
402    
403     # xserver
404     echo -e " Graphic settings ..."
405     # xserver general
406     mysql_command ${SQL_USER} ${SQL_PASS} ${SQL_HOST} ${SQL_DB} \
407     "update cfg_graphic set
408     module='${XMODULE}',
409     resolution='1024x768',
410     depth='16',
411     monitorid='0'
412     where serial=${ALX_SERIAL};"
413     evaluate_retval
414    
415     # input
416     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 niro 221 # imports current settings to the local system resolved by the hardware detection
425 niro 226 # we only need the network settings
426 niro 221 import_settings_local(){
427 niro 282 # note: networking is always 'dhcp' if hw was autodetected
428     # note: default_domain/hostname is set in config.rc
429 niro 226
430 niro 282 # to be safe, we do some sanity checks
431 niro 221 [ -z "${ALX_DEFAULT_DOMAIN}" ] && ALX_DEFAULT_DOMAIN=localdomain
432     [ -z "${ALX_DEFAULT_HOSTNAME}" ] && ALX_DEFAULT_HOSTNAME=magellan-alx
433 niro 226
434 niro 282 # vars used by hwdetect
435 niro 221 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 niro 282 # get setting from hwdetect
440 niro 221 source /etc/sysconfig/hwsetup/knoppix
441 niro 226
442 niro 221 echo
443     echo -e ${COLMAGENTA}"Importing detected settings to local system"${COLDEFAULT}
444    
445 niro 226 [ ! -d ${SETTINGSPATH} ] && install -d ${SETTINGSPATH}
446     echo "${NETCARD_DRIVER}" > ${SETTINGSPATH}/modules
447     evaluate_retval
448 niro 221
449 niro 282 # set system state to 'already configured'
450 niro 226 touch /etc/alxconfig-ng/state/configured
451 niro 252
452 niro 313 # if only an recheck was forced than abort now
453     [[ ${ALX_FORCED_RECHECK} = true ]] && return 0
454    
455 niro 275 # 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 niro 319 # fluxbox autostart
466     cat ${ALX_SKELETONS}/fluxbox/apps \
467     > ${ALX_UNPRIV_HOME}/.fluxbox/apps
468    
469 niro 275 # fluxbox menu header
470     cat ${ALX_SKELETONS}/fluxbox/menu.header \
471     > ${ALX_UNPRIV_HOME}/.fluxbox/menu
472    
473 niro 297 # now fix it with proper messages :P
474     local ver="$(< /etc/mageversion)"
475     sed -i "s:@CHANGEME@:alx-${ver} #${ALX_SERIAL}:g" \
476     ${ALX_UNPRIV_HOME}/.fluxbox/menu
477    
478 niro 275 # add a newline (maybe there is no crlf in the header)
479     echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
480    
481     # fluxbox menu footer
482     cat ${ALX_SKELETONS}/fluxbox/menu.footer \
483     >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
484    
485     # add a newline (maybe there is no crlf in the footer)
486     echo >> ${ALX_UNPRIV_HOME}/.fluxbox/menu
487    
488 niro 313
489     # setup some standart icons (sysinfo.lnk)
490     # basic config
491     cat ${ALX_SKELETONS}/xtdesktop/xtdeskrc > ${ALX_UNPRIV_HOME}/.xtdeskrc
492    
493     # clean desktop icon location
494     [ -d ${ALX_UNPRIV_HOME}/.xtdesktop ] && rm -rf ${ALX_UNPRIV_HOME}/.xtdesktop
495     install -d ${ALX_UNPRIV_HOME}/.xtdesktop
496    
497     # last but not least gen a icon with some sys informations
498     local sysinfo
499     local osversion
500     local xres
501     local yres
502    
503     osversion="$(< /etc/mageversion)"
504     sysinfo="Hostname: ${ALX_DEFAULT_HOSTNAME} Serial: #${ALX_SERIAL} OS: alx-${osversion} Kernel: $(uname -r)"
505    
506     # at first boot we got always a resolution of 1024x768-16@60
507     # middle of the screen
508     # (no txt - length required, xtdesk manage that itself)
509     xres="$((1024 / 2))"
510     # default y pos (full yres -22 !)
511     yres="$((768 - 22 ))"
512    
513     generate_icon \
514     --name "${sysinfo}" \
515     --command "exit 0" \
516     --icon "${ALX_SESSIONS_ICONS}/sysinfo.png" \
517     --dest "${ALX_UNPRIV_HOME}/.xtdesktop/sysinfo.lnk" \
518     --xres "${xres}" \
519     --yres "${yres}" \
520     --icon-width "1" \
521     --icon-height "1"
522    
523 niro 282 # set correct permissions
524     chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}
525     chown ${ALX_UNPRIV_USER}:${ALX_UNPRIV_GROUP} ${ALX_UNPRIV_HOME}/.fluxbox
526     chmod 0755 ${ALX_UNPRIV_HOME}/.fluxbox
527 niro 313 chmod 0755 ${ALX_UNPRIV_HOME}/.xtdesktop
528     chmod 0644 ${ALX_UNPRIV_HOME}/.xtdeskrc
529 niro 282
530 niro 252 # default passwords are bad
531     #usermod -p $(perl -e "printf(crypt('foobar','AD'))") root
532     #usermod -p $(perl -e "printf(crypt('foobar','AD'))") ${ALX_UNPRIV_USER}
533     #smbpasswd -a root foobar
534 niro 221 }
535    
536 niro 282 # start|stop
537 niro 221 preliminary_network(){
538     local module
539 niro 226
540     if [ -f /etc/alxconfig-ng/state/configured ]
541 niro 221 then
542 niro 282 # get module name
543 niro 226 module=$(cat ${SETTINGSPATH}/modules)
544 niro 221 modprobe ${module}
545     else
546 niro 282 # vars used by hwdetect
547 niro 221 local NETCARD_FULLNAME NETCARD_DRIVER MOUSE_FULLNAME MOUSE_DEVICE SOUND_FULLNAME
548     local SOUND_DRIVER XSERVER XMODULE XDESC FLOPPY_FULLNAME FLOPPY_DEVICE FLOPPY_DRIVER
549 niro 226
550 niro 282 # get setting from hwdetect
551 niro 221 source /etc/sysconfig/hwsetup/knoppix
552     modprobe ${NETCARD_DRIVER}
553     fi
554 niro 226
555 niro 221 case $1 in
556     start)
557     # keeping like always safe:
558     # no network should be startet here,
559     # so we can delete all pid files if one exists
560     if ps -A|grep dhcpcd > /dev/null
561     then
562     echo -e ${COLMAGENTA}"Forcing network down"${COLDEFAULT}
563     dhcpcd -k
564     sleep 1
565     else
566     rm -f /var/run/dhcpcd-eth?.pid
567     fi
568 niro 226
569 niro 221 echo -e ${COLMAGENTA}"Starting preliminary network ... "${COLDEFAULT}
570 niro 282 # -t 10 timeout of 10 secs
571     dhcpcd -t 10 &> /dev/null
572 niro 226
573 niro 221 # aka_fix ########################################
574 niro 226 #ifconfig eth0 128.20.222.222 netmask 255.255.0.0 up
575     #route del default gw 128.20.50.13 &> /dev/null
576     #route add default gw 128.20.50.21 &> /dev/null
577     #echo "nameserver 128.20.50.21" > /etc/resolv.conf
578 niro 221 ##################################################
579 niro 226
580 niro 221 evaluate_retval
581     ;;
582 niro 226
583 niro 221 stop)
584     echo -e ${COLMAGENTA}"Stopping preliminary network ... "${COLDEFAULT}
585     ifconfig eth0 down
586     if ps -A|grep dhcpcd > /dev/null
587     then
588     dhcpcd -z &> /dev/null
589     fi
590     evaluate_retval
591     ;;
592 niro 226
593 niro 221 *)
594     echo "Usage: preliminary_network {start|stop}"
595     ;;
596     esac
597     }
598    
599     case $1 in
600     start)
601 niro 282 # retrieve or validate current serial
602 niro 221 get_system_serial
603 niro 282 if [[ ${ALX_HW_DETECT} = true ]]
604 niro 221 then
605 niro 282 if [[ ${ALX_FORCED_RECHECK} = true ]]
606     then
607     update_settings_in_db
608     else
609     import_settings_to_db
610     fi
611 niro 221 import_settings_local
612 niro 252
613     # here we should also exchange the ssh keys
614     # or the system cannot be rebooted after
615     # the first start via the alx-webadmin
616     config_ssh_auth
617 niro 221 fi
618 niro 252
619 niro 282 # now setup system configuration
620     # alx_setup_or_whatever_it_will_be_called()
621 niro 221 [ "${ALX_HW_DETECT}" == "false" ] && update_system_settings
622    
623 niro 282 # stop at last the preliminary networking (dhcp)
624 niro 221 preliminary_network stop
625     ;;
626 niro 282
627 niro 221 stop)
628 niro 282 # unset_alx_connected #--> now in alxsetstate-rc6
629 niro 221 # ! important !: del systemstate
630 niro 226 [ -f /etc/alxconfig-ng/state/state ] && rm /etc/alxconfig-ng/state/state
631 niro 221 sleep 0.1
632     ;;
633     *)
634     echo "Usage: $0 {start|stop} ..."
635     ;;
636     esac
637 niro 252

Properties

Name Value
svn:executable *