44 |
VERSION="%VERSIONTAG%" |
VERSION="%VERSIONTAG%" |
45 |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
46 |
|
|
47 |
|
# initialize global variables so they are exportable |
48 |
# some sane defaults |
# some sane defaults |
49 |
|
INSTALL_METHOD="" |
50 |
LIVEROOT="${DEFAULT_LIVEROOT}" |
LIVEROOT="${DEFAULT_LIVEROOT}" |
51 |
IMAGEROOT="${DEFAULT_IMAGEROOT}" |
IMAGEROOT="${DEFAULT_IMAGEROOT}" |
52 |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
58 |
SPECIALDEVICE="" |
SPECIALDEVICE="" |
59 |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
60 |
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
61 |
|
FLASHDISK=0 |
62 |
|
|
63 |
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
64 |
# -> now in images.conf |
# -> now in images.conf |
84 |
is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys |
is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys |
85 |
is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot |
is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot |
86 |
is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} |
is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} |
87 |
|
[[ -n ${SWAPHDD} ]] && swapoff ${SWAPHDD} |
88 |
|
|
89 |
echo $"Installation aborted." |
echo $"Installation aborted." |
90 |
exit 1 |
exit 1 |
103 |
return 0 |
return 0 |
104 |
} |
} |
105 |
|
|
|
install_mount_rootfs() |
|
|
{ |
|
|
local opts |
|
|
|
|
|
if [[ -n ${SWAPHDD} ]] |
|
|
then |
|
|
swapon ${SWAPHDD} || die |
|
|
fi |
|
|
if [[ -n ${ROOTHDD} ]] |
|
|
then |
|
|
mount -t ${FORMAT_FILESYSTEM_ROOTHDD} ${ROOTHDD} ${INSTALL_ROOT} || die |
|
|
fi |
|
|
if [[ -n ${BOOTHDD} ]] |
|
|
then |
|
|
install -d ${INSTALL_ROOT}/boot || die |
|
|
mount -t ${FORMAT_FILESYSTEM_BOOTHDD} ${BOOTHDD} ${INSTALL_ROOT}/boot || die |
|
|
fi |
|
|
|
|
|
cd ${INSTALL_ROOT} || die |
|
|
} |
|
|
|
|
|
|
|
106 |
mount_rootfs() |
mount_rootfs() |
107 |
{ |
{ |
108 |
local retval |
local retval |
118 |
then |
then |
119 |
echo $"${INSTALLROOT} already mounted" >&2 |
echo $"${INSTALLROOT} already mounted" >&2 |
120 |
else |
else |
121 |
mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" |
mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" |
122 |
fi |
fi |
123 |
fi |
fi |
124 |
|
|
130 |
then |
then |
131 |
echo $"${INSTALLROOT}/boot already mounted" >&2 |
echo $"${INSTALLROOT}/boot already mounted" >&2 |
132 |
else |
else |
133 |
mount "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" |
mount -t "${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" |
134 |
fi |
fi |
135 |
fi |
fi |
136 |
} |
} |
162 |
local removable=0 |
local removable=0 |
163 |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
164 |
then |
then |
165 |
#for i in /sys/block/[hs]d*/removable |
for i in /sys/block/[hs]d*/removable |
166 |
#do |
do |
167 |
# if [[ $(< ${i}) = 1 ]] |
if [[ $(< ${i}) = 1 ]] |
168 |
# then |
then |
169 |
# removable=1 |
removable=1 |
170 |
# fi |
# we assume that all removable disks are flash disks on a zotac |
171 |
#done |
export FLASHDISK=1 |
172 |
|
fi |
173 |
|
done |
174 |
# smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
# smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
175 |
|
|
176 |
# only add this for grub legacy, grub2 detect these settings on its own |
# only add this for grub legacy, grub2 detect these settings on its own |
202 |
export GRUBLEGACYOPTS="" |
export GRUBLEGACYOPTS="" |
203 |
fi |
fi |
204 |
|
|
205 |
|
# check for i845 Chipsets and enable KMS and use 915 drm driver later in initrd |
206 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i i845) ]] |
207 |
|
then |
208 |
|
export SPECIALDEVICE="i845" |
209 |
|
# unset default video=1024x768 opt or the drm driver breaks |
210 |
|
export KERNELOPTS="quiet" |
211 |
|
export GRUBLEGACYOPTS="" |
212 |
|
# enable full kms support |
213 |
|
export GRUB2GFXPAYLOAD="keep" |
214 |
|
fi |
215 |
|
|
216 |
|
# check for radeon gfxcards |
217 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i radeon) ]] |
218 |
|
then |
219 |
|
# enable full kms support |
220 |
|
export GRUB2GFXPAYLOAD="keep" |
221 |
|
fi |
222 |
|
|
223 |
|
# requires nomsi to prevent massive IRQ error spam |
224 |
|
# see: http://ubuntuforums.org/showthread.php?t=1234983 |
225 |
|
if [[ ! -z $(echo "${hwinfo}" | grep -i 'P5VD2-X') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VT8237') ]] || [[ ! -z $(echo "${hwinfo}" | grep -i 'VX700') ]] |
226 |
|
then |
227 |
|
export SPECIALDEVICE="nomsi" |
228 |
|
export KERNELOPTS="${KERNELOPTS} pci=nomsi,noaer" |
229 |
|
fi |
230 |
|
|
231 |
# check for special devices/clients: |
# check for special devices/clients: |
232 |
# check for laptops and activate cpufreq scaling |
# check for laptops and activate cpufreq scaling |
233 |
if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] |
if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] |
254 |
|
|
255 |
setup_hdd_partitions() |
setup_hdd_partitions() |
256 |
{ |
{ |
|
case "${INSTALL_METHOD}" in |
|
|
auto) |
|
|
BOOTHDD="" |
|
|
SWAPHDD="" |
|
|
ROOTHDD="${HDD}1" |
|
|
;; |
|
|
normal) |
|
|
BOOTHDD="${HDD}1" |
|
|
SWAPHDD="${HDD}2" |
|
|
ROOTHDD="${HDD}3" |
|
|
;; |
|
|
esac |
|
|
|
|
257 |
# sanity check - should not happen |
# sanity check - should not happen |
258 |
if is_mounted --device "${ROOTHDD}" |
if is_mounted --device "${ROOTHDD}" |
259 |
then |
then |
285 |
## delete disk |
## delete disk |
286 |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
287 |
|
|
288 |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
if [[ ${FLASHDISK} = 1 ]] |
289 |
then |
then |
290 |
## setup one bootable partition |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
291 |
#1. n= new disk |
then |
292 |
#2. p= primary disk |
## setup one bootable partition |
293 |
#3. 1= first partition |
# 1. n= new disk |
294 |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
# 2. p= primary disk |
295 |
#5. ''= defaul sector end |
# 3. 1= first partition |
296 |
#6. a= bootable flag |
# 4. 2= default sector start // small disk needs more space for grub2 mbr sector |
297 |
#7. 1= boot flag for partition 1 |
# 5. ''= defaul sector end |
298 |
#8. w= write/quit |
# 6. a= bootable flag |
299 |
fdisk ${HDD} &> /dev/null << EOF |
# 7. 1= boot flag for partition 1 |
300 |
|
# 8. n= new disk |
301 |
|
#10. p= primary disk |
302 |
|
#11. 2= second partition |
303 |
|
#12. ''= default sector start |
304 |
|
#13. ''= defaul sector end |
305 |
|
#14. w= write/quit |
306 |
|
fdisk ${HDD} &> /dev/null << EOF |
307 |
n |
n |
308 |
p |
p |
309 |
1 |
1 |
310 |
2 |
2 |
311 |
|
+50M |
312 |
|
a |
313 |
|
1 |
314 |
|
n |
315 |
|
p |
316 |
|
2 |
317 |
|
|
318 |
|
|
319 |
|
w |
320 |
|
EOF |
321 |
|
else |
322 |
|
## setup one bootable partition |
323 |
|
# 1. n= new disk |
324 |
|
# 2. p= primary disk |
325 |
|
# 3. 1= first partition |
326 |
|
# 4. ''= default sector start |
327 |
|
# 5. ''= defaul sector end |
328 |
|
# 6. a= bootable flag |
329 |
|
# 7. 1= boot flag for partition 1 |
330 |
|
# 8. n= new disk |
331 |
|
#10. p= primary disk |
332 |
|
#11. 2= second partition |
333 |
|
#12. ''= default sector start |
334 |
|
#13. ''= defaul sector end |
335 |
|
#14. w= write/quit |
336 |
|
fdisk ${HDD} &> /dev/null << EOF |
337 |
|
n |
338 |
|
p |
339 |
|
1 |
340 |
|
|
341 |
|
+50M |
342 |
a |
a |
343 |
1 |
1 |
344 |
|
n |
345 |
|
p |
346 |
|
2 |
347 |
|
|
348 |
|
|
349 |
w |
w |
350 |
EOF |
EOF |
351 |
|
fi |
352 |
else |
else |
353 |
## setup one bootable partition |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
354 |
#1. n= new disk |
then |
355 |
#2. p= primary disk |
## setup one bootable partition |
356 |
#3. 1= first partition |
#1. n= new disk |
357 |
#4. ''= default sector start |
#2. p= primary disk |
358 |
#5. ''= defaul sector end |
#3. 1= first partition |
359 |
#6. a= bootable flag |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
360 |
#7. 1= boot flag for partition 1 |
#5. ''= defaul sector end |
361 |
#8. w= write/quit |
#6. a= bootable flag |
362 |
fdisk ${HDD} &> /dev/null << EOF |
#7. 1= boot flag for partition 1 |
363 |
|
#8. w= write/quit |
364 |
|
fdisk ${HDD} &> /dev/null << EOF |
365 |
|
n |
366 |
|
p |
367 |
|
1 |
368 |
|
2 |
369 |
|
|
370 |
|
a |
371 |
|
1 |
372 |
|
w |
373 |
|
EOF |
374 |
|
else |
375 |
|
## setup one bootable partition |
376 |
|
#1. n= new disk |
377 |
|
#2. p= primary disk |
378 |
|
#3. 1= first partition |
379 |
|
#4. ''= default sector start |
380 |
|
#5. ''= defaul sector end |
381 |
|
#6. a= bootable flag |
382 |
|
#7. 1= boot flag for partition 1 |
383 |
|
#8. w= write/quit |
384 |
|
fdisk ${HDD} &> /dev/null << EOF |
385 |
n |
n |
386 |
p |
p |
387 |
1 |
1 |
391 |
1 |
1 |
392 |
w |
w |
393 |
EOF |
EOF |
394 |
|
fi |
395 |
fi |
fi |
396 |
else |
else |
397 |
cfdisk ${HDD} || dialog_die |
cfdisk ${HDD} || dialog_die |
400 |
|
|
401 |
setup_hdd_format() |
setup_hdd_format() |
402 |
{ |
{ |
403 |
|
install -d /tmp |
404 |
|
:> /tmp/format.log |
405 |
|
|
406 |
if [[ -n ${SWAPHDD} ]] |
if [[ -n ${SWAPHDD} ]] |
407 |
then |
then |
408 |
# sanity check - should not happen |
# sanity check - should not happen |
423 |
umount "${BOOTHDD}" |
umount "${BOOTHDD}" |
424 |
fi |
fi |
425 |
|
|
426 |
mkfs."${FORMAT_FILESYSTEM}" -q "${BOOTHDD}" || dialog_die |
mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die |
427 |
fi |
fi |
428 |
|
|
429 |
if [[ -n ${ROOTHDD} ]] |
if [[ -n ${ROOTHDD} ]] |
435 |
umount "${ROOTHDD}" |
umount "${ROOTHDD}" |
436 |
fi |
fi |
437 |
|
|
438 |
mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die |
mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die |
439 |
fi |
fi |
440 |
} |
} |
441 |
|
|
455 |
clearconfig |
clearconfig |
456 |
if [[ -n ${BOOTHDD} ]] |
if [[ -n ${BOOTHDD} ]] |
457 |
then |
then |
458 |
addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t1 1" |
addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1" |
459 |
fi |
fi |
460 |
if [[ -n ${ROOTHDD} ]] |
if [[ -n ${ROOTHDD} ]] |
461 |
then |
then |
462 |
addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" |
addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0" |
463 |
fi |
fi |
464 |
if [[ -n ${SWAPHDD} ]] |
if [[ -n ${SWAPHDD} ]] |
465 |
then |
then |
566 |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
567 |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
568 |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
569 |
|
i845) message+=$"\n\Z2Intel i845 VGA device detected.\Zn" ;; |
570 |
|
nomsi) message+=$"\n\Z2Mainboard with P5VD2-X/VT8237/VX700 chipset detected.\Zn" |
571 |
|
message+=$"\n\Z2Disabling Message Signaled Interrupts (MSI) capability of the kernel.\Zn" ;; |
572 |
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
573 |
esac |
esac |
574 |
if [[ ${FORMFACTOR} = laptop ]] |
if [[ ${FORMFACTOR} = laptop ]] |
575 |
then |
then |
576 |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
577 |
fi |
fi |
578 |
|
if [[ ${FLASHDISK} = 1 ]] |
579 |
|
then |
580 |
|
message+=$"\n\ZnFlash memory detected.\Zn" |
581 |
|
message+=$"\n\ZnF2FS will be used as default filesystem withn the auto installation mode.\Zn" |
582 |
|
fi |
583 |
|
|
584 |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
585 |
} |
} |
635 |
|
|
636 |
case "${method}" in |
case "${method}" in |
637 |
auto) |
auto) |
638 |
|
if [[ ${FLASHDISK} = 1 ]] |
639 |
|
then |
640 |
|
export BOOTHDD="${HDD}1" |
641 |
|
export SWAPHDD="" |
642 |
|
export ROOTHDD="${HDD}2" |
643 |
|
export FORMAT_FILESYSTEM_BOOTHDD="f2fs" |
644 |
|
export FORMAT_FILESYSTEM_ROOTHDD="ext2" |
645 |
|
else |
646 |
|
export BOOTHDD="" |
647 |
|
export SWAPHDD="" |
648 |
|
export ROOTHDD="${HDD}1" |
649 |
|
export FORMAT_FILESYSTEM_BOOTHDD="" |
650 |
|
export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" |
651 |
|
fi |
652 |
export INSTALL_METHOD="${method}" |
export INSTALL_METHOD="${method}" |
653 |
;; |
;; |
654 |
normal) |
normal) |
655 |
|
export BOOTHDD="${HDD}1" |
656 |
|
export SWAPHDD="${HDD}2" |
657 |
|
export ROOTHDD="${HDD}3" |
658 |
|
export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" |
659 |
|
export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" |
660 |
|
export INSTALL_METHOD="${method}" |
661 |
|
;; |
662 |
|
single) |
663 |
|
export BOOTHDD="" |
664 |
|
export SWAPHDD="" |
665 |
|
export ROOTHDD="${HDD}1" |
666 |
|
export FORMAT_FILESYSTEM_BOOTHDD="" |
667 |
|
export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" |
668 |
|
export INSTALL_METHOD="${method}" |
669 |
|
;; |
670 |
|
flash) |
671 |
|
export BOOTHDD="${HDD}1" |
672 |
|
export SWAPHDD="" |
673 |
|
export ROOTHDD="${HDD}2" |
674 |
|
export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" |
675 |
|
export FORMAT_FILESYSTEM_ROOTHDD="f2fs" |
676 |
export INSTALL_METHOD="${method}" |
export INSTALL_METHOD="${method}" |
677 |
;; |
;; |
678 |
*) |
*) |