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