Annotation of /trunk/installer-simple/bin/installer.sh.in
Parent Directory | Revision Log
Revision 2477 -
(hide annotations)
(download)
Wed Jan 8 10:21:09 2014 UTC (10 years, 8 months ago) by niro
File size: 16533 byte(s)
Wed Jan 8 10:21:09 2014 UTC (10 years, 8 months ago) by niro
File size: 16533 byte(s)
-split dialog_main() into task_main() and the dialog itself to dialog_main(), which moved to installer-dialogs.sh
1 | niro | 2323 | #!/bin/bash |
2 | niro | 2322 | # $Id$ |
3 | niro | 2320 | # |
4 | niro | 2322 | # Simple Installation Script |
5 | # merged from alxinstall-ng and mcore-installer | ||
6 | niro | 2320 | # |
7 | # Niels Rogalla <niro@magellan-linux.de> | ||
8 | # | ||
9 | |||
10 | niro | 2472 | # setup locales |
11 | TEXTDOMAIN=installer | ||
12 | LC_MESSAGES=C | ||
13 | |||
14 | niro | 2340 | # include dir |
15 | niro | 2333 | INSTALLER_LIBDIR="%LIBDIR%" |
16 | |||
17 | niro | 2340 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
18 | # -> now in images.conf | ||
19 | CURRENTLINE=0 | ||
20 | |||
21 | niro | 2397 | die() |
22 | { | ||
23 | echo "Error: $@" | ||
24 | exit 1 | ||
25 | } | ||
26 | |||
27 | niro | 2401 | # load common includes |
28 | niro | 2402 | for inc in %SYSCONFDIR%/installer.conf \ |
29 | ${INSTALLER_LIBDIR}/functions/common.sh \ | ||
30 | ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ | ||
31 | ${INSTALLER_LIBDIR}/functions/hwdetection.sh \ | ||
32 | niro | 2428 | ${INSTALLER_LIBDIR}/functions/bootloader.sh \ |
33 | ${INSTALLER_LIBDIR}/functions/initrd-tools.sh \ | ||
34 | niro | 2402 | ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
35 | niro | 2401 | do |
36 | if [ -e ${inc} ] | ||
37 | then | ||
38 | source "${inc}" | ||
39 | else | ||
40 | die "'${inc}' not found" | ||
41 | fi | ||
42 | done | ||
43 | niro | 2332 | |
44 | niro | 2340 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
45 | # -> now in images.conf | ||
46 | CDIMAGENAME="" | ||
47 | TOTALLINES="" | ||
48 | CURRENTLINE=0 | ||
49 | niro | 2334 | if [ -e /mnt/cdrom/system/images.conf ] |
50 | then | ||
51 | source /mnt/cdrom/system/images.conf | ||
52 | niro | 2340 | # check if all required variables are set |
53 | [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf" | ||
54 | [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf" | ||
55 | niro | 2334 | else |
56 | die "/mnt/cdrom/system/images.conf not found" | ||
57 | fi | ||
58 | niro | 2320 | |
59 | ### System/Config Version | ||
60 | VERSION="%VERSIONTAG%" | ||
61 | niro | 2332 | TITLE="${DEFAULT_TITLE} - ${VERSION}" |
62 | niro | 2320 | |
63 | niro | 2404 | # some sane defaults |
64 | niro | 2343 | CDROOT="${DEFAULT_CDROOT}" |
65 | niro | 2342 | INSTALLROOT="${DEFAULT_INSTALLROOT}" |
66 | niro | 2404 | KERNELPKG="${DEFAULT_KERNELPKG}" |
67 | KERNELOPTS="${DEFAULT_KERNELOPTS}" | ||
68 | niro | 2320 | GRUBLEGACYOPTS="" |
69 | GRUB2OPTS="" | ||
70 | FDISKPARTIONBELOW256MB=0 | ||
71 | SPECIALDEVICE="" | ||
72 | niro | 2404 | FORMFACTOR="${DEFAULT_FORMFACTOR}" |
73 | niro | 2332 | FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
74 | niro | 2320 | |
75 | ################################################# | ||
76 | # DIALOG BOXEN # | ||
77 | ################################################# | ||
78 | |||
79 | niro | 2409 | trap_exit() |
80 | { | ||
81 | is_mounted --location "${INSTALLROOT}/dev" && umount ${INSTALLROOT}/dev | ||
82 | is_mounted --location "${INSTALLROOT}/proc" && umount ${INSTALLROOT}/proc | ||
83 | is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys | ||
84 | is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot | ||
85 | is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} | ||
86 | |||
87 | echo $"Installation aborted." | ||
88 | exit 1 | ||
89 | } | ||
90 | |||
91 | niro | 2336 | dialog_die() |
92 | { | ||
93 | niro | 2341 | ERROR="$1" |
94 | RETVAL="$?" | ||
95 | niro | 2320 | dialog_install_failure |
96 | exit 1 | ||
97 | } | ||
98 | |||
99 | dialog_warning() | ||
100 | { | ||
101 | niro | 2398 | local retval |
102 | |||
103 | yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" | ||
104 | retval=$? | ||
105 | if [[ ${retval} -eq 1 ]] | ||
106 | niro | 2320 | then |
107 | clear | ||
108 | niro | 2398 | echo $"The process was aborted." |
109 | niro | 2320 | exit 1 |
110 | fi | ||
111 | } | ||
112 | |||
113 | niro | 2475 | task_setup_system_menu() |
114 | niro | 2320 | { |
115 | niro | 2412 | local mode |
116 | local retval | ||
117 | niro | 2320 | |
118 | niro | 2475 | mode="$(dialog_setup_system_menu)" |
119 | niro | 2412 | retval=$? |
120 | [[ ${retval} -eq 1 ]] && return 1 | ||
121 | if [[ ${retval} -eq 0 ]] | ||
122 | niro | 2320 | then |
123 | niro | 2415 | case "${mode}" in |
124 | niro | 2320 | "1") run_install_auto ;; |
125 | niro | 2341 | "2") run_install_normal ;; |
126 | niro | 2475 | "") task_setup_system_menu;; |
127 | niro | 2320 | esac |
128 | fi | ||
129 | } | ||
130 | |||
131 | dialog_hardware_detection() | ||
132 | { | ||
133 | niro | 2417 | local message |
134 | niro | 2320 | |
135 | niro | 2344 | run_hardware_detection_disks |
136 | niro | 2320 | |
137 | niro | 2417 | message+=$"Harddrives:\n" |
138 | niro | 2320 | |
139 | niro | 2344 | if [[ ! -z ${ALL_DISKS} ]] |
140 | niro | 2320 | then |
141 | niro | 2344 | for i in ${ALL_DISKS} |
142 | niro | 2320 | do |
143 | niro | 2417 | message+="\Z3${i}\Zn " |
144 | niro | 2320 | done |
145 | niro | 2417 | message+="\n" |
146 | niro | 2320 | fi |
147 | |||
148 | niro | 2344 | if [[ ! -z ${ALL_CDROMS} ]] |
149 | niro | 2320 | then |
150 | niro | 2417 | message+="\n" |
151 | message+=$"Optical disk drives:\n" | ||
152 | niro | 2344 | for i in ${ALL_CDROMS} |
153 | niro | 2320 | do |
154 | niro | 2417 | message+="\Z3${i}\Zn" |
155 | niro | 2320 | done |
156 | niro | 2417 | message+="\n" |
157 | niro | 2320 | fi |
158 | |||
159 | # other devices | ||
160 | run_hardware_detection | ||
161 | case "${SPECIALDEVICE}" in | ||
162 | niro | 2417 | zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
163 | rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; | ||
164 | maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; | ||
165 | niro | 2470 | *) message+=$"\n\ZnCommon device detected.\Zn" ;; |
166 | niro | 2320 | esac |
167 | if [[ ${FORMFACTOR} = laptop ]] | ||
168 | then | ||
169 | niro | 2460 | message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
170 | niro | 2320 | fi |
171 | |||
172 | niro | 2467 | messagebox -y 12 -h $"Detected hardware:" "${message}" |
173 | niro | 2320 | } |
174 | |||
175 | niro | 2413 | dialog_setup_hdd_partitions_manual() |
176 | niro | 2320 | { |
177 | local i | ||
178 | niro | 2422 | local retval |
179 | niro | 2320 | |
180 | niro | 2418 | if [[ -z ${ALL_DISKS} ]] |
181 | niro | 2320 | then |
182 | niro | 2421 | dialog_no_harddrive_found |
183 | niro | 2320 | exit 1 |
184 | else | ||
185 | niro | 2422 | HDD=$(dialog_select_target_harddrive) |
186 | retval=$? | ||
187 | [[ ${retval} -eq 1 ]] && return 1 | ||
188 | if [[ ${retval} -eq 0 ]] | ||
189 | niro | 2320 | then |
190 | dialog_setup_hdd_info | ||
191 | niro | 2413 | setup_hdd_partitions_manual |
192 | niro | 2320 | fi |
193 | fi | ||
194 | } | ||
195 | |||
196 | dialog_setup_hdd_partitions_auto() | ||
197 | { | ||
198 | local i | ||
199 | niro | 2422 | local retval |
200 | niro | 2320 | |
201 | niro | 2419 | if [[ -z ${ALL_DISKS} ]] |
202 | niro | 2320 | then |
203 | niro | 2421 | dialog_no_harddrive_found |
204 | niro | 2320 | exit 1 |
205 | else | ||
206 | niro | 2422 | HDD=$(dialog_select_target_harddrive) |
207 | retval=$? | ||
208 | [[ ${retval} -eq 1 ]] && return 1 | ||
209 | if [[ ${retval} -eq 0 ]] | ||
210 | niro | 2320 | then |
211 | dialog_setup_hdd_info_auto | ||
212 | dialog_setup_hdd_create_partitions | ||
213 | setup_hdd_partitions_auto | ||
214 | fi | ||
215 | fi | ||
216 | } | ||
217 | |||
218 | niro | 2423 | install_meter() |
219 | niro | 2320 | { |
220 | while [[ ${CURRENTLINE} != ${TOTALLINES} ]] | ||
221 | do | ||
222 | CURRENTLINE=$(grep -c . /tmp/install.log) | ||
223 | PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) | ||
224 | echo ${PERCENT} | ||
225 | sleep 1 | ||
226 | done | ||
227 | rm -f /tmp/install.log | ||
228 | return 0 | ||
229 | } | ||
230 | |||
231 | niro | 2477 | task_main() |
232 | niro | 2320 | { |
233 | niro | 2424 | local method=0 |
234 | local retval | ||
235 | niro | 2320 | |
236 | niro | 2424 | while [[ ${method} -le 2 ]] |
237 | niro | 2320 | do |
238 | niro | 2477 | method=$(dialog_main) |
239 | niro | 2424 | retval=$? |
240 | [[ ${retval} -eq 1 ]] && exit 1 | ||
241 | if [[ ${retval} -eq 0 ]] | ||
242 | niro | 2320 | then |
243 | niro | 2424 | case ${method} in |
244 | niro | 2475 | "1") task_setup_system_menu ;; |
245 | niro | 2320 | "2") dialog_hardware_detection ;; |
246 | "3") install_do_reboot ;; | ||
247 | "4") /bin/bash --login -i ;; | ||
248 | esac | ||
249 | fi | ||
250 | done | ||
251 | } | ||
252 | |||
253 | ################################################# | ||
254 | # Install Komandos # | ||
255 | ################################################# | ||
256 | run_hardware_detection() | ||
257 | { | ||
258 | local hwinfo | ||
259 | |||
260 | hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" | ||
261 | |||
262 | niro | 2430 | ## check for special devices/clients: |
263 | ## if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd | ||
264 | #local removable=0 | ||
265 | #if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] | ||
266 | #then | ||
267 | #for i in /sys/block/[hs]d*/removable | ||
268 | #do | ||
269 | #if [[ $(< ${i}) = 1 ]] | ||
270 | #then | ||
271 | #removable=1 | ||
272 | #fi | ||
273 | #done | ||
274 | niro | 2431 | ## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
275 | niro | 2320 | |
276 | niro | 2430 | ## only add this for grub legacy, grub2 detect these settings on its own |
277 | #export GRUBLEGACYOPTS="rootdelay=8" | ||
278 | ## there are to zotac types in the wild, nvidia based gfx and intel | ||
279 | #if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] | ||
280 | #then | ||
281 | #export SPECIALDEVICE="zotac_nvidia" | ||
282 | #else | ||
283 | #export SPECIALDEVICE="zotac_intel" | ||
284 | #fi | ||
285 | #fi | ||
286 | niro | 2320 | |
287 | # check for special devices/clients: | ||
288 | # if a rangee and disk ist smaller then 256mb move partion one block further ahead | ||
289 | if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] | ||
290 | then | ||
291 | # for a rangee always define partion startblock +1 | ||
292 | export FDISKPARTIONBELOW256MB="1" | ||
293 | export SPECIALDEVICE="rangee" | ||
294 | export GRUBLEGACYOPTS="" | ||
295 | fi | ||
296 | |||
297 | # check for special devices/clients: | ||
298 | # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer | ||
299 | if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]] | ||
300 | then | ||
301 | export SPECIALDEVICE="maxdata" | ||
302 | export GRUBLEGACYOPTS="" | ||
303 | fi | ||
304 | |||
305 | # check for special devices/clients: | ||
306 | # check for laptops and activate cpufreq scaling | ||
307 | if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] | ||
308 | then | ||
309 | export FORMFACTOR="laptop" | ||
310 | export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand" | ||
311 | fi | ||
312 | } | ||
313 | |||
314 | niro | 2429 | run_hardware_detection_disks() |
315 | { | ||
316 | local bootdev | ||
317 | |||
318 | # all disks but exclude ramdisks | ||
319 | export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') | ||
320 | # remove the boot device from ALL_DISKS if it was an usbstick | ||
321 | if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] | ||
322 | then | ||
323 | bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" | ||
324 | export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") | ||
325 | fi | ||
326 | export ALL_CDROMS="$(get_hwinfo cdrom)" | ||
327 | } | ||
328 | |||
329 | niro | 2320 | setup_hdd_partitions_auto() |
330 | { | ||
331 | ROOTHDD="${HDD}1" | ||
332 | |||
333 | niro | 2435 | # sanity check - should not happen |
334 | if is_mounted --device "${ROOTHDD}" | ||
335 | then | ||
336 | echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
337 | umount "${ROOTHDD}" | ||
338 | fi | ||
339 | |||
340 | niro | 2320 | # run this only if FDISKPARTITIONBELOW256MB is not already 1 |
341 | if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] | ||
342 | then | ||
343 | if hdd_size_below_256mb ${HDD} | ||
344 | then | ||
345 | FDISKPARTIONBELOW256MB=1 | ||
346 | else | ||
347 | FDISKPARTIONBELOW256MB=0 | ||
348 | fi | ||
349 | fi | ||
350 | |||
351 | ## delete disk | ||
352 | niro | 2336 | dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
353 | niro | 2320 | |
354 | if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] | ||
355 | then | ||
356 | ## setup one bootable partition | ||
357 | #1. n= new disk | ||
358 | #2. p= primary disk | ||
359 | #3. 1= first partition | ||
360 | #4. 2= default sector start // small disk needs more space for grub2 mbr sector | ||
361 | #5. ''= defaul sector end | ||
362 | #6. a= bootable flag | ||
363 | #7. 1= boot flag for partition 1 | ||
364 | #8. w= write/quit | ||
365 | fdisk ${HDD} &> /dev/null << EOF | ||
366 | n | ||
367 | p | ||
368 | 1 | ||
369 | 2 | ||
370 | |||
371 | a | ||
372 | 1 | ||
373 | w | ||
374 | EOF | ||
375 | else | ||
376 | ## setup one bootable partition | ||
377 | #1. n= new disk | ||
378 | #2. p= primary disk | ||
379 | #3. 1= first partition | ||
380 | #4. ''= default sector start | ||
381 | #5. ''= defaul sector end | ||
382 | #6. a= bootable flag | ||
383 | #7. 1= boot flag for partition 1 | ||
384 | #8. w= write/quit | ||
385 | fdisk ${HDD} &> /dev/null << EOF | ||
386 | n | ||
387 | p | ||
388 | 1 | ||
389 | |||
390 | |||
391 | a | ||
392 | 1 | ||
393 | w | ||
394 | EOF | ||
395 | fi | ||
396 | } | ||
397 | |||
398 | niro | 2413 | setup_hdd_partitions_manual() |
399 | niro | 2320 | { |
400 | ROOTHDD="${HDD}1" | ||
401 | niro | 2437 | SWAPHDD="" |
402 | BOOTHDD="" | ||
403 | niro | 2336 | cfdisk ${HDD} || dialog_die |
404 | niro | 2320 | } |
405 | |||
406 | setup_hdd_format() | ||
407 | { | ||
408 | niro | 2435 | # sanity check - should not happen |
409 | if is_mounted --device "${ROOTHDD}" | ||
410 | then | ||
411 | echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
412 | umount "${ROOTHDD}" | ||
413 | fi | ||
414 | |||
415 | niro | 2432 | mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die |
416 | niro | 2320 | } |
417 | |||
418 | install_mount_rootfs() | ||
419 | { | ||
420 | niro | 2435 | is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" |
421 | niro | 2342 | install -d ${INSTALLROOT}/boot || dialog_die |
422 | niro | 2320 | } |
423 | |||
424 | install_system_image() | ||
425 | { | ||
426 | niro | 2433 | pushd ${INSTALLROOT} > /dev/null |
427 | niro | 2343 | tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
428 | niro | 2433 | popd > /dev/null |
429 | niro | 2320 | } |
430 | |||
431 | niro | 2446 | disabled_install_bootsector_chroot() |
432 | niro | 2320 | { |
433 | local my_roothdd | ||
434 | niro | 2444 | local grubconf="${INSTALLROOT}/boot/grub/grub.conf" |
435 | local grub2conf="/boot/grub/grub.cfg" | ||
436 | niro | 2320 | |
437 | # check for grub2 | ||
438 | niro | 2342 | if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
439 | niro | 2320 | then |
440 | # needed by grub-mkconfig on the first run | ||
441 | niro | 2342 | if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] |
442 | niro | 2320 | then |
443 | niro | 2342 | install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die |
444 | niro | 2320 | fi |
445 | |||
446 | # set kernelopts | ||
447 | niro | 2342 | if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
448 | niro | 2320 | then |
449 | niro | 2342 | sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
450 | niro | 2320 | else |
451 | niro | 2444 | CONFIG="${INSTALLROOT}/etc/conf.d/grub" |
452 | clearconfig | ||
453 | addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" | ||
454 | niro | 2320 | fi |
455 | niro | 2444 | CONFIG="${INSTALLROOT}/root/.installrc" |
456 | clearconfig | ||
457 | # only grub 1.99 | ||
458 | addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap' | ||
459 | addconfig "grub-install --no-floppy ${HDD} &> /dev/null" | ||
460 | addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" | ||
461 | addconfig "exit 0" | ||
462 | niro | 2320 | |
463 | # grub-legacy | ||
464 | else | ||
465 | niro | 2342 | source ${INSTALLROOT}/boot/kernelversion |
466 | niro | 2320 | |
467 | niro | 2342 | if [ -e ${INSTALLROOT}/etc/alx_version ] |
468 | niro | 2320 | then |
469 | OLD_ALXVER="${ALXVER}" | ||
470 | niro | 2342 | source ${INSTALLROOT}/etc/alx_version |
471 | niro | 2320 | KRNVER="ALX-${ALXVER}" |
472 | ALXVER="${OLD_ALXVER}" | ||
473 | fi | ||
474 | |||
475 | [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" | ||
476 | [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" | ||
477 | [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" | ||
478 | |||
479 | # uuid support | ||
480 | niro | 2441 | my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
481 | niro | 2320 | |
482 | niro | 2444 | CONFIG="${grubconf}" |
483 | clearconfig | ||
484 | addconfig "default 0" | ||
485 | addconfig "timeout 3" | ||
486 | niro | 2320 | # using current root password |
487 | niro | 2444 | addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" |
488 | niro | 2320 | |
489 | niro | 2444 | addconfig |
490 | addconfig "# normal boot" | ||
491 | addconfig "title ${KRNVER}" | ||
492 | addconfig "root (hd0,0)" | ||
493 | addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" | ||
494 | niro | 2320 | if is_initrd_supported |
495 | then | ||
496 | niro | 2444 | addconfig "initrd /boot/${KRNINITRD}" |
497 | niro | 2320 | fi |
498 | |||
499 | niro | 2444 | addconfig |
500 | addconfig "# admin boot" | ||
501 | addconfig "title ${KRNVER} - Re-run hardware-detection" | ||
502 | addconfig "lock" | ||
503 | addconfig "root (hd0,0)" | ||
504 | addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" | ||
505 | niro | 2320 | if is_initrd_supported |
506 | then | ||
507 | niro | 2444 | addconfig "initrd /boot/${KRNINITRD}" |
508 | niro | 2320 | fi |
509 | |||
510 | niro | 2444 | addconfig |
511 | addconfig "title ${KRNVER} - Reset *all* local settings" | ||
512 | addconfig "lock" | ||
513 | addconfig "root (hd0,0)" | ||
514 | addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" | ||
515 | niro | 2320 | if is_initrd_supported |
516 | then | ||
517 | niro | 2444 | addconfig "initrd /boot/${KRNINITRD}" |
518 | niro | 2320 | fi |
519 | |||
520 | # bootsector schreiben chrooted schreiben (lfs/magellan) | ||
521 | niro | 2342 | cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
522 | niro | 2320 | /usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
523 | root (hd0,0) | ||
524 | setup (hd0) | ||
525 | quit | ||
526 | EOF | ||
527 | exit 0 | ||
528 | CHROOTEOF | ||
529 | fi | ||
530 | |||
531 | niro | 2436 | # run installrc |
532 | chrooted /bin/bash --rcfile /root/.installrc -i | ||
533 | niro | 2342 | rm ${INSTALLROOT}/root/.installrc |
534 | niro | 2320 | } |
535 | |||
536 | niro | 2446 | disabled_install_initrd_chroot() |
537 | niro | 2320 | { |
538 | # only generate initrds if the cmd exists | ||
539 | is_initrd_supported || return 0 | ||
540 | |||
541 | DISKMODS="sd_mod" | ||
542 | OLDPATAMODS="amd74xx piix sis5513 via82cxxx" | ||
543 | PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" | ||
544 | SATAMODS="sata_via sata_sis sata_nv" | ||
545 | DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" | ||
546 | OTHERMODS="" | ||
547 | case ${SPECIALDEVICE} in | ||
548 | zotac_intel) FBMODS=""; DRMMODS="i915" ;; | ||
549 | zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;; | ||
550 | rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards | ||
551 | # not working with kms enabled drivers -> segfaults | ||
552 | #maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer | ||
553 | maxdata) FBMODS="" ;; | ||
554 | *) FBMODS="uvesafb" ;; | ||
555 | esac | ||
556 | |||
557 | if [[ ${FORMFACTOR} = laptop ]] | ||
558 | then | ||
559 | OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" | ||
560 | fi | ||
561 | |||
562 | # install an appropriate uvesafb.conf | ||
563 | niro | 2342 | install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
564 | niro | 2444 | CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf" |
565 | clearconfig | ||
566 | addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" | ||
567 | niro | 2320 | |
568 | # install an appropriate viafb.conf | ||
569 | niro | 2444 | CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf" |
570 | clearconfig | ||
571 | addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60" | ||
572 | niro | 2320 | |
573 | # install an appropriate i810fb.conf | ||
574 | niro | 2444 | CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf" |
575 | clearconfig | ||
576 | addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" | ||
577 | niro | 2320 | |
578 | niro | 2342 | cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
579 | niro | 2320 | echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
580 | mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null | ||
581 | exit 0 | ||
582 | CHROOTEOF | ||
583 | |||
584 | niro | 2436 | # run installrc |
585 | chrooted /bin/bash --rcfile /root/.installrc -i | ||
586 | niro | 2342 | rm ${INSTALLROOT}/root/.installrc |
587 | niro | 2320 | } |
588 | |||
589 | install_system_settings() | ||
590 | { | ||
591 | niro | 2443 | local CONFIG |
592 | niro | 2320 | |
593 | niro | 2443 | # write fstab |
594 | CONFIG="${INSTALLROOT}/etc/fstab" | ||
595 | clearconfig | ||
596 | addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" | ||
597 | addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" | ||
598 | addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" | ||
599 | |||
600 | niro | 2320 | # install network config skeleton |
601 | niro | 2443 | CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
602 | clearconfig | ||
603 | addconfig 'ONBOOT="yes"' | ||
604 | addconfig 'NETWORKING="dhcp"' | ||
605 | niro | 2320 | |
606 | niro | 2442 | # intel framebuffer quirk |
607 | if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] | ||
608 | niro | 2320 | then |
609 | niro | 2442 | if [ -e /proc/fb ] |
610 | niro | 2320 | then |
611 | niro | 2442 | if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
612 | niro | 2320 | then |
613 | niro | 2442 | fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
614 | if [[ ${fbdev} != 0 ]] | ||
615 | then | ||
616 | sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die | ||
617 | fi | ||
618 | niro | 2320 | fi |
619 | fi | ||
620 | fi | ||
621 | } | ||
622 | |||
623 | install_umount_rootfs() | ||
624 | { | ||
625 | niro | 2435 | is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
626 | is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} | ||
627 | niro | 2320 | } |
628 | |||
629 | install_do_reboot() | ||
630 | { | ||
631 | reboot | ||
632 | } | ||
633 | |||
634 | ################################################# | ||
635 | # Install Ablauf Scripte # | ||
636 | ################################################# | ||
637 | |||
638 | run_install_normal() | ||
639 | { | ||
640 | dialog_hardware_detection | ||
641 | |||
642 | niro | 2413 | dialog_setup_hdd_partitions_manual |
643 | niro | 2320 | dialog_setup_hdd_format |
644 | setup_hdd_format > /dev/null | ||
645 | install_mount_rootfs | ||
646 | niro | 2423 | (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
647 | niro | 2320 | |
648 | dialog_install_settings | ||
649 | sleep 1 | ||
650 | install_system_settings | ||
651 | niro | 2440 | if is_initrd_supported |
652 | then | ||
653 | dialog_install_initrd | ||
654 | initrd_config | ||
655 | initrd_install | ||
656 | fi | ||
657 | niro | 2320 | |
658 | dialog_install_bootsector | ||
659 | niro | 2440 | bootloader_config |
660 | bootloader_install | ||
661 | niro | 2320 | |
662 | install_umount_rootfs | ||
663 | dialog_install_successful | ||
664 | } | ||
665 | |||
666 | run_install_auto() | ||
667 | { | ||
668 | dialog_hardware_detection | ||
669 | |||
670 | dialog_setup_hdd_partitions_auto | ||
671 | dialog_setup_hdd_format | ||
672 | niro | 2399 | setup_hdd_format > /dev/null |
673 | install_mount_rootfs | ||
674 | niro | 2423 | (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
675 | niro | 2320 | |
676 | dialog_install_settings | ||
677 | sleep 1 | ||
678 | niro | 2399 | install_system_settings |
679 | niro | 2440 | if is_initrd_supported |
680 | then | ||
681 | dialog_install_initrd | ||
682 | initrd_config | ||
683 | initrd_install | ||
684 | fi | ||
685 | niro | 2320 | |
686 | dialog_install_bootsector | ||
687 | niro | 2440 | bootloader_config |
688 | bootloader_install | ||
689 | niro | 2320 | |
690 | niro | 2399 | install_umount_rootfs |
691 | niro | 2320 | dialog_install_successful |
692 | } | ||
693 | |||
694 | niro | 2409 | # set some proper traps |
695 | trap "trap_exit" SIGINT SIGQUIT | ||
696 | |||
697 | niro | 2477 | task_main |
698 | niro | 2320 | |
699 | exit 0 |