Annotation of /trunk/installer-simple/bin/installer.sh.in
Parent Directory | Revision Log
Revision 2883 -
(hide annotations)
(download)
Fri Jul 31 09:42:12 2015 UTC (8 years, 10 months ago) by niro
File size: 12822 byte(s)
Fri Jul 31 09:42:12 2015 UTC (8 years, 10 months ago) by niro
File size: 12822 byte(s)
-not every mkfs.FS prog like the -q option, pipe the output into a log file instead
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 | |||
13 | niro | 2340 | # include dir |
14 | niro | 2333 | INSTALLER_LIBDIR="%LIBDIR%" |
15 | |||
16 | niro | 2340 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
17 | # -> now in images.conf | ||
18 | CURRENTLINE=0 | ||
19 | |||
20 | niro | 2397 | die() |
21 | { | ||
22 | echo "Error: $@" | ||
23 | exit 1 | ||
24 | } | ||
25 | |||
26 | niro | 2401 | # load common includes |
27 | niro | 2402 | for inc in %SYSCONFDIR%/installer.conf \ |
28 | ${INSTALLER_LIBDIR}/functions/common.sh \ | ||
29 | ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ | ||
30 | ${INSTALLER_LIBDIR}/functions/hwdetection.sh \ | ||
31 | niro | 2428 | ${INSTALLER_LIBDIR}/functions/bootloader.sh \ |
32 | ${INSTALLER_LIBDIR}/functions/initrd-tools.sh \ | ||
33 | niro | 2402 | ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
34 | niro | 2401 | do |
35 | if [ -e ${inc} ] | ||
36 | then | ||
37 | source "${inc}" | ||
38 | else | ||
39 | die "'${inc}' not found" | ||
40 | fi | ||
41 | done | ||
42 | niro | 2332 | |
43 | niro | 2320 | ### System/Config Version |
44 | VERSION="%VERSIONTAG%" | ||
45 | niro | 2332 | TITLE="${DEFAULT_TITLE} - ${VERSION}" |
46 | niro | 2320 | |
47 | niro | 2404 | # some sane defaults |
48 | niro | 2653 | LIVEROOT="${DEFAULT_LIVEROOT}" |
49 | niro | 2642 | IMAGEROOT="${DEFAULT_IMAGEROOT}" |
50 | niro | 2342 | INSTALLROOT="${DEFAULT_INSTALLROOT}" |
51 | niro | 2404 | KERNELPKG="${DEFAULT_KERNELPKG}" |
52 | KERNELOPTS="${DEFAULT_KERNELOPTS}" | ||
53 | niro | 2320 | GRUBLEGACYOPTS="" |
54 | GRUB2OPTS="" | ||
55 | FDISKPARTIONBELOW256MB=0 | ||
56 | SPECIALDEVICE="" | ||
57 | niro | 2404 | FORMFACTOR="${DEFAULT_FORMFACTOR}" |
58 | niro | 2332 | FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
59 | niro | 2320 | |
60 | niro | 2642 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
61 | # -> now in images.conf | ||
62 | CDIMAGENAME="" | ||
63 | TOTALLINES="" | ||
64 | CURRENTLINE=0 | ||
65 | if [ -e ${IMAGEROOT}/images.conf ] | ||
66 | then | ||
67 | source ${IMAGEROOT}/images.conf | ||
68 | # check if all required variables are set | ||
69 | [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf" | ||
70 | [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf" | ||
71 | else | ||
72 | die "${IMAGEROOT}/images.conf not found" | ||
73 | fi | ||
74 | niro | 2320 | |
75 | niro | 2482 | ### helper scripts ### |
76 | |||
77 | niro | 2409 | trap_exit() |
78 | { | ||
79 | is_mounted --location "${INSTALLROOT}/dev" && umount ${INSTALLROOT}/dev | ||
80 | is_mounted --location "${INSTALLROOT}/proc" && umount ${INSTALLROOT}/proc | ||
81 | is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys | ||
82 | is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot | ||
83 | is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} | ||
84 | |||
85 | echo $"Installation aborted." | ||
86 | exit 1 | ||
87 | } | ||
88 | |||
89 | niro | 2423 | install_meter() |
90 | niro | 2320 | { |
91 | while [[ ${CURRENTLINE} != ${TOTALLINES} ]] | ||
92 | do | ||
93 | CURRENTLINE=$(grep -c . /tmp/install.log) | ||
94 | PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) | ||
95 | echo ${PERCENT} | ||
96 | sleep 1 | ||
97 | done | ||
98 | rm -f /tmp/install.log | ||
99 | return 0 | ||
100 | } | ||
101 | |||
102 | niro | 2882 | install_mount_rootfs() |
103 | { | ||
104 | local opts | ||
105 | |||
106 | if [[ -n ${SWAPHDD} ]] | ||
107 | then | ||
108 | swapon ${SWAPHDD} || die | ||
109 | fi | ||
110 | if [[ -n ${ROOTHDD} ]] | ||
111 | then | ||
112 | mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die | ||
113 | fi | ||
114 | if [[ -n ${BOOTHDD} ]] | ||
115 | then | ||
116 | install -d ${INSTALL_ROOT}/boot || die | ||
117 | mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die | ||
118 | fi | ||
119 | |||
120 | cd ${INSTALL_ROOT} || die | ||
121 | } | ||
122 | |||
123 | |||
124 | niro | 2485 | mount_rootfs() |
125 | niro | 2484 | { |
126 | niro | 2489 | local retval |
127 | |||
128 | niro | 2882 | if [[ -n ${SWAPHDD} ]] |
129 | niro | 2489 | then |
130 | niro | 2882 | swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'" |
131 | niro | 2489 | fi |
132 | niro | 2882 | |
133 | if [[ -n ${ROOTHDD} ]] | ||
134 | then | ||
135 | if is_mounted --location "${INSTALLROOT}" | ||
136 | then | ||
137 | echo $"${INSTALLROOT} already mounted" >&2 | ||
138 | else | ||
139 | mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" | ||
140 | fi | ||
141 | fi | ||
142 | |||
143 | niro | 2486 | [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
144 | niro | 2882 | |
145 | if [[ -n ${BOOTHDD} ]] | ||
146 | then | ||
147 | if is_mounted --location "${INSTALLROOT}"/boot | ||
148 | then | ||
149 | echo $"${INSTALLROOT}/boot already mounted" >&2 | ||
150 | else | ||
151 | mount "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" | ||
152 | fi | ||
153 | fi | ||
154 | niro | 2484 | } |
155 | |||
156 | niro | 2485 | umount_rootfs() |
157 | niro | 2484 | { |
158 | is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot | ||
159 | is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} | ||
160 | niro | 2882 | |
161 | if [[ -n ${SWAPHDD} ]] | ||
162 | then | ||
163 | swapoff ${SWAPHDD} || die | ||
164 | fi | ||
165 | niro | 2484 | } |
166 | |||
167 | install_do_reboot() | ||
168 | { | ||
169 | reboot | ||
170 | } | ||
171 | |||
172 | niro | 2320 | run_hardware_detection() |
173 | { | ||
174 | local hwinfo | ||
175 | |||
176 | hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" | ||
177 | |||
178 | niro | 2654 | # check for special devices/clients: |
179 | # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd | ||
180 | local removable=0 | ||
181 | if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] | ||
182 | then | ||
183 | niro | 2430 | #for i in /sys/block/[hs]d*/removable |
184 | #do | ||
185 | niro | 2654 | # if [[ $(< ${i}) = 1 ]] |
186 | # then | ||
187 | # removable=1 | ||
188 | # fi | ||
189 | niro | 2430 | #done |
190 | niro | 2654 | # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
191 | niro | 2320 | |
192 | niro | 2654 | # only add this for grub legacy, grub2 detect these settings on its own |
193 | export GRUBLEGACYOPTS="rootdelay=8" | ||
194 | # there are to zotac types in the wild, nvidia based gfx and intel | ||
195 | if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] | ||
196 | then | ||
197 | export SPECIALDEVICE="zotac_nvidia" | ||
198 | else | ||
199 | export SPECIALDEVICE="zotac_intel" | ||
200 | fi | ||
201 | fi | ||
202 | niro | 2320 | |
203 | # check for special devices/clients: | ||
204 | # if a rangee and disk ist smaller then 256mb move partion one block further ahead | ||
205 | if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] | ||
206 | then | ||
207 | # for a rangee always define partion startblock +1 | ||
208 | export FDISKPARTIONBELOW256MB="1" | ||
209 | export SPECIALDEVICE="rangee" | ||
210 | export GRUBLEGACYOPTS="" | ||
211 | fi | ||
212 | |||
213 | # check for special devices/clients: | ||
214 | # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer | ||
215 | if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]] | ||
216 | then | ||
217 | export SPECIALDEVICE="maxdata" | ||
218 | export GRUBLEGACYOPTS="" | ||
219 | fi | ||
220 | |||
221 | # check for special devices/clients: | ||
222 | # check for laptops and activate cpufreq scaling | ||
223 | if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] | ||
224 | then | ||
225 | export FORMFACTOR="laptop" | ||
226 | export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand" | ||
227 | fi | ||
228 | } | ||
229 | |||
230 | niro | 2429 | run_hardware_detection_disks() |
231 | { | ||
232 | local bootdev | ||
233 | |||
234 | # all disks but exclude ramdisks | ||
235 | export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') | ||
236 | # remove the boot device from ALL_DISKS if it was an usbstick | ||
237 | niro | 2653 | if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
238 | niro | 2429 | then |
239 | niro | 2653 | bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g') |
240 | niro | 2429 | export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
241 | fi | ||
242 | export ALL_CDROMS="$(get_hwinfo cdrom)" | ||
243 | } | ||
244 | |||
245 | niro | 2882 | setup_hdd_partitions() |
246 | niro | 2320 | { |
247 | niro | 2882 | case "${INSTALL_METHOD}" in |
248 | auto) | ||
249 | BOOTHDD="" | ||
250 | SWAPHDD="" | ||
251 | ROOTHDD="${HDD}1" | ||
252 | ;; | ||
253 | normal) | ||
254 | BOOTHDD="${HDD}1" | ||
255 | SWAPHDD="${HDD}2" | ||
256 | ROOTHDD="${HDD}3" | ||
257 | ;; | ||
258 | esac | ||
259 | niro | 2320 | |
260 | niro | 2435 | # sanity check - should not happen |
261 | if is_mounted --device "${ROOTHDD}" | ||
262 | then | ||
263 | echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
264 | umount "${ROOTHDD}" | ||
265 | fi | ||
266 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
267 | niro | 2320 | then |
268 | niro | 2882 | if is_mounted --device "${BOOTHDD}" |
269 | niro | 2320 | then |
270 | niro | 2882 | echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2 |
271 | umount "${BOOTHDD}" | ||
272 | niro | 2320 | fi |
273 | fi | ||
274 | |||
275 | niro | 2882 | if [[ ${INSTALL_METHOD} = auto ]] |
276 | then | ||
277 | # run this only if FDISKPARTITIONBELOW256MB is not already 1 | ||
278 | if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] | ||
279 | then | ||
280 | if device_minimum_size "${HDD}" 256 | ||
281 | then | ||
282 | FDISKPARTIONBELOW256MB=1 | ||
283 | else | ||
284 | FDISKPARTIONBELOW256MB=0 | ||
285 | fi | ||
286 | fi | ||
287 | niro | 2320 | |
288 | niro | 2882 | ## delete disk |
289 | dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die | ||
290 | |||
291 | if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] | ||
292 | then | ||
293 | ## setup one bootable partition | ||
294 | #1. n= new disk | ||
295 | #2. p= primary disk | ||
296 | #3. 1= first partition | ||
297 | #4. 2= default sector start // small disk needs more space for grub2 mbr sector | ||
298 | #5. ''= defaul sector end | ||
299 | #6. a= bootable flag | ||
300 | #7. 1= boot flag for partition 1 | ||
301 | #8. w= write/quit | ||
302 | fdisk ${HDD} &> /dev/null << EOF | ||
303 | niro | 2320 | n |
304 | p | ||
305 | 1 | ||
306 | 2 | ||
307 | |||
308 | a | ||
309 | 1 | ||
310 | w | ||
311 | EOF | ||
312 | niro | 2882 | else |
313 | ## setup one bootable partition | ||
314 | #1. n= new disk | ||
315 | #2. p= primary disk | ||
316 | #3. 1= first partition | ||
317 | #4. ''= default sector start | ||
318 | #5. ''= defaul sector end | ||
319 | #6. a= bootable flag | ||
320 | #7. 1= boot flag for partition 1 | ||
321 | #8. w= write/quit | ||
322 | fdisk ${HDD} &> /dev/null << EOF | ||
323 | niro | 2320 | n |
324 | p | ||
325 | 1 | ||
326 | |||
327 | |||
328 | a | ||
329 | 1 | ||
330 | w | ||
331 | EOF | ||
332 | niro | 2882 | fi |
333 | else | ||
334 | cfdisk ${HDD} || dialog_die | ||
335 | niro | 2320 | fi |
336 | } | ||
337 | |||
338 | setup_hdd_format() | ||
339 | { | ||
340 | niro | 2883 | install -d /tmp |
341 | :> /tmp/format.log | ||
342 | |||
343 | niro | 2882 | if [[ -n ${SWAPHDD} ]] |
344 | niro | 2435 | then |
345 | niro | 2882 | # sanity check - should not happen |
346 | if is_mounted --device "${SWAPHDD}" | ||
347 | then | ||
348 | echo "format: device ${SWAPHDD} is already mounted, umount it" >&2 | ||
349 | umount "${SWAPHDD}" | ||
350 | fi | ||
351 | mkswap ${SWAPHDD} || die | ||
352 | niro | 2435 | fi |
353 | |||
354 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
355 | then | ||
356 | # sanity check - should not happen | ||
357 | if is_mounted --device "${BOOTHDD}" | ||
358 | then | ||
359 | echo "format: device ${BOOTHDD} is already mounted, umount it" >&2 | ||
360 | umount "${BOOTHDD}" | ||
361 | fi | ||
362 | |||
363 | niro | 2883 | mkfs."${FORMAT_FILESYSTEM}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die |
364 | niro | 2882 | fi |
365 | |||
366 | if [[ -n ${ROOTHDD} ]] | ||
367 | then | ||
368 | # sanity check - should not happen | ||
369 | if is_mounted --device "${ROOTHDD}" | ||
370 | then | ||
371 | echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
372 | umount "${ROOTHDD}" | ||
373 | fi | ||
374 | |||
375 | niro | 2883 | mkfs."${FORMAT_FILESYSTEM}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die |
376 | niro | 2882 | fi |
377 | niro | 2320 | } |
378 | |||
379 | install_system_image() | ||
380 | { | ||
381 | niro | 2433 | pushd ${INSTALLROOT} > /dev/null |
382 | niro | 2655 | tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT} |
383 | niro | 2433 | popd > /dev/null |
384 | niro | 2320 | } |
385 | |||
386 | install_system_settings() | ||
387 | { | ||
388 | niro | 2443 | local CONFIG |
389 | niro | 2320 | |
390 | niro | 2443 | # write fstab |
391 | CONFIG="${INSTALLROOT}/etc/fstab" | ||
392 | clearconfig | ||
393 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
394 | then | ||
395 | addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t1 1" | ||
396 | fi | ||
397 | if [[ -n ${ROOTHDD} ]] | ||
398 | then | ||
399 | addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" | ||
400 | fi | ||
401 | if [[ -n ${SWAPHDD} ]] | ||
402 | then | ||
403 | addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" | ||
404 | fi | ||
405 | niro | 2443 | addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
406 | addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" | ||
407 | |||
408 | niro | 2320 | # install network config skeleton |
409 | niro | 2443 | CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
410 | clearconfig | ||
411 | addconfig 'ONBOOT="yes"' | ||
412 | addconfig 'NETWORKING="dhcp"' | ||
413 | niro | 2320 | |
414 | niro | 2442 | # intel framebuffer quirk |
415 | niro | 2500 | CONFIG="${INSTALLROOT}/etc/splash/splash.conf" |
416 | if [ -e ${CONFIG} ] && [ -e /proc/fb ] | ||
417 | niro | 2320 | then |
418 | niro | 2500 | if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
419 | niro | 2320 | then |
420 | niro | 2500 | fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
421 | [[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die | ||
422 | niro | 2320 | fi |
423 | fi | ||
424 | } | ||
425 | |||
426 | |||
427 | niro | 2482 | ### installer dialogs ### |
428 | |||
429 | dialog_die() | ||
430 | { | ||
431 | ERROR="$1" | ||
432 | RETVAL="$?" | ||
433 | dialog_install_failure | ||
434 | exit 1 | ||
435 | } | ||
436 | |||
437 | dialog_warning() | ||
438 | { | ||
439 | local retval | ||
440 | |||
441 | yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" | ||
442 | retval=$? | ||
443 | if [[ ${retval} -eq 1 ]] | ||
444 | then | ||
445 | clear | ||
446 | echo $"The process was aborted." | ||
447 | exit 1 | ||
448 | fi | ||
449 | } | ||
450 | |||
451 | |||
452 | ### installer tasks ### | ||
453 | |||
454 | task_setup_system_menu() | ||
455 | { | ||
456 | local mode | ||
457 | local retval | ||
458 | |||
459 | mode="$(dialog_setup_system_menu)" | ||
460 | retval=$? | ||
461 | [[ ${retval} -eq 1 ]] && return 1 | ||
462 | if [[ ${retval} -eq 0 ]] | ||
463 | then | ||
464 | case "${mode}" in | ||
465 | niro | 2882 | "1") run_install auto ;; |
466 | "2") run_install normal ;; | ||
467 | niro | 2482 | "") task_setup_system_menu;; |
468 | esac | ||
469 | fi | ||
470 | } | ||
471 | |||
472 | task_hardware_detection() | ||
473 | { | ||
474 | local message | ||
475 | |||
476 | run_hardware_detection_disks | ||
477 | |||
478 | message+=$"Harddrives:\n" | ||
479 | |||
480 | if [[ ! -z ${ALL_DISKS} ]] | ||
481 | then | ||
482 | for i in ${ALL_DISKS} | ||
483 | do | ||
484 | message+="\Z3${i}\Zn " | ||
485 | done | ||
486 | message+="\n" | ||
487 | fi | ||
488 | |||
489 | if [[ ! -z ${ALL_CDROMS} ]] | ||
490 | then | ||
491 | message+="\n" | ||
492 | message+=$"Optical disk drives:\n" | ||
493 | for i in ${ALL_CDROMS} | ||
494 | do | ||
495 | message+="\Z3${i}\Zn" | ||
496 | done | ||
497 | message+="\n" | ||
498 | fi | ||
499 | |||
500 | # other devices | ||
501 | run_hardware_detection | ||
502 | case "${SPECIALDEVICE}" in | ||
503 | zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; | ||
504 | rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; | ||
505 | maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; | ||
506 | *) message+=$"\n\ZnCommon device detected.\Zn" ;; | ||
507 | esac | ||
508 | if [[ ${FORMFACTOR} = laptop ]] | ||
509 | then | ||
510 | message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" | ||
511 | fi | ||
512 | |||
513 | messagebox -y 12 -h $"Detected hardware:" "${message}" | ||
514 | } | ||
515 | |||
516 | niro | 2882 | task_setup_hdd_partitions() |
517 | niro | 2482 | { |
518 | local i | ||
519 | local retval | ||
520 | |||
521 | if [[ -z ${ALL_DISKS} ]] | ||
522 | then | ||
523 | dialog_no_harddrive_found | ||
524 | exit 1 | ||
525 | else | ||
526 | HDD=$(dialog_select_target_harddrive) | ||
527 | retval=$? | ||
528 | [[ ${retval} -eq 1 ]] && return 1 | ||
529 | if [[ ${retval} -eq 0 ]] | ||
530 | then | ||
531 | dialog_setup_hdd_info | ||
532 | niro | 2882 | setup_hdd_partitions |
533 | niro | 2482 | fi |
534 | fi | ||
535 | } | ||
536 | |||
537 | task_main() | ||
538 | { | ||
539 | local method=0 | ||
540 | local retval | ||
541 | |||
542 | while [[ ${method} -le 2 ]] | ||
543 | do | ||
544 | method=$(dialog_main) | ||
545 | retval=$? | ||
546 | [[ ${retval} -eq 1 ]] && exit 1 | ||
547 | if [[ ${retval} -eq 0 ]] | ||
548 | then | ||
549 | case ${method} in | ||
550 | "1") task_setup_system_menu ;; | ||
551 | "2") task_hardware_detection ;; | ||
552 | "3") install_do_reboot ;; | ||
553 | "4") /bin/bash --login -i ;; | ||
554 | esac | ||
555 | fi | ||
556 | done | ||
557 | } | ||
558 | |||
559 | niro | 2882 | run_install() |
560 | niro | 2320 | { |
561 | niro | 2882 | local method="$1" |
562 | |||
563 | niro | 2481 | task_hardware_detection |
564 | niro | 2320 | |
565 | niro | 2882 | case "${method}" in |
566 | auto) | ||
567 | export INSTALL_METHOD="${method}" | ||
568 | ;; | ||
569 | normal) | ||
570 | export INSTALL_METHOD="${method}" | ||
571 | ;; | ||
572 | *) | ||
573 | die "Unknown install method '${method}', aborting." | ||
574 | ;; | ||
575 | esac | ||
576 | niro | 2320 | |
577 | niro | 2882 | task_setup_hdd_partitions |
578 | niro | 2320 | dialog_setup_hdd_format |
579 | niro | 2399 | setup_hdd_format > /dev/null |
580 | niro | 2485 | mount_rootfs |
581 | niro | 2423 | (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
582 | niro | 2320 | |
583 | dialog_install_settings | ||
584 | sleep 1 | ||
585 | niro | 2399 | install_system_settings |
586 | niro | 2440 | if is_initrd_supported |
587 | then | ||
588 | dialog_install_initrd | ||
589 | initrd_config | ||
590 | initrd_install | ||
591 | fi | ||
592 | niro | 2320 | |
593 | dialog_install_bootsector | ||
594 | niro | 2440 | bootloader_config |
595 | bootloader_install | ||
596 | niro | 2320 | |
597 | niro | 2485 | umount_rootfs |
598 | niro | 2320 | dialog_install_successful |
599 | } | ||
600 | |||
601 | niro | 2409 | # set some proper traps |
602 | trap "trap_exit" SIGINT SIGQUIT | ||
603 | |||
604 | niro | 2477 | task_main |
605 | niro | 2320 | |
606 | exit 0 |