Annotation of /trunk/installer-simple/bin/installer.sh.in
Parent Directory | Revision Log
Revision 2937 -
(hide annotations)
(download)
Wed Feb 3 13:57:02 2016 UTC (8 years, 4 months ago) by niro
File size: 16925 byte(s)
Wed Feb 3 13:57:02 2016 UTC (8 years, 4 months ago) by niro
File size: 16925 byte(s)
-fixed broken hdd selection logic
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 | 2930 | # fetch cmdline |
44 | for argv in $* | ||
45 | do | ||
46 | case $1 in | ||
47 | --liveroot) shift; cmdliveroot="$1" ;; | ||
48 | --imageroot) shift; cmdimageroot="$1" ;; | ||
49 | --installroot) shift; cmdinstallroot="$1" ;; | ||
50 | --filesystem) shift; cmdformatfilesystem="$1" ;; | ||
51 | --help) | ||
52 | echo "$0 options:" | ||
53 | echo " --liveroot [path] - override default liveroot" | ||
54 | echo " --imageroot [path] - override default imageroot" | ||
55 | echo " --installroot [path] - override default installroot" | ||
56 | echo " --filesystem [fstype] - override default filesystem used to format the disk" | ||
57 | exit 0 ;; | ||
58 | esac | ||
59 | shift | ||
60 | done | ||
61 | |||
62 | niro | 2320 | ### System/Config Version |
63 | VERSION="%VERSIONTAG%" | ||
64 | niro | 2332 | TITLE="${DEFAULT_TITLE} - ${VERSION}" |
65 | niro | 2320 | |
66 | niro | 2890 | # initialize global variables so they are exportable |
67 | niro | 2404 | # some sane defaults |
68 | niro | 2891 | INSTALL_METHOD="" |
69 | niro | 2930 | if [[ -n ${cmdliveroot} ]] |
70 | then | ||
71 | LIVEROOT="${cmdliveroot}" | ||
72 | else | ||
73 | LIVEROOT="${DEFAULT_LIVEROOT}" | ||
74 | fi | ||
75 | if [[ -n ${cmdimageroot} ]] | ||
76 | then | ||
77 | IMAGEROOT="${cmdimageroot}" | ||
78 | else | ||
79 | IMAGEROOT="${DEFAULT_IMAGEROOT}" | ||
80 | fi | ||
81 | if [[ -n ${cmdinstallroot} ]] | ||
82 | then | ||
83 | INSTALLROOT="${cmdinstallroot}" | ||
84 | else | ||
85 | INSTALLROOT="${DEFAULT_INSTALLROOT}" | ||
86 | fi | ||
87 | niro | 2404 | KERNELPKG="${DEFAULT_KERNELPKG}" |
88 | KERNELOPTS="${DEFAULT_KERNELOPTS}" | ||
89 | niro | 2320 | GRUBLEGACYOPTS="" |
90 | GRUB2OPTS="" | ||
91 | FDISKPARTIONBELOW256MB=0 | ||
92 | SPECIALDEVICE="" | ||
93 | niro | 2404 | FORMFACTOR="${DEFAULT_FORMFACTOR}" |
94 | niro | 2930 | if [[ -n ${cmdformatfilesystem} ]] |
95 | then | ||
96 | FORMAT_FILESYSTEM="${cmdformatfilesystem}" | ||
97 | else | ||
98 | FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" | ||
99 | fi | ||
100 | niro | 2890 | FLASHDISK=0 |
101 | niro | 2320 | |
102 | niro | 2642 | # TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
103 | # -> now in images.conf | ||
104 | CDIMAGENAME="" | ||
105 | TOTALLINES="" | ||
106 | CURRENTLINE=0 | ||
107 | if [ -e ${IMAGEROOT}/images.conf ] | ||
108 | then | ||
109 | source ${IMAGEROOT}/images.conf | ||
110 | # check if all required variables are set | ||
111 | [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf" | ||
112 | [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf" | ||
113 | else | ||
114 | die "${IMAGEROOT}/images.conf not found" | ||
115 | fi | ||
116 | niro | 2320 | |
117 | niro | 2482 | ### helper scripts ### |
118 | |||
119 | niro | 2409 | trap_exit() |
120 | { | ||
121 | is_mounted --location "${INSTALLROOT}/dev" && umount ${INSTALLROOT}/dev | ||
122 | is_mounted --location "${INSTALLROOT}/proc" && umount ${INSTALLROOT}/proc | ||
123 | is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys | ||
124 | is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot | ||
125 | is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} | ||
126 | niro | 2889 | [[ -n ${SWAPHDD} ]] && swapoff ${SWAPHDD} |
127 | niro | 2409 | |
128 | echo $"Installation aborted." | ||
129 | exit 1 | ||
130 | } | ||
131 | |||
132 | niro | 2423 | install_meter() |
133 | niro | 2320 | { |
134 | while [[ ${CURRENTLINE} != ${TOTALLINES} ]] | ||
135 | do | ||
136 | CURRENTLINE=$(grep -c . /tmp/install.log) | ||
137 | PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) | ||
138 | echo ${PERCENT} | ||
139 | sleep 1 | ||
140 | done | ||
141 | rm -f /tmp/install.log | ||
142 | return 0 | ||
143 | } | ||
144 | |||
145 | niro | 2485 | mount_rootfs() |
146 | niro | 2484 | { |
147 | niro | 2489 | local retval |
148 | |||
149 | niro | 2882 | if [[ -n ${SWAPHDD} ]] |
150 | niro | 2489 | then |
151 | niro | 2882 | swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'" |
152 | niro | 2489 | fi |
153 | niro | 2882 | |
154 | if [[ -n ${ROOTHDD} ]] | ||
155 | then | ||
156 | if is_mounted --location "${INSTALLROOT}" | ||
157 | then | ||
158 | echo $"${INSTALLROOT} already mounted" >&2 | ||
159 | else | ||
160 | niro | 2888 | mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" |
161 | niro | 2882 | fi |
162 | fi | ||
163 | |||
164 | niro | 2486 | [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
165 | niro | 2882 | |
166 | if [[ -n ${BOOTHDD} ]] | ||
167 | then | ||
168 | if is_mounted --location "${INSTALLROOT}"/boot | ||
169 | then | ||
170 | echo $"${INSTALLROOT}/boot already mounted" >&2 | ||
171 | else | ||
172 | niro | 2888 | mount -t "${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" |
173 | niro | 2882 | fi |
174 | fi | ||
175 | niro | 2484 | } |
176 | |||
177 | niro | 2485 | umount_rootfs() |
178 | niro | 2484 | { |
179 | is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot | ||
180 | is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} | ||
181 | niro | 2882 | |
182 | if [[ -n ${SWAPHDD} ]] | ||
183 | then | ||
184 | swapoff ${SWAPHDD} || die | ||
185 | fi | ||
186 | niro | 2484 | } |
187 | |||
188 | install_do_reboot() | ||
189 | { | ||
190 | reboot | ||
191 | } | ||
192 | |||
193 | niro | 2320 | run_hardware_detection() |
194 | { | ||
195 | local hwinfo | ||
196 | hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" | ||
197 | |||
198 | niro | 2654 | # check for special devices/clients: |
199 | # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd | ||
200 | local removable=0 | ||
201 | if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] | ||
202 | then | ||
203 | niro | 2890 | for i in /sys/block/[hs]d*/removable |
204 | do | ||
205 | if [[ $(< ${i}) = 1 ]] | ||
206 | then | ||
207 | removable=1 | ||
208 | # we assume that all removable disks are flash disks on a zotac | ||
209 | export FLASHDISK=1 | ||
210 | fi | ||
211 | done | ||
212 | niro | 2654 | # smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
213 | niro | 2320 | |
214 | niro | 2654 | # only add this for grub legacy, grub2 detect these settings on its own |
215 | export GRUBLEGACYOPTS="rootdelay=8" | ||
216 | # there are to zotac types in the wild, nvidia based gfx and intel | ||
217 | if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] | ||
218 | then | ||
219 | export SPECIALDEVICE="zotac_nvidia" | ||
220 | else | ||
221 | export SPECIALDEVICE="zotac_intel" | ||
222 | fi | ||
223 | fi | ||
224 | niro | 2320 | |
225 | # check for special devices/clients: | ||
226 | # if a rangee and disk ist smaller then 256mb move partion one block further ahead | ||
227 | if [[ ! -z $(echo "${hwinfo}" | grep -i CLE266) ]] | ||
228 | then | ||
229 | # for a rangee always define partion startblock +1 | ||
230 | export FDISKPARTIONBELOW256MB="1" | ||
231 | export SPECIALDEVICE="rangee" | ||
232 | export GRUBLEGACYOPTS="" | ||
233 | fi | ||
234 | |||
235 | # check for special devices/clients: | ||
236 | # check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer | ||
237 | if [[ ! -z $(echo "${hwinfo}" | grep -i i810) ]] || [[ ! -z $(echo "${hwinfo}" | grep -i i815) ]] | ||
238 | then | ||
239 | export SPECIALDEVICE="maxdata" | ||
240 | export GRUBLEGACYOPTS="" | ||
241 | fi | ||
242 | |||
243 | niro | 2892 | # check for i845 Chipsets and enable KMS and use 915 drm driver later in initrd |
244 | if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]] | ||
245 | then | ||
246 | export SPECIALDEVICE="i845" | ||
247 | # unset default video=1024x768 opt or the drm driver breaks | ||
248 | export KERNELOPTS="quiet" | ||
249 | export GRUBLEGACYOPTS="" | ||
250 | # enable full kms support | ||
251 | export GRUB2GFXPAYLOAD="keep" | ||
252 | fi | ||
253 | |||
254 | # check for radeon gfxcards | ||
255 | if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]] | ||
256 | then | ||
257 | # enable full kms support | ||
258 | export GRUB2GFXPAYLOAD="keep" | ||
259 | fi | ||
260 | |||
261 | # requires nomsi to prevent massive IRQ error spam | ||
262 | # see: http://ubuntuforums.org/showthread.php?t=1234983 | ||
263 | if [[ ! -z $(echo "${hwinfo}" | grep -i 'P5VD2-X') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VT8237') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VX700') ]] | ||
264 | then | ||
265 | export SPECIALDEVICE="nomsi" | ||
266 | export KERNELOPTS="${KERNELOPTS} pci=nomsi,noaer" | ||
267 | fi | ||
268 | |||
269 | niro | 2320 | # check for special devices/clients: |
270 | # check for laptops and activate cpufreq scaling | ||
271 | if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] | ||
272 | then | ||
273 | export FORMFACTOR="laptop" | ||
274 | export KERNELOPTS="${KERNELOPTS} cpufreq.governor=ondemand" | ||
275 | fi | ||
276 | } | ||
277 | |||
278 | niro | 2429 | run_hardware_detection_disks() |
279 | { | ||
280 | local bootdev | ||
281 | |||
282 | # all disks but exclude ramdisks | ||
283 | export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') | ||
284 | # remove the boot device from ALL_DISKS if it was an usbstick | ||
285 | niro | 2653 | if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
286 | niro | 2429 | then |
287 | niro | 2653 | bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g') |
288 | niro | 2429 | export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
289 | fi | ||
290 | export ALL_CDROMS="$(get_hwinfo cdrom)" | ||
291 | } | ||
292 | |||
293 | niro | 2882 | setup_hdd_partitions() |
294 | niro | 2320 | { |
295 | niro | 2435 | # sanity check - should not happen |
296 | if is_mounted --device "${ROOTHDD}" | ||
297 | then | ||
298 | echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
299 | umount "${ROOTHDD}" | ||
300 | fi | ||
301 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
302 | niro | 2320 | then |
303 | niro | 2882 | if is_mounted --device "${BOOTHDD}" |
304 | niro | 2320 | then |
305 | niro | 2882 | echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2 |
306 | umount "${BOOTHDD}" | ||
307 | niro | 2320 | fi |
308 | fi | ||
309 | |||
310 | niro | 2882 | if [[ ${INSTALL_METHOD} = auto ]] |
311 | then | ||
312 | # run this only if FDISKPARTITIONBELOW256MB is not already 1 | ||
313 | if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] | ||
314 | then | ||
315 | if device_minimum_size "${HDD}" 256 | ||
316 | then | ||
317 | FDISKPARTIONBELOW256MB=1 | ||
318 | else | ||
319 | FDISKPARTIONBELOW256MB=0 | ||
320 | fi | ||
321 | fi | ||
322 | niro | 2320 | |
323 | niro | 2882 | ## delete disk |
324 | dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die | ||
325 | |||
326 | niro | 2890 | if [[ ${FLASHDISK} = 1 ]] |
327 | niro | 2882 | then |
328 | niro | 2890 | if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
329 | then | ||
330 | ## setup one bootable partition | ||
331 | # 1. n= new disk | ||
332 | # 2. p= primary disk | ||
333 | # 3. 1= first partition | ||
334 | # 4. 2= default sector start // small disk needs more space for grub2 mbr sector | ||
335 | # 5. ''= defaul sector end | ||
336 | # 6. a= bootable flag | ||
337 | # 7. 1= boot flag for partition 1 | ||
338 | # 8. n= new disk | ||
339 | #10. p= primary disk | ||
340 | #11. 2= second partition | ||
341 | #12. ''= default sector start | ||
342 | #13. ''= defaul sector end | ||
343 | #14. w= write/quit | ||
344 | fdisk ${HDD} &> /dev/null << EOF | ||
345 | niro | 2320 | n |
346 | p | ||
347 | 1 | ||
348 | 2 | ||
349 | niro | 2890 | +50M |
350 | a | ||
351 | 1 | ||
352 | n | ||
353 | p | ||
354 | 2 | ||
355 | niro | 2320 | |
356 | niro | 2890 | |
357 | w | ||
358 | EOF | ||
359 | else | ||
360 | ## setup one bootable partition | ||
361 | # 1. n= new disk | ||
362 | # 2. p= primary disk | ||
363 | # 3. 1= first partition | ||
364 | # 4. ''= default sector start | ||
365 | # 5. ''= defaul sector end | ||
366 | # 6. a= bootable flag | ||
367 | # 7. 1= boot flag for partition 1 | ||
368 | # 8. n= new disk | ||
369 | #10. p= primary disk | ||
370 | #11. 2= second partition | ||
371 | #12. ''= default sector start | ||
372 | #13. ''= defaul sector end | ||
373 | #14. w= write/quit | ||
374 | fdisk ${HDD} &> /dev/null << EOF | ||
375 | n | ||
376 | p | ||
377 | 1 | ||
378 | |||
379 | +50M | ||
380 | niro | 2320 | a |
381 | 1 | ||
382 | niro | 2890 | n |
383 | p | ||
384 | 2 | ||
385 | |||
386 | |||
387 | niro | 2320 | w |
388 | EOF | ||
389 | niro | 2890 | fi |
390 | niro | 2882 | else |
391 | niro | 2890 | if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
392 | then | ||
393 | ## setup one bootable partition | ||
394 | #1. n= new disk | ||
395 | #2. p= primary disk | ||
396 | #3. 1= first partition | ||
397 | #4. 2= default sector start // small disk needs more space for grub2 mbr sector | ||
398 | #5. ''= defaul sector end | ||
399 | #6. a= bootable flag | ||
400 | #7. 1= boot flag for partition 1 | ||
401 | #8. w= write/quit | ||
402 | fdisk ${HDD} &> /dev/null << EOF | ||
403 | niro | 2320 | n |
404 | p | ||
405 | 1 | ||
406 | niro | 2890 | 2 |
407 | niro | 2320 | |
408 | niro | 2890 | a |
409 | 1 | ||
410 | w | ||
411 | EOF | ||
412 | else | ||
413 | ## setup one bootable partition | ||
414 | #1. n= new disk | ||
415 | #2. p= primary disk | ||
416 | #3. 1= first partition | ||
417 | #4. ''= default sector start | ||
418 | #5. ''= defaul sector end | ||
419 | #6. a= bootable flag | ||
420 | #7. 1= boot flag for partition 1 | ||
421 | #8. w= write/quit | ||
422 | fdisk ${HDD} &> /dev/null << EOF | ||
423 | n | ||
424 | p | ||
425 | 1 | ||
426 | niro | 2320 | |
427 | niro | 2890 | |
428 | niro | 2320 | a |
429 | 1 | ||
430 | w | ||
431 | EOF | ||
432 | niro | 2890 | fi |
433 | niro | 2882 | fi |
434 | else | ||
435 | cfdisk ${HDD} || dialog_die | ||
436 | niro | 2320 | fi |
437 | } | ||
438 | |||
439 | setup_hdd_format() | ||
440 | { | ||
441 | niro | 2883 | install -d /tmp |
442 | :> /tmp/format.log | ||
443 | |||
444 | niro | 2882 | if [[ -n ${SWAPHDD} ]] |
445 | niro | 2435 | then |
446 | niro | 2882 | # sanity check - should not happen |
447 | if is_mounted --device "${SWAPHDD}" | ||
448 | then | ||
449 | echo "format: device ${SWAPHDD} is already mounted, umount it" >&2 | ||
450 | umount "${SWAPHDD}" | ||
451 | fi | ||
452 | mkswap ${SWAPHDD} || die | ||
453 | niro | 2435 | fi |
454 | |||
455 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
456 | then | ||
457 | # sanity check - should not happen | ||
458 | if is_mounted --device "${BOOTHDD}" | ||
459 | then | ||
460 | echo "format: device ${BOOTHDD} is already mounted, umount it" >&2 | ||
461 | umount "${BOOTHDD}" | ||
462 | fi | ||
463 | |||
464 | niro | 2885 | mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die |
465 | niro | 2882 | fi |
466 | |||
467 | if [[ -n ${ROOTHDD} ]] | ||
468 | then | ||
469 | # sanity check - should not happen | ||
470 | if is_mounted --device "${ROOTHDD}" | ||
471 | then | ||
472 | echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 | ||
473 | umount "${ROOTHDD}" | ||
474 | fi | ||
475 | |||
476 | niro | 2885 | mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die |
477 | niro | 2882 | fi |
478 | niro | 2320 | } |
479 | |||
480 | install_system_image() | ||
481 | { | ||
482 | niro | 2433 | pushd ${INSTALLROOT} > /dev/null |
483 | niro | 2655 | tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT} |
484 | niro | 2433 | popd > /dev/null |
485 | niro | 2320 | } |
486 | |||
487 | install_system_settings() | ||
488 | { | ||
489 | niro | 2443 | local CONFIG |
490 | niro | 2320 | |
491 | niro | 2443 | # write fstab |
492 | CONFIG="${INSTALLROOT}/etc/fstab" | ||
493 | clearconfig | ||
494 | niro | 2882 | if [[ -n ${BOOTHDD} ]] |
495 | then | ||
496 | niro | 2885 | addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1" |
497 | niro | 2882 | fi |
498 | if [[ -n ${ROOTHDD} ]] | ||
499 | then | ||
500 | niro | 2885 | addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0" |
501 | niro | 2882 | fi |
502 | if [[ -n ${SWAPHDD} ]] | ||
503 | then | ||
504 | addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" | ||
505 | fi | ||
506 | niro | 2443 | addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
507 | addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" | ||
508 | |||
509 | niro | 2320 | # install network config skeleton |
510 | niro | 2443 | CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
511 | clearconfig | ||
512 | addconfig 'ONBOOT="yes"' | ||
513 | addconfig 'NETWORKING="dhcp"' | ||
514 | niro | 2320 | |
515 | niro | 2442 | # intel framebuffer quirk |
516 | niro | 2500 | CONFIG="${INSTALLROOT}/etc/splash/splash.conf" |
517 | if [ -e ${CONFIG} ] && [ -e /proc/fb ] | ||
518 | niro | 2320 | then |
519 | niro | 2500 | if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
520 | niro | 2320 | then |
521 | niro | 2500 | fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
522 | [[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die | ||
523 | niro | 2320 | fi |
524 | fi | ||
525 | } | ||
526 | |||
527 | |||
528 | niro | 2482 | ### installer dialogs ### |
529 | |||
530 | dialog_die() | ||
531 | { | ||
532 | ERROR="$1" | ||
533 | RETVAL="$?" | ||
534 | dialog_install_failure | ||
535 | exit 1 | ||
536 | } | ||
537 | |||
538 | dialog_warning() | ||
539 | { | ||
540 | local retval | ||
541 | |||
542 | yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" | ||
543 | retval=$? | ||
544 | if [[ ${retval} -eq 1 ]] | ||
545 | then | ||
546 | clear | ||
547 | echo $"The process was aborted." | ||
548 | exit 1 | ||
549 | fi | ||
550 | } | ||
551 | |||
552 | |||
553 | ### installer tasks ### | ||
554 | |||
555 | task_setup_system_menu() | ||
556 | { | ||
557 | local mode | ||
558 | local retval | ||
559 | |||
560 | mode="$(dialog_setup_system_menu)" | ||
561 | retval=$? | ||
562 | [[ ${retval} -eq 1 ]] && return 1 | ||
563 | if [[ ${retval} -eq 0 ]] | ||
564 | then | ||
565 | case "${mode}" in | ||
566 | niro | 2882 | "1") run_install auto ;; |
567 | "2") run_install normal ;; | ||
568 | niro | 2482 | "") task_setup_system_menu;; |
569 | esac | ||
570 | fi | ||
571 | } | ||
572 | |||
573 | task_hardware_detection() | ||
574 | { | ||
575 | local message | ||
576 | |||
577 | run_hardware_detection_disks | ||
578 | |||
579 | message+=$"Harddrives:\n" | ||
580 | |||
581 | if [[ ! -z ${ALL_DISKS} ]] | ||
582 | then | ||
583 | for i in ${ALL_DISKS} | ||
584 | do | ||
585 | message+="\Z3${i}\Zn " | ||
586 | done | ||
587 | message+="\n" | ||
588 | fi | ||
589 | |||
590 | if [[ ! -z ${ALL_CDROMS} ]] | ||
591 | then | ||
592 | message+="\n" | ||
593 | message+=$"Optical disk drives:\n" | ||
594 | for i in ${ALL_CDROMS} | ||
595 | do | ||
596 | message+="\Z3${i}\Zn" | ||
597 | done | ||
598 | message+="\n" | ||
599 | fi | ||
600 | |||
601 | # other devices | ||
602 | run_hardware_detection | ||
603 | case "${SPECIALDEVICE}" in | ||
604 | zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; | ||
605 | rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; | ||
606 | maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; | ||
607 | niro | 2892 | i845) message+=$"\n\Z2Intel i845 VGA device detected.\Zn" ;; |
608 | nomsi) message+=$"\n\Z2Mainboard with P5VD2-X/VT8237/VX700 chipset detected.\Zn" | ||
609 | message+=$"\n\Z2Disabling Message Signaled Interrupts (MSI) capability of the kernel.\Zn" ;; | ||
610 | niro | 2482 | *) message+=$"\n\ZnCommon device detected.\Zn" ;; |
611 | esac | ||
612 | if [[ ${FORMFACTOR} = laptop ]] | ||
613 | then | ||
614 | message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" | ||
615 | fi | ||
616 | niro | 2890 | if [[ ${FLASHDISK} = 1 ]] |
617 | then | ||
618 | message+=$"\n\ZnFlash memory detected.\Zn" | ||
619 | message+=$"\n\ZnF2FS will be used as default filesystem withn the auto installation mode.\Zn" | ||
620 | fi | ||
621 | niro | 2482 | |
622 | messagebox -y 12 -h $"Detected hardware:" "${message}" | ||
623 | } | ||
624 | |||
625 | niro | 2937 | task_select_target_hdd() |
626 | { | ||
627 | if [[ -z ${ALL_DISKS} ]] | ||
628 | then | ||
629 | dialog_no_harddrive_found | ||
630 | exit 1 | ||
631 | else | ||
632 | export HDD=$(dialog_select_target_harddrive) | ||
633 | fi | ||
634 | } | ||
635 | |||
636 | niro | 2882 | task_setup_hdd_partitions() |
637 | niro | 2482 | { |
638 | local retval | ||
639 | |||
640 | niro | 2937 | if [[ -z ${HDD} ]] |
641 | niro | 2482 | then |
642 | dialog_no_harddrive_found | ||
643 | exit 1 | ||
644 | else | ||
645 | niro | 2937 | dialog_setup_hdd_info |
646 | setup_hdd_partitions | ||
647 | niro | 2482 | fi |
648 | } | ||
649 | |||
650 | task_main() | ||
651 | { | ||
652 | local method=0 | ||
653 | local retval | ||
654 | |||
655 | while [[ ${method} -le 2 ]] | ||
656 | do | ||
657 | method=$(dialog_main) | ||
658 | retval=$? | ||
659 | [[ ${retval} -eq 1 ]] && exit 1 | ||
660 | if [[ ${retval} -eq 0 ]] | ||
661 | then | ||
662 | case ${method} in | ||
663 | "1") task_setup_system_menu ;; | ||
664 | "2") task_hardware_detection ;; | ||
665 | "3") install_do_reboot ;; | ||
666 | "4") /bin/bash --login -i ;; | ||
667 | esac | ||
668 | fi | ||
669 | done | ||
670 | } | ||
671 | |||
672 | niro | 2882 | run_install() |
673 | niro | 2320 | { |
674 | niro | 2882 | local method="$1" |
675 | |||
676 | niro | 2481 | task_hardware_detection |
677 | niro | 2937 | task_select_target_hdd |
678 | niro | 2320 | |
679 | niro | 2882 | case "${method}" in |
680 | auto) | ||
681 | niro | 2890 | if [[ ${FLASHDISK} = 1 ]] |
682 | then | ||
683 | export BOOTHDD="${HDD}1" | ||
684 | export SWAPHDD="" | ||
685 | export ROOTHDD="${HDD}2" | ||
686 | export FORMAT_FILESYSTEM_BOOTHDD="f2fs" | ||
687 | export FORMAT_FILESYSTEM_ROOTHDD="ext2" | ||
688 | else | ||
689 | export BOOTHDD="" | ||
690 | export SWAPHDD="" | ||
691 | export ROOTHDD="${HDD}1" | ||
692 | export FORMAT_FILESYSTEM_BOOTHDD="" | ||
693 | export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" | ||
694 | fi | ||
695 | niro | 2882 | export INSTALL_METHOD="${method}" |
696 | ;; | ||
697 | normal) | ||
698 | niro | 2886 | export BOOTHDD="${HDD}1" |
699 | export SWAPHDD="${HDD}2" | ||
700 | export ROOTHDD="${HDD}3" | ||
701 | niro | 2885 | export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" |
702 | export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" | ||
703 | niro | 2882 | export INSTALL_METHOD="${method}" |
704 | ;; | ||
705 | niro | 2885 | single) |
706 | niro | 2886 | export BOOTHDD="" |
707 | export SWAPHDD="" | ||
708 | export ROOTHDD="${HDD}1" | ||
709 | niro | 2885 | export FORMAT_FILESYSTEM_BOOTHDD="" |
710 | export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" | ||
711 | export INSTALL_METHOD="${method}" | ||
712 | ;; | ||
713 | niro | 2887 | flash) |
714 | export BOOTHDD="${HDD}1" | ||
715 | export SWAPHDD="" | ||
716 | export ROOTHDD="${HDD}2" | ||
717 | export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" | ||
718 | export FORMAT_FILESYSTEM_ROOTHDD="f2fs" | ||
719 | export INSTALL_METHOD="${method}" | ||
720 | ;; | ||
721 | niro | 2882 | *) |
722 | die "Unknown install method '${method}', aborting." | ||
723 | ;; | ||
724 | esac | ||
725 | niro | 2320 | |
726 | niro | 2882 | task_setup_hdd_partitions |
727 | niro | 2320 | dialog_setup_hdd_format |
728 | niro | 2399 | setup_hdd_format > /dev/null |
729 | niro | 2485 | mount_rootfs |
730 | niro | 2423 | (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
731 | niro | 2320 | |
732 | dialog_install_settings | ||
733 | sleep 1 | ||
734 | niro | 2399 | install_system_settings |
735 | niro | 2440 | if is_initrd_supported |
736 | then | ||
737 | dialog_install_initrd | ||
738 | initrd_config | ||
739 | initrd_install | ||
740 | fi | ||
741 | niro | 2320 | |
742 | dialog_install_bootsector | ||
743 | niro | 2440 | bootloader_config |
744 | bootloader_install | ||
745 | niro | 2320 | |
746 | niro | 2485 | umount_rootfs |
747 | niro | 2320 | dialog_install_successful |
748 | } | ||
749 | |||
750 | niro | 2409 | # set some proper traps |
751 | trap "trap_exit" SIGINT SIGQUIT | ||
752 | |||
753 | niro | 2477 | task_main |
754 | niro | 2320 | |
755 | exit 0 |