40 |
fi |
fi |
41 |
done |
done |
42 |
|
|
43 |
|
# 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 |
### System/Config Version |
### System/Config Version |
63 |
VERSION="%VERSIONTAG%" |
VERSION="%VERSIONTAG%" |
64 |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
65 |
|
|
66 |
|
# initialize global variables so they are exportable |
67 |
# some sane defaults |
# some sane defaults |
68 |
LIVEROOT="${DEFAULT_LIVEROOT}" |
INSTALL_METHOD="" |
69 |
IMAGEROOT="${DEFAULT_IMAGEROOT}" |
if [[ -n ${cmdliveroot} ]] |
70 |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
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 |
KERNELPKG="${DEFAULT_KERNELPKG}" |
KERNELPKG="${DEFAULT_KERNELPKG}" |
88 |
KERNELOPTS="${DEFAULT_KERNELOPTS}" |
KERNELOPTS="${DEFAULT_KERNELOPTS}" |
89 |
GRUBLEGACYOPTS="" |
GRUBLEGACYOPTS="" |
91 |
FDISKPARTIONBELOW256MB=0 |
FDISKPARTIONBELOW256MB=0 |
92 |
SPECIALDEVICE="" |
SPECIALDEVICE="" |
93 |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
94 |
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
if [[ -n ${cmdformatfilesystem} ]] |
95 |
|
then |
96 |
|
FORMAT_FILESYSTEM="${cmdformatfilesystem}" |
97 |
|
else |
98 |
|
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
99 |
|
fi |
100 |
|
FLASHDISK=0 |
101 |
|
|
102 |
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
103 |
# -> now in images.conf |
# -> now in images.conf |
123 |
is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys |
is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys |
124 |
is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot |
is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot |
125 |
is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} |
is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} |
126 |
|
[[ -n ${SWAPHDD} ]] && swapoff ${SWAPHDD} |
127 |
|
|
128 |
echo $"Installation aborted." |
echo $"Installation aborted." |
129 |
exit 1 |
exit 1 |
193 |
run_hardware_detection() |
run_hardware_detection() |
194 |
{ |
{ |
195 |
local hwinfo |
local hwinfo |
|
|
|
196 |
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
197 |
|
|
198 |
# check for special devices/clients: |
# check for special devices/clients: |
200 |
local removable=0 |
local removable=0 |
201 |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
202 |
then |
then |
203 |
#for i in /sys/block/[hs]d*/removable |
for i in /sys/block/[hs]d*/removable |
204 |
#do |
do |
205 |
# if [[ $(< ${i}) = 1 ]] |
if [[ $(< ${i}) = 1 ]] |
206 |
# then |
then |
207 |
# removable=1 |
removable=1 |
208 |
# fi |
# we assume that all removable disks are flash disks on a zotac |
209 |
#done |
export FLASHDISK=1 |
210 |
|
fi |
211 |
|
done |
212 |
# smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
# smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
213 |
|
|
214 |
# 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 |
240 |
export GRUBLEGACYOPTS="" |
export GRUBLEGACYOPTS="" |
241 |
fi |
fi |
242 |
|
|
243 |
|
# 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 |
# check for special devices/clients: |
# check for special devices/clients: |
270 |
# check for laptops and activate cpufreq scaling |
# check for laptops and activate cpufreq scaling |
271 |
if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] |
if [[ $(echo "${hwinfo}" | grep 'Formfactor:' | sed 's:.*Formfactor\:\ \"\(.*\)\":\1:') = laptop ]] |
323 |
## delete disk |
## delete disk |
324 |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
325 |
|
|
326 |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
if [[ ${FLASHDISK} = 1 ]] |
327 |
then |
then |
328 |
## setup one bootable partition |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
329 |
#1. n= new disk |
then |
330 |
#2. p= primary disk |
## setup one bootable partition |
331 |
#3. 1= first partition |
# 1. n= new disk |
332 |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
# 2. p= primary disk |
333 |
#5. ''= defaul sector end |
# 3. 1= first partition |
334 |
#6. a= bootable flag |
# 4. 2= default sector start // small disk needs more space for grub2 mbr sector |
335 |
#7. 1= boot flag for partition 1 |
# 5. ''= defaul sector end |
336 |
#8. w= write/quit |
# 6. a= bootable flag |
337 |
fdisk ${HDD} &> /dev/null << EOF |
# 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 |
n |
n |
346 |
p |
p |
347 |
1 |
1 |
348 |
2 |
2 |
349 |
|
+50M |
350 |
|
a |
351 |
|
1 |
352 |
|
n |
353 |
|
p |
354 |
|
2 |
355 |
|
|
356 |
|
|
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 |
a |
a |
381 |
1 |
1 |
382 |
|
n |
383 |
|
p |
384 |
|
2 |
385 |
|
|
386 |
|
|
387 |
w |
w |
388 |
EOF |
EOF |
389 |
|
fi |
390 |
else |
else |
391 |
## setup one bootable partition |
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
392 |
#1. n= new disk |
then |
393 |
#2. p= primary disk |
## setup one bootable partition |
394 |
#3. 1= first partition |
#1. n= new disk |
395 |
#4. ''= default sector start |
#2. p= primary disk |
396 |
#5. ''= defaul sector end |
#3. 1= first partition |
397 |
#6. a= bootable flag |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
398 |
#7. 1= boot flag for partition 1 |
#5. ''= defaul sector end |
399 |
#8. w= write/quit |
#6. a= bootable flag |
400 |
fdisk ${HDD} &> /dev/null << EOF |
#7. 1= boot flag for partition 1 |
401 |
|
#8. w= write/quit |
402 |
|
fdisk ${HDD} &> /dev/null << EOF |
403 |
|
n |
404 |
|
p |
405 |
|
1 |
406 |
|
2 |
407 |
|
|
408 |
|
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 |
n |
424 |
p |
p |
425 |
1 |
1 |
429 |
1 |
1 |
430 |
w |
w |
431 |
EOF |
EOF |
432 |
|
fi |
433 |
fi |
fi |
434 |
else |
else |
435 |
cfdisk ${HDD} || dialog_die |
cfdisk ${HDD} || dialog_die |
604 |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
605 |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
606 |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
607 |
|
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 |
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
611 |
esac |
esac |
612 |
if [[ ${FORMFACTOR} = laptop ]] |
if [[ ${FORMFACTOR} = laptop ]] |
613 |
then |
then |
614 |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
615 |
fi |
fi |
616 |
|
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 |
|
|
622 |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
623 |
} |
} |
673 |
|
|
674 |
case "${method}" in |
case "${method}" in |
675 |
auto) |
auto) |
676 |
export BOOTHDD="" |
if [[ ${FLASHDISK} = 1 ]] |
677 |
export SWAPHDD="" |
then |
678 |
export ROOTHDD="${HDD}1" |
export BOOTHDD="${HDD}1" |
679 |
export FORMAT_FILESYSTEM_BOOTHDD="" |
export SWAPHDD="" |
680 |
export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" |
export ROOTHDD="${HDD}2" |
681 |
|
export FORMAT_FILESYSTEM_BOOTHDD="f2fs" |
682 |
|
export FORMAT_FILESYSTEM_ROOTHDD="ext2" |
683 |
|
else |
684 |
|
export BOOTHDD="" |
685 |
|
export SWAPHDD="" |
686 |
|
export ROOTHDD="${HDD}1" |
687 |
|
export FORMAT_FILESYSTEM_BOOTHDD="" |
688 |
|
export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" |
689 |
|
fi |
690 |
export INSTALL_METHOD="${method}" |
export INSTALL_METHOD="${method}" |
691 |
;; |
;; |
692 |
normal) |
normal) |