7 |
# Niels Rogalla <niro@magellan-linux.de> |
# Niels Rogalla <niro@magellan-linux.de> |
8 |
# |
# |
9 |
|
|
10 |
# ignore the environment |
# setup locales |
11 |
LC_ALL=C |
TEXTDOMAIN=installer |
12 |
|
|
13 |
# include dir |
# include dir |
14 |
INSTALLER_LIBDIR="%LIBDIR%" |
INSTALLER_LIBDIR="%LIBDIR%" |
15 |
|
|
28 |
${INSTALLER_LIBDIR}/functions/common.sh \ |
${INSTALLER_LIBDIR}/functions/common.sh \ |
29 |
${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ |
${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ |
30 |
${INSTALLER_LIBDIR}/functions/hwdetection.sh \ |
${INSTALLER_LIBDIR}/functions/hwdetection.sh \ |
31 |
|
${INSTALLER_LIBDIR}/functions/bootloader.sh \ |
32 |
|
${INSTALLER_LIBDIR}/functions/initrd-tools.sh \ |
33 |
${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
${INSTALLER_LIBDIR}/functions/installer-dialogs.sh |
34 |
do |
do |
35 |
if [ -e ${inc} ] |
if [ -e ${inc} ] |
40 |
fi |
fi |
41 |
done |
done |
42 |
|
|
43 |
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
# fetch cmdline |
44 |
# -> now in images.conf |
for argv in $* |
45 |
CDIMAGENAME="" |
do |
46 |
TOTALLINES="" |
case $1 in |
47 |
CURRENTLINE=0 |
--liveroot) shift; cmdliveroot="$1" ;; |
48 |
if [ -e /mnt/cdrom/system/images.conf ] |
--imageroot) shift; cmdimageroot="$1" ;; |
49 |
then |
--installroot) shift; cmdinstallroot="$1" ;; |
50 |
source /mnt/cdrom/system/images.conf |
--filesystem) shift; cmdformatfilesystem="$1" ;; |
51 |
# check if all required variables are set |
--help) |
52 |
[[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf" |
echo "$0 options:" |
53 |
[[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf" |
echo " --liveroot [path] - override default liveroot" |
54 |
else |
echo " --imageroot [path] - override default imageroot" |
55 |
die "/mnt/cdrom/system/images.conf not found" |
echo " --installroot [path] - override default installroot" |
56 |
fi |
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 |
CDROOT="${DEFAULT_CDROOT}" |
INSTALL_METHOD="" |
69 |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
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 |
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 ! |
103 |
# DIALOG BOXEN # |
# -> 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 |
|
|
117 |
|
### helper scripts ### |
118 |
|
|
119 |
trap_exit() |
trap_exit() |
120 |
{ |
{ |
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 |
130 |
} |
} |
131 |
|
|
132 |
dialog_die() |
install_meter() |
|
{ |
|
|
ERROR="$1" |
|
|
RETVAL="$?" |
|
|
dialog_install_failure |
|
|
exit 1 |
|
|
} |
|
|
|
|
|
dialog_warning() |
|
|
{ |
|
|
local retval |
|
|
|
|
|
yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
|
|
retval=$? |
|
|
if [[ ${retval} -eq 1 ]] |
|
|
then |
|
|
clear |
|
|
echo $"The process was aborted." |
|
|
exit 1 |
|
|
fi |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_info() |
|
|
{ |
|
|
local SHDD="${HDD//\/dev\/}" |
|
|
|
|
|
messagebox -h $"[ Harddrive partitioning ]" \ |
|
|
$"\nPlease create 1 partition.\n\n\[ \Z3${SHDD}1\Zn ] type: \Z3linux\Zn with the whole diskspace\n\Please mark ${SHDD}1 \Z3bootable\Zn." |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_info_auto() |
|
133 |
{ |
{ |
134 |
local SHDD="${HDD//\/dev\/}" |
while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
135 |
|
do |
136 |
messagebox -h $"[ Harddrive partitioning ]" \ |
CURRENTLINE=$(grep -c . /tmp/install.log) |
137 |
$"\Z1Warning!\Zn\n\nAll data on disk [ \Z3${HDD}\Zn ] will be erased!" |
PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) |
138 |
|
echo ${PERCENT} |
139 |
|
sleep 1 |
140 |
|
done |
141 |
|
rm -f /tmp/install.log |
142 |
|
return 0 |
143 |
} |
} |
144 |
|
|
145 |
dialog_setup_system_menu() |
mount_rootfs() |
146 |
{ |
{ |
|
local mode |
|
147 |
local retval |
local retval |
148 |
|
|
149 |
mode=$(menubox -h $"[ Harddrive partitioning ]" $"\nSelect an installation mode" \ |
if [[ -n ${SWAPHDD} ]] |
|
$"1:Automatic setup (recommended)" \ |
|
|
":" \ |
|
|
$":\Z1Expert modes:\Zn" \ |
|
|
$"2:Common IDE-disk (manual setup)") |
|
|
retval=$? |
|
|
[[ ${retval} -eq 1 ]] && return 1 |
|
|
if [[ ${retval} -eq 0 ]] |
|
150 |
then |
then |
151 |
case "${mode}" in |
swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'" |
|
"1") run_install_auto ;; |
|
|
"2") run_install_normal ;; |
|
|
"") dialog_setup_system_menu;; |
|
|
esac |
|
152 |
fi |
fi |
|
} |
|
153 |
|
|
154 |
dialog_hardware_detection() |
if [[ -n ${ROOTHDD} ]] |
|
{ |
|
|
local message |
|
|
|
|
|
run_hardware_detection_disks |
|
|
|
|
|
message+=$"Harddrives:\n" |
|
|
|
|
|
if [[ ! -z ${ALL_DISKS} ]] |
|
|
then |
|
|
for i in ${ALL_DISKS} |
|
|
do |
|
|
message+="\Z3${i}\Zn " |
|
|
done |
|
|
message+="\n" |
|
|
fi |
|
|
|
|
|
if [[ ! -z ${ALL_CDROMS} ]] |
|
155 |
then |
then |
156 |
message+="\n" |
if is_mounted --location "${INSTALLROOT}" |
|
message+=$"Optical disk drives:\n" |
|
|
for i in ${ALL_CDROMS} |
|
|
do |
|
|
message+="\Z3${i}\Zn" |
|
|
done |
|
|
message+="\n" |
|
|
fi |
|
|
|
|
|
# other devices |
|
|
run_hardware_detection |
|
|
case "${SPECIALDEVICE}" in |
|
|
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
|
|
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
|
|
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
|
|
*) message+=$"\n \\ZnCommon device detected.\Zn" ;; |
|
|
esac |
|
|
if [[ ${FORMFACTOR} = laptop ]] |
|
|
then |
|
|
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
|
|
fi |
|
|
|
|
|
messagebox -y 15 -h $"Detected hardware:" "${message}" |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_partitions_manual() |
|
|
{ |
|
|
local i |
|
|
|
|
|
if [[ -z ${installdevs} ]] |
|
|
then |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--ok-label "Beenden" \ |
|
|
--msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70 |
|
|
exit 1 |
|
|
else |
|
|
|
|
|
echo "dialog \\" > /tmp/hddtmp.sh |
|
|
echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--stdout \\" >> /tmp/hddtmp.sh |
|
|
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
|
|
|
|
|
for i in ${installdevs} |
|
|
do |
|
|
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
|
|
done |
|
|
echo -e "\n" >> /tmp/hddtmp.sh |
|
|
|
|
|
chmod a+x /tmp/hddtmp.sh |
|
|
HDD="$(/tmp/hddtmp.sh)" |
|
|
RES=$? |
|
|
[[ ${RES} -eq 1 ]] && return 1 |
|
|
if [[ ${RES} -eq 0 ]] |
|
157 |
then |
then |
158 |
dialog_setup_hdd_info |
echo $"${INSTALLROOT} already mounted" >&2 |
159 |
setup_hdd_partitions_manual |
else |
160 |
|
mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" |
161 |
fi |
fi |
162 |
fi |
fi |
|
} |
|
163 |
|
|
164 |
dialog_setup_hdd_partitions_auto() |
[[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
|
{ |
|
|
local i |
|
165 |
|
|
166 |
if [[ -z ${installdevs} ]] |
if [[ -n ${BOOTHDD} ]] |
167 |
then |
then |
168 |
dialog \ |
if is_mounted --location "${INSTALLROOT}"/boot |
169 |
--backtitle "${TITLE}" \ |
then |
170 |
--ok-label "Beenden" \ |
echo $"${INSTALLROOT}/boot already mounted" >&2 |
171 |
--msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70 |
else |
172 |
exit 1 |
mount -t "${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" |
|
else |
|
|
|
|
|
echo "dialog \\" > /tmp/hddtmp.sh |
|
|
echo "--backtitle \"${TITLE}\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--ok-label \"Weiter\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--cancel-label \"Beenden\" \\" >> /tmp/hddtmp.sh |
|
|
echo "--stdout \\" >> /tmp/hddtmp.sh |
|
|
echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh |
|
|
|
|
|
for i in ${installdevs} |
|
|
do |
|
|
echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh |
|
|
done |
|
|
echo -e "\n" >> /tmp/hddtmp.sh |
|
|
|
|
|
chmod a+x /tmp/hddtmp.sh |
|
|
HDD="$(/tmp/hddtmp.sh)" |
|
|
RES=$? |
|
|
[[ ${RES} -eq 1 ]] && return 1 |
|
|
if [[ ${RES} -eq 0 ]] |
|
|
then |
|
|
dialog_setup_hdd_info_auto |
|
|
dialog_setup_hdd_create_partitions |
|
|
setup_hdd_partitions_auto |
|
173 |
fi |
fi |
174 |
fi |
fi |
175 |
} |
} |
176 |
|
|
177 |
run_hardware_detection_disks() |
umount_rootfs() |
178 |
{ |
{ |
179 |
local bootdev |
is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
180 |
|
is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} |
181 |
|
|
182 |
# all disks but exclude ramdisks |
if [[ -n ${SWAPHDD} ]] |
|
export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
|
|
# remove the boot device from ALL_DISKS if it was an usbstick |
|
|
if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
|
183 |
then |
then |
184 |
bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" |
swapoff ${SWAPHDD} || die |
|
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
|
185 |
fi |
fi |
|
export ALL_CDROMS="$(get_hwinfo cdrom)" |
|
186 |
} |
} |
187 |
|
|
188 |
dialog_setup_hdd_create_partitions() |
install_do_reboot() |
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Erstelle Disk Partitionen ..." 3 70 |
|
|
} |
|
|
|
|
|
dialog_setup_hdd_format() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Erstelle Datei-Systeme ..." 3 70 |
|
|
} |
|
|
|
|
|
dialog_install_settings() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Speichere System-Einstellungen ..." 3 70 |
|
|
} |
|
|
|
|
|
dialog_install_system_image() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--gauge "Kopiere System-Image ..." 6 80 |
|
|
} |
|
|
|
|
|
dialog_install_meter() |
|
|
{ |
|
|
while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
|
|
do |
|
|
CURRENTLINE=$(grep -c . /tmp/install.log) |
|
|
PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) |
|
|
echo ${PERCENT} |
|
|
sleep 1 |
|
|
done |
|
|
rm -f /tmp/install.log |
|
|
return 0 |
|
|
} |
|
|
|
|
|
|
|
|
dialog_install_bootsector() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--infobox "Schreibe den Bootsektor ..." 3 70 |
|
|
} |
|
|
|
|
|
dialog_install_successful() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--colors \ |
|
|
--msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81 |
|
|
} |
|
|
|
|
|
dialog_install_failure() |
|
|
{ |
|
|
dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--colors \ |
|
|
--msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\ |
|
|
Fehler bei ${ERROR}, RetVal: ${RETVAL} \ |
|
|
" 10 81 |
|
|
} |
|
|
|
|
|
dialog_main() |
|
189 |
{ |
{ |
190 |
METHOD=0 |
reboot |
|
|
|
|
while [[ ${METHOD} -le 2 ]] |
|
|
do |
|
|
METHOD=$(dialog \ |
|
|
--backtitle "${TITLE}" \ |
|
|
--no-cancel \ |
|
|
--ok-label "Weiter" \ |
|
|
--stdout \ |
|
|
--menu "Konfiguration" 14 70 5 \ |
|
|
"1" "AutoSta_LX installieren" \ |
|
|
"2" "Uebersicht gefundener Laufwerke" \ |
|
|
"3" "Beenden und neustarten" \ |
|
|
"4" "Beenden und eine Shell starten") |
|
|
RES=$? |
|
|
[[ ${RES} -eq 1 ]] && exit 1 |
|
|
if [[ ${RES} -eq 0 ]] |
|
|
then |
|
|
case ${METHOD} in |
|
|
"1") dialog_setup_system_menu ;; |
|
|
"2") dialog_hardware_detection ;; |
|
|
"3") install_do_reboot ;; |
|
|
"4") /bin/bash --login -i ;; |
|
|
esac |
|
|
fi |
|
|
done |
|
191 |
} |
} |
192 |
|
|
|
################################################# |
|
|
# Install Komandos # |
|
|
################################################# |
|
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: |
205 |
if [[ $(< ${i}) = 1 ]] |
if [[ $(< ${i}) = 1 ]] |
206 |
then |
then |
207 |
removable=1 |
removable=1 |
208 |
|
# we assume that all removable disks are flash disks on a zotac |
209 |
|
export FLASHDISK=1 |
210 |
fi |
fi |
211 |
done |
done |
212 |
|
# 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 |
215 |
export GRUBLEGACYOPTS="rootdelay=8" |
export GRUBLEGACYOPTS="rootdelay=8" |
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 ]] |
275 |
fi |
fi |
276 |
} |
} |
277 |
|
|
278 |
hdd_size_below_256mb() |
run_hardware_detection_disks() |
279 |
{ |
{ |
280 |
local hdd="$1" |
local bootdev |
|
local size |
|
|
local retval |
|
|
[[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!" |
|
281 |
|
|
282 |
size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') |
# all disks but exclude ramdisks |
283 |
if [[ ${size} -le 257000000 ]] |
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 |
|
if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
286 |
then |
then |
287 |
retval="0" |
bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g') |
288 |
else |
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
|
retval="1" |
|
289 |
fi |
fi |
290 |
|
export ALL_CDROMS="$(get_hwinfo cdrom)" |
|
return "${retval}" |
|
291 |
} |
} |
292 |
|
|
293 |
setup_hdd_partitions_auto() |
setup_hdd_partitions() |
294 |
{ |
{ |
295 |
ROOTHDD="${HDD}1" |
# sanity check - should not happen |
296 |
|
if is_mounted --device "${ROOTHDD}" |
297 |
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
then |
298 |
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 |
299 |
|
umount "${ROOTHDD}" |
300 |
|
fi |
301 |
|
if [[ -n ${BOOTHDD} ]] |
302 |
then |
then |
303 |
if hdd_size_below_256mb ${HDD} |
if is_mounted --device "${BOOTHDD}" |
304 |
then |
then |
305 |
FDISKPARTIONBELOW256MB=1 |
echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2 |
306 |
else |
umount "${BOOTHDD}" |
|
FDISKPARTIONBELOW256MB=0 |
|
307 |
fi |
fi |
308 |
fi |
fi |
309 |
|
|
310 |
## delete disk |
if [[ ${INSTALL_METHOD} = auto ]] |
|
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
|
|
|
|
|
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
|
311 |
then |
then |
312 |
## setup one bootable partition |
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
313 |
#1. n= new disk |
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
314 |
#2. p= primary disk |
then |
315 |
#3. 1= first partition |
if device_minimum_size "${HDD}" 256 |
316 |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
then |
317 |
#5. ''= defaul sector end |
FDISKPARTIONBELOW256MB=1 |
318 |
#6. a= bootable flag |
else |
319 |
#7. 1= boot flag for partition 1 |
FDISKPARTIONBELOW256MB=0 |
320 |
#8. w= write/quit |
fi |
321 |
fdisk ${HDD} &> /dev/null << EOF |
fi |
322 |
|
|
323 |
|
## delete disk |
324 |
|
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
325 |
|
|
326 |
|
if [[ ${FLASHDISK} = 1 ]] |
327 |
|
then |
328 |
|
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 |
n |
n |
346 |
p |
p |
347 |
1 |
1 |
348 |
2 |
2 |
349 |
|
+50M |
350 |
a |
a |
351 |
1 |
1 |
352 |
|
n |
353 |
|
p |
354 |
|
2 |
355 |
|
|
356 |
|
|
357 |
w |
w |
358 |
EOF |
EOF |
359 |
else |
else |
360 |
## setup one bootable partition |
## setup one bootable partition |
361 |
#1. n= new disk |
# 1. n= new disk |
362 |
#2. p= primary disk |
# 2. p= primary disk |
363 |
#3. 1= first partition |
# 3. 1= first partition |
364 |
#4. ''= default sector start |
# 4. ''= default sector start |
365 |
#5. ''= defaul sector end |
# 5. ''= defaul sector end |
366 |
#6. a= bootable flag |
# 6. a= bootable flag |
367 |
#7. 1= boot flag for partition 1 |
# 7. 1= boot flag for partition 1 |
368 |
#8. w= write/quit |
# 8. n= new disk |
369 |
fdisk ${HDD} &> /dev/null << EOF |
#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 |
n |
376 |
p |
p |
377 |
1 |
1 |
378 |
|
|
379 |
|
+50M |
380 |
|
a |
381 |
|
1 |
382 |
|
n |
383 |
|
p |
384 |
|
2 |
385 |
|
|
386 |
|
|
387 |
|
w |
388 |
|
EOF |
389 |
|
fi |
390 |
|
else |
391 |
|
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 |
|
n |
404 |
|
p |
405 |
|
1 |
406 |
|
2 |
407 |
|
|
408 |
a |
a |
409 |
1 |
1 |
410 |
w |
w |
411 |
EOF |
EOF |
412 |
fi |
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 |
|
|
|
setup_hdd_partitions_manual() |
|
|
{ |
|
|
ROOTHDD="${HDD}1" |
|
427 |
|
|
428 |
## hdds partitionieren manual |
a |
429 |
cfdisk ${HDD} || dialog_die |
1 |
430 |
|
w |
431 |
|
EOF |
432 |
|
fi |
433 |
|
fi |
434 |
|
else |
435 |
|
cfdisk ${HDD} || dialog_die |
436 |
|
fi |
437 |
} |
} |
438 |
|
|
439 |
setup_hdd_format() |
setup_hdd_format() |
440 |
{ |
{ |
441 |
mke2fs -j -q ${ROOTHDD} || dialog_die |
install -d /tmp |
442 |
} |
:> /tmp/format.log |
443 |
|
|
444 |
install_mount_rootfs() |
if [[ -n ${SWAPHDD} ]] |
|
{ |
|
|
mount ${ROOTHDD} ${INSTALLROOT} || dialog_die |
|
|
install -d ${INSTALLROOT}/boot || dialog_die |
|
|
cd ${INSTALLROOT} || dialog_die |
|
|
} |
|
|
|
|
|
install_system_image() |
|
|
{ |
|
|
tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
|
|
} |
|
|
|
|
|
install_bootsector_chroot() |
|
|
{ |
|
|
local my_roothdd |
|
|
local grubconf=${INSTALLROOT}/boot/grub/grub.conf |
|
|
local grub2conf=/boot/grub/grub.cfg |
|
|
|
|
|
# check for grub2 |
|
|
if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
|
445 |
then |
then |
446 |
# needed by grub-mkconfig on the first run |
# sanity check - should not happen |
447 |
if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] |
if is_mounted --device "${SWAPHDD}" |
448 |
then |
then |
449 |
install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die |
echo "format: device ${SWAPHDD} is already mounted, umount it" >&2 |
450 |
|
umount "${SWAPHDD}" |
451 |
fi |
fi |
452 |
|
mkswap ${SWAPHDD} || die |
453 |
|
fi |
454 |
|
|
455 |
# set kernelopts |
if [[ -n ${BOOTHDD} ]] |
456 |
if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
then |
457 |
|
# sanity check - should not happen |
458 |
|
if is_mounted --device "${BOOTHDD}" |
459 |
then |
then |
460 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
echo "format: device ${BOOTHDD} is already mounted, umount it" >&2 |
461 |
else |
umount "${BOOTHDD}" |
|
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
|
462 |
fi |
fi |
|
echo 'grub-mkdevicemap' > ${INSTALLROOT}/root/.installrc || dialog_die |
|
|
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
|
|
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
|
|
echo "exit 0" >> ${INSTALLROOT}/root/.installrc || dialog_die |
|
463 |
|
|
464 |
# grub-legacy |
mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die |
465 |
else |
fi |
|
### grubconf schreiben |
|
|
source ${INSTALLROOT}/boot/kernelversion |
|
466 |
|
|
467 |
#for alx only |
if [[ -n ${ROOTHDD} ]] |
468 |
if [ -e ${INSTALLROOT}/etc/alx_version ] |
then |
469 |
|
# sanity check - should not happen |
470 |
|
if is_mounted --device "${ROOTHDD}" |
471 |
then |
then |
472 |
OLD_ALXVER="${ALXVER}" |
echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 |
473 |
source ${INSTALLROOT}/etc/alx_version |
umount "${ROOTHDD}" |
|
KRNVER="ALX-${ALXVER}" |
|
|
ALXVER="${OLD_ALXVER}" |
|
474 |
fi |
fi |
475 |
|
|
476 |
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die |
477 |
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
fi |
478 |
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
} |
|
|
|
|
# uuid support |
|
|
if is_uuid_supported |
|
|
then |
|
|
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
|
|
else |
|
|
my_roothdd="${ROOTHDD}" |
|
|
fi |
|
479 |
|
|
480 |
: > ${grubconf} || dialog_die |
install_system_image() |
481 |
echo "default 0" >> ${grubconf} || dialog_die |
{ |
482 |
echo "timeout 3" >> ${grubconf} || dialog_die |
pushd ${INSTALLROOT} > /dev/null |
483 |
# using current root password |
tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT} |
484 |
echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || dialog_die |
popd > /dev/null |
485 |
|
} |
486 |
|
|
487 |
echo >> ${grubconf} || dialog_die |
install_system_settings() |
488 |
echo "# normal boot" >> ${grubconf} || dialog_die |
{ |
489 |
echo "title ${KRNVER}" >> ${grubconf} || dialog_die |
local CONFIG |
|
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
|
|
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || dialog_die |
|
|
if is_initrd_supported |
|
|
then |
|
|
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
|
|
fi |
|
490 |
|
|
491 |
echo >> ${grubconf} || dialog_die |
# write fstab |
492 |
echo "# admin boot" >> ${grubconf} || dialog_die |
CONFIG="${INSTALLROOT}/etc/fstab" |
493 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || dialog_die |
clearconfig |
494 |
echo "lock" >> ${grubconf} || dialog_die |
if [[ -n ${BOOTHDD} ]] |
495 |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
then |
496 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || dialog_die |
addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1" |
497 |
if is_initrd_supported |
fi |
498 |
then |
if [[ -n ${ROOTHDD} ]] |
499 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
then |
500 |
fi |
addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0" |
501 |
|
fi |
502 |
|
if [[ -n ${SWAPHDD} ]] |
503 |
|
then |
504 |
|
addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" |
505 |
|
fi |
506 |
|
addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
507 |
|
addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" |
508 |
|
|
509 |
echo >> ${grubconf} || dialog_die |
# install network config skeleton |
510 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || dialog_die |
CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
511 |
echo "lock" >> ${grubconf} || dialog_die |
clearconfig |
512 |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
addconfig 'ONBOOT="yes"' |
513 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || dialog_die |
addconfig 'NETWORKING="dhcp"' |
514 |
if is_initrd_supported |
|
515 |
|
# intel framebuffer quirk |
516 |
|
CONFIG="${INSTALLROOT}/etc/splash/splash.conf" |
517 |
|
if [ -e ${CONFIG} ] && [ -e /proc/fb ] |
518 |
|
then |
519 |
|
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
520 |
then |
then |
521 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
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 |
fi |
fi |
|
|
|
|
# bootsector schreiben chrooted schreiben (lfs/magellan) |
|
|
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
|
|
/usr/sbin/grub --no-floppy --batch << "EOF" 1> /dev/null 2> /dev/null |
|
|
root (hd0,0) |
|
|
setup (hd0) |
|
|
quit |
|
|
EOF |
|
|
exit 0 |
|
|
CHROOTEOF |
|
524 |
fi |
fi |
525 |
|
} |
526 |
|
|
|
## enter chroot |
|
|
mount -t proc proc ${INSTALLROOT}/proc |
|
|
mount -t sysfs sysfs ${INSTALLROOT}/sys |
|
|
mount -o bind /dev ${INSTALLROOT}/dev |
|
|
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
|
|
umount ${INSTALLROOT}/proc |
|
|
umount ${INSTALLROOT}/sys |
|
|
umount ${INSTALLROOT}/dev |
|
|
rm ${INSTALLROOT}/root/.installrc |
|
|
} |
|
|
|
|
|
is_initrd_supported() |
|
|
{ |
|
|
# only generate initrds if the cmd exists |
|
|
[[ -x ${INSTALLROOT}/sbin/mkinitrd ]] && return 0 |
|
|
return 1 |
|
|
} |
|
|
|
|
|
install_initrd_chroot() |
|
|
{ |
|
|
# only generate initrds if the cmd exists |
|
|
is_initrd_supported || return 0 |
|
|
|
|
|
DISKMODS="sd_mod" |
|
|
OLDPATAMODS="amd74xx piix sis5513 via82cxxx" |
|
|
PATAMODS="ata_piix pata_amd pata_mpiix pata_oldpiix pata_sis pata_via" |
|
|
SATAMODS="sata_via sata_sis sata_nv" |
|
|
DRMMODS="i915 mga nouveau r128 radeon savage sis tdfx ttm via" |
|
|
OTHERMODS="" |
|
|
case ${SPECIALDEVICE} in |
|
|
zotac_intel) FBMODS=""; DRMMODS="i915" ;; |
|
|
zotac_nvidia) FBMODS=""; DRMMODS="nouveau" ;; |
|
|
rangee) FBMODS="" ;; ## fallback to vesafb, viafb does not run on all CLE266 boards |
|
|
# not working with kms enabled drivers -> segfaults |
|
|
#maxdata) FBMODS="i810fb" ;; ## check for maxdata / i810/ i815 Chipsets and disable KMS and use i810fb frambuffer |
|
|
maxdata) FBMODS="" ;; |
|
|
*) FBMODS="uvesafb" ;; |
|
|
esac |
|
527 |
|
|
528 |
if [[ ${FORMFACTOR} = laptop ]] |
### installer dialogs ### |
|
then |
|
|
OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" |
|
|
fi |
|
529 |
|
|
530 |
# install an appropriate uvesafb.conf |
dialog_die() |
531 |
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
{ |
532 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die |
ERROR="$1" |
533 |
|
RETVAL="$?" |
534 |
|
dialog_install_failure |
535 |
|
exit 1 |
536 |
|
} |
537 |
|
|
538 |
# install an appropriate viafb.conf |
dialog_warning() |
539 |
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die |
{ |
540 |
|
local retval |
541 |
|
|
542 |
# install an appropriate i810fb.conf |
yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
543 |
echo "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" > ${INSTALLROOT}/etc/modprobe.d/i810fb.conf || dialog_die |
retval=$? |
544 |
|
if [[ ${retval} -eq 1 ]] |
545 |
|
then |
546 |
|
clear |
547 |
|
echo $"The process was aborted." |
548 |
|
exit 1 |
549 |
|
fi |
550 |
|
} |
551 |
|
|
|
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
|
|
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
|
|
mkinitrd -f /boot/$(readlink /boot/initrd) $(readlink /boot/vmlinuz | sed "s:kernel-::g") > /dev/null |
|
|
exit 0 |
|
|
CHROOTEOF |
|
552 |
|
|
553 |
## enters chroot |
### installer tasks ### |
|
mount -t proc proc ${INSTALLROOT}/proc |
|
|
mount -t sysfs sysfs ${INSTALLROOT}/sys |
|
|
mount -o bind /dev ${INSTALLROOT}/dev |
|
|
chroot ${INSTALLROOT} /bin/bash --rcfile /root/.installrc -i |
|
|
umount ${INSTALLROOT}/proc |
|
|
umount ${INSTALLROOT}/sys |
|
|
umount ${INSTALLROOT}/dev |
|
|
rm ${INSTALLROOT}/root/.installrc |
|
|
} |
|
554 |
|
|
555 |
is_uuid_supported() |
task_setup_system_menu() |
556 |
{ |
{ |
557 |
if [[ -x $(type -P busybox.mkinitrd) ]] |
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 |
then |
565 |
# only detect uuids if supported |
case "${mode}" in |
566 |
if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] |
"1") run_install auto ;; |
567 |
then |
"2") run_install normal ;; |
568 |
return 0 |
"") task_setup_system_menu;; |
569 |
fi |
esac |
570 |
fi |
fi |
|
|
|
|
return 1 |
|
571 |
} |
} |
572 |
|
|
573 |
get_uuid() |
task_hardware_detection() |
574 |
{ |
{ |
575 |
local UUID |
local message |
576 |
local SEC_TYPE |
|
577 |
local TYPE |
run_hardware_detection_disks |
578 |
|
|
579 |
local dev="$1" |
message+=$"Harddrives:\n" |
|
[[ -z ${dev} ]] && dialog_die "no dev given" |
|
580 |
|
|
581 |
# check if given device is already an UUID |
if [[ ! -z ${ALL_DISKS} ]] |
|
if [[ ${dev/UUID=/}x != ${dev}x ]] |
|
582 |
then |
then |
583 |
eval "${dev}" |
for i in ${ALL_DISKS} |
584 |
else |
do |
585 |
eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //') |
message+="\Z3${i}\Zn " |
586 |
|
done |
587 |
|
message+="\n" |
588 |
fi |
fi |
|
echo "${UUID}" |
|
|
} |
|
589 |
|
|
590 |
install_system_settings() |
if [[ ! -z ${ALL_CDROMS} ]] |
|
{ |
|
|
# schreibe fstab |
|
|
if is_uuid_supported |
|
591 |
then |
then |
592 |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
message+="\n" |
593 |
else |
message+=$"Optical disk drives:\n" |
594 |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
for i in ${ALL_CDROMS} |
595 |
|
do |
596 |
|
message+="\Z3${i}\Zn" |
597 |
|
done |
598 |
|
message+="\n" |
599 |
fi |
fi |
|
# not needed busybox loads all with swapon -a, even if not mentioned in fstab |
|
|
#echo -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
|
echo -e "proc\t/proc\tproc\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
|
echo -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
|
600 |
|
|
601 |
# install network config skeleton |
# other devices |
602 |
install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die |
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 |
|
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" ;; |
611 |
|
esac |
612 |
|
if [[ ${FORMFACTOR} = laptop ]] |
613 |
|
then |
614 |
|
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
615 |
|
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}" |
623 |
|
} |
624 |
|
|
625 |
|
task_setup_hdd_partitions() |
626 |
|
{ |
627 |
|
local i |
628 |
|
local retval |
629 |
|
|
630 |
# intel framebufer quirk |
if [[ -z ${ALL_DISKS} ]] |
|
if [[ -e /proc/fb ]] |
|
631 |
then |
then |
632 |
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
dialog_no_harddrive_found |
633 |
|
exit 1 |
634 |
|
else |
635 |
|
HDD=$(dialog_select_target_harddrive) |
636 |
|
retval=$? |
637 |
|
[[ ${retval} -eq 1 ]] && return 1 |
638 |
|
if [[ ${retval} -eq 0 ]] |
639 |
then |
then |
640 |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
dialog_setup_hdd_info |
641 |
if [[ ${fbdev} != 0 ]] |
setup_hdd_partitions |
|
then |
|
|
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
|
|
fi |
|
642 |
fi |
fi |
643 |
fi |
fi |
644 |
} |
} |
645 |
|
|
646 |
install_umount_rootfs() |
task_main() |
647 |
{ |
{ |
648 |
cd / |
local method=0 |
649 |
umount ${INSTALLROOT}/boot || dialog_die |
local retval |
|
umount ${INSTALLROOT} || dialog_die |
|
|
} |
|
650 |
|
|
651 |
install_do_reboot() |
while [[ ${method} -le 2 ]] |
652 |
{ |
do |
653 |
reboot |
method=$(dialog_main) |
654 |
|
retval=$? |
655 |
|
[[ ${retval} -eq 1 ]] && exit 1 |
656 |
|
if [[ ${retval} -eq 0 ]] |
657 |
|
then |
658 |
|
case ${method} in |
659 |
|
"1") task_setup_system_menu ;; |
660 |
|
"2") task_hardware_detection ;; |
661 |
|
"3") install_do_reboot ;; |
662 |
|
"4") /bin/bash --login -i ;; |
663 |
|
esac |
664 |
|
fi |
665 |
|
done |
666 |
} |
} |
667 |
|
|
668 |
################################################# |
run_install() |
|
# Install Ablauf Scripte # |
|
|
################################################# |
|
|
|
|
|
run_install_normal() |
|
669 |
{ |
{ |
670 |
dialog_hardware_detection |
local method="$1" |
|
|
|
|
dialog_setup_hdd_partitions_manual |
|
|
dialog_setup_hdd_format |
|
|
setup_hdd_format > /dev/null |
|
|
install_mount_rootfs |
|
|
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
|
|
|
|
|
dialog_install_settings |
|
|
sleep 1 |
|
|
install_system_settings |
|
|
install_initrd_chroot |
|
671 |
|
|
672 |
dialog_install_bootsector |
task_hardware_detection |
|
install_bootsector_chroot |
|
|
|
|
|
install_umount_rootfs |
|
|
dialog_install_successful |
|
|
} |
|
673 |
|
|
674 |
run_install_auto() |
case "${method}" in |
675 |
{ |
auto) |
676 |
dialog_hardware_detection |
if [[ ${FLASHDISK} = 1 ]] |
677 |
|
then |
678 |
|
export BOOTHDD="${HDD}1" |
679 |
|
export SWAPHDD="" |
680 |
|
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}" |
691 |
|
;; |
692 |
|
normal) |
693 |
|
export BOOTHDD="${HDD}1" |
694 |
|
export SWAPHDD="${HDD}2" |
695 |
|
export ROOTHDD="${HDD}3" |
696 |
|
export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" |
697 |
|
export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" |
698 |
|
export INSTALL_METHOD="${method}" |
699 |
|
;; |
700 |
|
single) |
701 |
|
export BOOTHDD="" |
702 |
|
export SWAPHDD="" |
703 |
|
export ROOTHDD="${HDD}1" |
704 |
|
export FORMAT_FILESYSTEM_BOOTHDD="" |
705 |
|
export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" |
706 |
|
export INSTALL_METHOD="${method}" |
707 |
|
;; |
708 |
|
flash) |
709 |
|
export BOOTHDD="${HDD}1" |
710 |
|
export SWAPHDD="" |
711 |
|
export ROOTHDD="${HDD}2" |
712 |
|
export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" |
713 |
|
export FORMAT_FILESYSTEM_ROOTHDD="f2fs" |
714 |
|
export INSTALL_METHOD="${method}" |
715 |
|
;; |
716 |
|
*) |
717 |
|
die "Unknown install method '${method}', aborting." |
718 |
|
;; |
719 |
|
esac |
720 |
|
|
721 |
dialog_setup_hdd_partitions_auto |
task_setup_hdd_partitions |
722 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
723 |
setup_hdd_format > /dev/null |
setup_hdd_format > /dev/null |
724 |
install_mount_rootfs |
mount_rootfs |
725 |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | dialog_install_meter | dialog_install_system_image |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
726 |
|
|
727 |
dialog_install_settings |
dialog_install_settings |
728 |
sleep 1 |
sleep 1 |
729 |
install_system_settings |
install_system_settings |
730 |
install_initrd_chroot |
if is_initrd_supported |
731 |
|
then |
732 |
|
dialog_install_initrd |
733 |
|
initrd_config |
734 |
|
initrd_install |
735 |
|
fi |
736 |
|
|
737 |
dialog_install_bootsector |
dialog_install_bootsector |
738 |
install_bootsector_chroot |
bootloader_config |
739 |
|
bootloader_install |
740 |
|
|
741 |
install_umount_rootfs |
umount_rootfs |
742 |
dialog_install_successful |
dialog_install_successful |
743 |
} |
} |
744 |
|
|
745 |
# set some proper traps |
# set some proper traps |
746 |
trap "trap_exit" SIGINT SIGQUIT |
trap "trap_exit" SIGINT SIGQUIT |
747 |
|
|
748 |
dialog_main |
task_main |
749 |
|
|
750 |
exit 0 |
exit 0 |