9 |
|
|
10 |
# setup locales |
# setup locales |
11 |
TEXTDOMAIN=installer |
TEXTDOMAIN=installer |
|
LC_MESSAGES=C |
|
12 |
|
|
13 |
# include dir |
# include dir |
14 |
INSTALLER_LIBDIR="%LIBDIR%" |
INSTALLER_LIBDIR="%LIBDIR%" |
40 |
fi |
fi |
41 |
done |
done |
42 |
|
|
|
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
|
|
# -> now in images.conf |
|
|
CDIMAGENAME="" |
|
|
TOTALLINES="" |
|
|
CURRENTLINE=0 |
|
|
if [ -e /mnt/cdrom/system/images.conf ] |
|
|
then |
|
|
source /mnt/cdrom/system/images.conf |
|
|
# check if all required variables are set |
|
|
[[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf" |
|
|
[[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf" |
|
|
else |
|
|
die "/mnt/cdrom/system/images.conf not found" |
|
|
fi |
|
|
|
|
43 |
### System/Config Version |
### System/Config Version |
44 |
VERSION="%VERSIONTAG%" |
VERSION="%VERSIONTAG%" |
45 |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
TITLE="${DEFAULT_TITLE} - ${VERSION}" |
46 |
|
|
47 |
# some sane defaults |
# some sane defaults |
48 |
CDROOT="${DEFAULT_CDROOT}" |
LIVEROOT="${DEFAULT_LIVEROOT}" |
49 |
|
IMAGEROOT="${DEFAULT_IMAGEROOT}" |
50 |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
INSTALLROOT="${DEFAULT_INSTALLROOT}" |
51 |
KERNELPKG="${DEFAULT_KERNELPKG}" |
KERNELPKG="${DEFAULT_KERNELPKG}" |
52 |
KERNELOPTS="${DEFAULT_KERNELOPTS}" |
KERNELOPTS="${DEFAULT_KERNELOPTS}" |
57 |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
FORMFACTOR="${DEFAULT_FORMFACTOR}" |
58 |
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" |
59 |
|
|
60 |
################################################# |
# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! |
61 |
# DIALOG BOXEN # |
# -> now in images.conf |
62 |
################################################# |
CDIMAGENAME="" |
63 |
|
TOTALLINES="" |
64 |
|
CURRENTLINE=0 |
65 |
|
if [ -e ${IMAGEROOT}/images.conf ] |
66 |
|
then |
67 |
|
source ${IMAGEROOT}/images.conf |
68 |
|
# check if all required variables are set |
69 |
|
[[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf" |
70 |
|
[[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf" |
71 |
|
else |
72 |
|
die "${IMAGEROOT}/images.conf not found" |
73 |
|
fi |
74 |
|
|
75 |
|
### helper scripts ### |
76 |
|
|
77 |
trap_exit() |
trap_exit() |
78 |
{ |
{ |
86 |
exit 1 |
exit 1 |
87 |
} |
} |
88 |
|
|
89 |
dialog_die() |
install_meter() |
|
{ |
|
|
ERROR="$1" |
|
|
RETVAL="$?" |
|
|
dialog_install_failure |
|
|
exit 1 |
|
|
} |
|
|
|
|
|
dialog_warning() |
|
90 |
{ |
{ |
91 |
local retval |
while [[ ${CURRENTLINE} != ${TOTALLINES} ]] |
92 |
|
do |
93 |
yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
CURRENTLINE=$(grep -c . /tmp/install.log) |
94 |
retval=$? |
PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) |
95 |
if [[ ${retval} -eq 1 ]] |
echo ${PERCENT} |
96 |
then |
sleep 1 |
97 |
clear |
done |
98 |
echo $"The process was aborted." |
rm -f /tmp/install.log |
99 |
exit 1 |
return 0 |
|
fi |
|
100 |
} |
} |
101 |
|
|
102 |
task_setup_system_menu() |
mount_rootfs() |
103 |
{ |
{ |
|
local mode |
|
104 |
local retval |
local retval |
105 |
|
|
106 |
mode="$(dialog_setup_system_menu)" |
if [[ -n ${SWAPHDD} ]] |
|
retval=$? |
|
|
[[ ${retval} -eq 1 ]] && return 1 |
|
|
if [[ ${retval} -eq 0 ]] |
|
107 |
then |
then |
108 |
case "${mode}" in |
swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'" |
|
"1") run_install_auto ;; |
|
|
"2") run_install_normal ;; |
|
|
"") task_setup_system_menu;; |
|
|
esac |
|
109 |
fi |
fi |
|
} |
|
|
|
|
|
dialog_hardware_detection() |
|
|
{ |
|
|
local message |
|
|
|
|
|
run_hardware_detection_disks |
|
|
|
|
|
message+=$"Harddrives:\n" |
|
110 |
|
|
111 |
if [[ ! -z ${ALL_DISKS} ]] |
if [[ -n ${ROOTHDD} ]] |
|
then |
|
|
for i in ${ALL_DISKS} |
|
|
do |
|
|
message+="\Z3${i}\Zn " |
|
|
done |
|
|
message+="\n" |
|
|
fi |
|
|
|
|
|
if [[ ! -z ${ALL_CDROMS} ]] |
|
|
then |
|
|
message+="\n" |
|
|
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 ]] |
|
112 |
then |
then |
113 |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
if is_mounted --location "${INSTALLROOT}" |
114 |
|
then |
115 |
|
echo $"${INSTALLROOT} already mounted" >&2 |
116 |
|
else |
117 |
|
mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" |
118 |
|
fi |
119 |
fi |
fi |
120 |
|
|
121 |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
[[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
|
} |
|
|
|
|
|
task_setup_hdd_partitions_manual() |
|
|
{ |
|
|
local i |
|
|
local retval |
|
122 |
|
|
123 |
if [[ -z ${ALL_DISKS} ]] |
if [[ -n ${BOOTHDD} ]] |
124 |
then |
then |
125 |
dialog_no_harddrive_found |
if is_mounted --location "${INSTALLROOT}"/boot |
|
exit 1 |
|
|
else |
|
|
HDD=$(dialog_select_target_harddrive) |
|
|
retval=$? |
|
|
[[ ${retval} -eq 1 ]] && return 1 |
|
|
if [[ ${retval} -eq 0 ]] |
|
126 |
then |
then |
127 |
dialog_setup_hdd_info |
echo $"${INSTALLROOT}/boot already mounted" >&2 |
128 |
setup_hdd_partitions_manual |
else |
129 |
|
mount "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" |
130 |
fi |
fi |
131 |
fi |
fi |
132 |
} |
} |
133 |
|
|
134 |
task_setup_hdd_partitions_auto() |
umount_rootfs() |
135 |
{ |
{ |
136 |
local i |
is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
137 |
local retval |
is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} |
138 |
|
|
139 |
if [[ -z ${ALL_DISKS} ]] |
if [[ -n ${SWAPHDD} ]] |
140 |
then |
then |
141 |
dialog_no_harddrive_found |
swapoff ${SWAPHDD} || die |
|
exit 1 |
|
|
else |
|
|
HDD=$(dialog_select_target_harddrive) |
|
|
retval=$? |
|
|
[[ ${retval} -eq 1 ]] && return 1 |
|
|
if [[ ${retval} -eq 0 ]] |
|
|
then |
|
|
dialog_setup_hdd_info_auto |
|
|
dialog_setup_hdd_create_partitions |
|
|
setup_hdd_partitions_auto |
|
|
fi |
|
142 |
fi |
fi |
143 |
} |
} |
144 |
|
|
145 |
install_meter() |
install_do_reboot() |
|
{ |
|
|
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 |
|
|
} |
|
|
|
|
|
task_main() |
|
146 |
{ |
{ |
147 |
local method=0 |
reboot |
|
local retval |
|
|
|
|
|
while [[ ${method} -le 2 ]] |
|
|
do |
|
|
method=$(dialog_main) |
|
|
retval=$? |
|
|
[[ ${retval} -eq 1 ]] && exit 1 |
|
|
if [[ ${retval} -eq 0 ]] |
|
|
then |
|
|
case ${method} in |
|
|
"1") task_setup_system_menu ;; |
|
|
"2") dialog_hardware_detection ;; |
|
|
"3") install_do_reboot ;; |
|
|
"4") /bin/bash --login -i ;; |
|
|
esac |
|
|
fi |
|
|
done |
|
148 |
} |
} |
149 |
|
|
|
################################################# |
|
|
# Install Komandos # |
|
|
################################################# |
|
150 |
run_hardware_detection() |
run_hardware_detection() |
151 |
{ |
{ |
152 |
local hwinfo |
local hwinfo |
153 |
|
|
154 |
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" |
155 |
|
|
156 |
## check for special devices/clients: |
# check for special devices/clients: |
157 |
## if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
# if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd |
158 |
#local removable=0 |
local removable=0 |
159 |
#if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] |
160 |
#then |
then |
161 |
#for i in /sys/block/[hs]d*/removable |
#for i in /sys/block/[hs]d*/removable |
162 |
#do |
#do |
163 |
#if [[ $(< ${i}) = 1 ]] |
# if [[ $(< ${i}) = 1 ]] |
164 |
#then |
# then |
165 |
#removable=1 |
# removable=1 |
166 |
#fi |
# fi |
167 |
#done |
#done |
168 |
## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
# smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' |
169 |
|
|
170 |
## 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 |
171 |
#export GRUBLEGACYOPTS="rootdelay=8" |
export GRUBLEGACYOPTS="rootdelay=8" |
172 |
## there are to zotac types in the wild, nvidia based gfx and intel |
# there are to zotac types in the wild, nvidia based gfx and intel |
173 |
#if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] |
if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] |
174 |
#then |
then |
175 |
#export SPECIALDEVICE="zotac_nvidia" |
export SPECIALDEVICE="zotac_nvidia" |
176 |
#else |
else |
177 |
#export SPECIALDEVICE="zotac_intel" |
export SPECIALDEVICE="zotac_intel" |
178 |
#fi |
fi |
179 |
#fi |
fi |
180 |
|
|
181 |
# check for special devices/clients: |
# check for special devices/clients: |
182 |
# if a rangee and disk ist smaller then 256mb move partion one block further ahead |
# if a rangee and disk ist smaller then 256mb move partion one block further ahead |
212 |
# all disks but exclude ramdisks |
# all disks but exclude ramdisks |
213 |
export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
export ALL_DISKS=$(get_hwinfo disk | sed '/\/dev\/ram[0-9].*/d') |
214 |
# remove the boot device from ALL_DISKS if it was an usbstick |
# remove the boot device from ALL_DISKS if it was an usbstick |
215 |
if [[ $(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] |
216 |
then |
then |
217 |
bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" |
bootdev=$(grep "[[:space:]]${LIVEROOT}[[:space:]]" /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g') |
218 |
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") |
219 |
fi |
fi |
220 |
export ALL_CDROMS="$(get_hwinfo cdrom)" |
export ALL_CDROMS="$(get_hwinfo cdrom)" |
221 |
} |
} |
222 |
|
|
223 |
setup_hdd_partitions_auto() |
setup_hdd_partitions() |
224 |
{ |
{ |
225 |
ROOTHDD="${HDD}1" |
case "${INSTALL_METHOD}" in |
226 |
|
auto) |
227 |
|
BOOTHDD="" |
228 |
|
SWAPHDD="" |
229 |
|
ROOTHDD="${HDD}1" |
230 |
|
;; |
231 |
|
normal) |
232 |
|
BOOTHDD="${HDD}1" |
233 |
|
SWAPHDD="${HDD}2" |
234 |
|
ROOTHDD="${HDD}3" |
235 |
|
;; |
236 |
|
esac |
237 |
|
|
238 |
# sanity check - should not happen |
# sanity check - should not happen |
239 |
if is_mounted --device "${ROOTHDD}" |
if is_mounted --device "${ROOTHDD}" |
241 |
echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 |
echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 |
242 |
umount "${ROOTHDD}" |
umount "${ROOTHDD}" |
243 |
fi |
fi |
244 |
|
if [[ -n ${BOOTHDD} ]] |
|
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
|
|
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
|
245 |
then |
then |
246 |
if hdd_size_below_256mb ${HDD} |
if is_mounted --device "${BOOTHDD}" |
247 |
then |
then |
248 |
FDISKPARTIONBELOW256MB=1 |
echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2 |
249 |
else |
umount "${BOOTHDD}" |
|
FDISKPARTIONBELOW256MB=0 |
|
250 |
fi |
fi |
251 |
fi |
fi |
252 |
|
|
253 |
## delete disk |
if [[ ${INSTALL_METHOD} = auto ]] |
|
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
|
|
|
|
|
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
|
254 |
then |
then |
255 |
## setup one bootable partition |
# run this only if FDISKPARTITIONBELOW256MB is not already 1 |
256 |
#1. n= new disk |
if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] |
257 |
#2. p= primary disk |
then |
258 |
#3. 1= first partition |
if device_minimum_size "${HDD}" 256 |
259 |
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
then |
260 |
#5. ''= defaul sector end |
FDISKPARTIONBELOW256MB=1 |
261 |
#6. a= bootable flag |
else |
262 |
#7. 1= boot flag for partition 1 |
FDISKPARTIONBELOW256MB=0 |
263 |
#8. w= write/quit |
fi |
264 |
fdisk ${HDD} &> /dev/null << EOF |
fi |
265 |
|
|
266 |
|
## delete disk |
267 |
|
dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die |
268 |
|
|
269 |
|
if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] |
270 |
|
then |
271 |
|
## setup one bootable partition |
272 |
|
#1. n= new disk |
273 |
|
#2. p= primary disk |
274 |
|
#3. 1= first partition |
275 |
|
#4. 2= default sector start // small disk needs more space for grub2 mbr sector |
276 |
|
#5. ''= defaul sector end |
277 |
|
#6. a= bootable flag |
278 |
|
#7. 1= boot flag for partition 1 |
279 |
|
#8. w= write/quit |
280 |
|
fdisk ${HDD} &> /dev/null << EOF |
281 |
n |
n |
282 |
p |
p |
283 |
1 |
1 |
287 |
1 |
1 |
288 |
w |
w |
289 |
EOF |
EOF |
290 |
else |
else |
291 |
## setup one bootable partition |
## setup one bootable partition |
292 |
#1. n= new disk |
#1. n= new disk |
293 |
#2. p= primary disk |
#2. p= primary disk |
294 |
#3. 1= first partition |
#3. 1= first partition |
295 |
#4. ''= default sector start |
#4. ''= default sector start |
296 |
#5. ''= defaul sector end |
#5. ''= defaul sector end |
297 |
#6. a= bootable flag |
#6. a= bootable flag |
298 |
#7. 1= boot flag for partition 1 |
#7. 1= boot flag for partition 1 |
299 |
#8. w= write/quit |
#8. w= write/quit |
300 |
fdisk ${HDD} &> /dev/null << EOF |
fdisk ${HDD} &> /dev/null << EOF |
301 |
n |
n |
302 |
p |
p |
303 |
1 |
1 |
307 |
1 |
1 |
308 |
w |
w |
309 |
EOF |
EOF |
310 |
|
fi |
311 |
|
else |
312 |
|
cfdisk ${HDD} || dialog_die |
313 |
fi |
fi |
314 |
} |
} |
315 |
|
|
|
setup_hdd_partitions_manual() |
|
|
{ |
|
|
ROOTHDD="${HDD}1" |
|
|
SWAPHDD="" |
|
|
BOOTHDD="" |
|
|
cfdisk ${HDD} || dialog_die |
|
|
} |
|
|
|
|
316 |
setup_hdd_format() |
setup_hdd_format() |
317 |
{ |
{ |
318 |
# sanity check - should not happen |
install -d /tmp |
319 |
if is_mounted --device "${ROOTHDD}" |
:> /tmp/format.log |
|
then |
|
|
echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 |
|
|
umount "${ROOTHDD}" |
|
|
fi |
|
|
|
|
|
mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die |
|
|
} |
|
|
|
|
|
install_mount_rootfs() |
|
|
{ |
|
|
is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" |
|
|
install -d ${INSTALLROOT}/boot || dialog_die |
|
|
} |
|
|
|
|
|
install_system_image() |
|
|
{ |
|
|
pushd ${INSTALLROOT} > /dev/null |
|
|
tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} |
|
|
popd > /dev/null |
|
|
} |
|
|
|
|
|
disabled_install_bootsector_chroot() |
|
|
{ |
|
|
local my_roothdd |
|
|
local grubconf="${INSTALLROOT}/boot/grub/grub.conf" |
|
|
local grub2conf="/boot/grub/grub.cfg" |
|
320 |
|
|
321 |
# check for grub2 |
if [[ -n ${SWAPHDD} ]] |
|
if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
|
322 |
then |
then |
323 |
# needed by grub-mkconfig on the first run |
# sanity check - should not happen |
324 |
if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] |
if is_mounted --device "${SWAPHDD}" |
|
then |
|
|
install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die |
|
|
fi |
|
|
|
|
|
# set kernelopts |
|
|
if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] |
|
325 |
then |
then |
326 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
echo "format: device ${SWAPHDD} is already mounted, umount it" >&2 |
327 |
else |
umount "${SWAPHDD}" |
|
CONFIG="${INSTALLROOT}/etc/conf.d/grub" |
|
|
clearconfig |
|
|
addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" |
|
|
fi |
|
|
CONFIG="${INSTALLROOT}/root/.installrc" |
|
|
clearconfig |
|
|
# only grub 1.99 |
|
|
addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap' |
|
|
addconfig "grub-install --no-floppy ${HDD} &> /dev/null" |
|
|
addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" |
|
|
addconfig "exit 0" |
|
|
|
|
|
# grub-legacy |
|
|
else |
|
|
source ${INSTALLROOT}/boot/kernelversion |
|
|
|
|
|
if [ -e ${INSTALLROOT}/etc/alx_version ] |
|
|
then |
|
|
OLD_ALXVER="${ALXVER}" |
|
|
source ${INSTALLROOT}/etc/alx_version |
|
|
KRNVER="ALX-${ALXVER}" |
|
|
ALXVER="${OLD_ALXVER}" |
|
328 |
fi |
fi |
329 |
|
mkswap ${SWAPHDD} || die |
330 |
|
fi |
331 |
|
|
332 |
[[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" |
if [[ -n ${BOOTHDD} ]] |
333 |
[[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" |
then |
334 |
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
# sanity check - should not happen |
335 |
|
if is_mounted --device "${BOOTHDD}" |
|
# uuid support |
|
|
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
|
|
|
|
|
CONFIG="${grubconf}" |
|
|
clearconfig |
|
|
addconfig "default 0" |
|
|
addconfig "timeout 3" |
|
|
# using current root password |
|
|
addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" |
|
|
|
|
|
addconfig |
|
|
addconfig "# normal boot" |
|
|
addconfig "title ${KRNVER}" |
|
|
addconfig "root (hd0,0)" |
|
|
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" |
|
|
if is_initrd_supported |
|
336 |
then |
then |
337 |
addconfig "initrd /boot/${KRNINITRD}" |
echo "format: device ${BOOTHDD} is already mounted, umount it" >&2 |
338 |
|
umount "${BOOTHDD}" |
339 |
fi |
fi |
340 |
|
|
341 |
addconfig |
mkfs."${FORMAT_FILESYSTEM}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die |
342 |
addconfig "# admin boot" |
fi |
|
addconfig "title ${KRNVER} - Re-run hardware-detection" |
|
|
addconfig "lock" |
|
|
addconfig "root (hd0,0)" |
|
|
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" |
|
|
if is_initrd_supported |
|
|
then |
|
|
addconfig "initrd /boot/${KRNINITRD}" |
|
|
fi |
|
343 |
|
|
344 |
addconfig |
if [[ -n ${ROOTHDD} ]] |
345 |
addconfig "title ${KRNVER} - Reset *all* local settings" |
then |
346 |
addconfig "lock" |
# sanity check - should not happen |
347 |
addconfig "root (hd0,0)" |
if is_mounted --device "${ROOTHDD}" |
|
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" |
|
|
if is_initrd_supported |
|
348 |
then |
then |
349 |
addconfig "initrd /boot/${KRNINITRD}" |
echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 |
350 |
|
umount "${ROOTHDD}" |
351 |
fi |
fi |
352 |
|
|
353 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
mkfs."${FORMAT_FILESYSTEM}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die |
|
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 |
|
354 |
fi |
fi |
355 |
|
} |
356 |
|
|
357 |
# run installrc |
install_system_image() |
358 |
chrooted /bin/bash --rcfile /root/.installrc -i |
{ |
359 |
rm ${INSTALLROOT}/root/.installrc |
pushd ${INSTALLROOT} > /dev/null |
360 |
} |
tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT} |
361 |
|
popd > /dev/null |
|
disabled_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 |
|
|
|
|
|
if [[ ${FORMFACTOR} = laptop ]] |
|
|
then |
|
|
OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" |
|
|
fi |
|
|
|
|
|
# install an appropriate uvesafb.conf |
|
|
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
|
|
CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf" |
|
|
clearconfig |
|
|
addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" |
|
|
|
|
|
# install an appropriate viafb.conf |
|
|
CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf" |
|
|
clearconfig |
|
|
addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60" |
|
|
|
|
|
# install an appropriate i810fb.conf |
|
|
CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf" |
|
|
clearconfig |
|
|
addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" |
|
|
|
|
|
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 |
|
|
|
|
|
# run installrc |
|
|
chrooted /bin/bash --rcfile /root/.installrc -i |
|
|
rm ${INSTALLROOT}/root/.installrc |
|
362 |
} |
} |
363 |
|
|
364 |
install_system_settings() |
install_system_settings() |
368 |
# write fstab |
# write fstab |
369 |
CONFIG="${INSTALLROOT}/etc/fstab" |
CONFIG="${INSTALLROOT}/etc/fstab" |
370 |
clearconfig |
clearconfig |
371 |
addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" |
if [[ -n ${BOOTHDD} ]] |
372 |
|
then |
373 |
|
addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t1 1" |
374 |
|
fi |
375 |
|
if [[ -n ${ROOTHDD} ]] |
376 |
|
then |
377 |
|
addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" |
378 |
|
fi |
379 |
|
if [[ -n ${SWAPHDD} ]] |
380 |
|
then |
381 |
|
addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" |
382 |
|
fi |
383 |
addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
384 |
addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" |
addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" |
385 |
|
|
390 |
addconfig 'NETWORKING="dhcp"' |
addconfig 'NETWORKING="dhcp"' |
391 |
|
|
392 |
# intel framebuffer quirk |
# intel framebuffer quirk |
393 |
if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] |
CONFIG="${INSTALLROOT}/etc/splash/splash.conf" |
394 |
|
if [ -e ${CONFIG} ] && [ -e /proc/fb ] |
395 |
then |
then |
396 |
if [ -e /proc/fb ] |
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
397 |
then |
then |
398 |
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
399 |
then |
[[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die |
|
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
|
|
if [[ ${fbdev} != 0 ]] |
|
|
then |
|
|
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
|
|
fi |
|
|
fi |
|
400 |
fi |
fi |
401 |
fi |
fi |
402 |
} |
} |
403 |
|
|
404 |
install_umount_rootfs() |
|
405 |
|
### installer dialogs ### |
406 |
|
|
407 |
|
dialog_die() |
408 |
{ |
{ |
409 |
is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
ERROR="$1" |
410 |
is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} |
RETVAL="$?" |
411 |
|
dialog_install_failure |
412 |
|
exit 1 |
413 |
} |
} |
414 |
|
|
415 |
install_do_reboot() |
dialog_warning() |
416 |
{ |
{ |
417 |
reboot |
local retval |
418 |
|
|
419 |
|
yesnobox $"\Z1 !!! Warning !!! \Zn\n\n\This harddrive will be irreversibly erased.\n\n\Do you want to continue ?" |
420 |
|
retval=$? |
421 |
|
if [[ ${retval} -eq 1 ]] |
422 |
|
then |
423 |
|
clear |
424 |
|
echo $"The process was aborted." |
425 |
|
exit 1 |
426 |
|
fi |
427 |
} |
} |
428 |
|
|
|
################################################# |
|
|
# Install Ablauf Scripte # |
|
|
################################################# |
|
429 |
|
|
430 |
run_install_normal() |
### installer tasks ### |
431 |
|
|
432 |
|
task_setup_system_menu() |
433 |
{ |
{ |
434 |
dialog_hardware_detection |
local mode |
435 |
|
local retval |
436 |
|
|
437 |
task_setup_hdd_partitions_manual |
mode="$(dialog_setup_system_menu)" |
438 |
dialog_setup_hdd_format |
retval=$? |
439 |
setup_hdd_format > /dev/null |
[[ ${retval} -eq 1 ]] && return 1 |
440 |
install_mount_rootfs |
if [[ ${retval} -eq 0 ]] |
441 |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
then |
442 |
|
case "${mode}" in |
443 |
|
"1") run_install auto ;; |
444 |
|
"2") run_install normal ;; |
445 |
|
"") task_setup_system_menu;; |
446 |
|
esac |
447 |
|
fi |
448 |
|
} |
449 |
|
|
450 |
dialog_install_settings |
task_hardware_detection() |
451 |
sleep 1 |
{ |
452 |
install_system_settings |
local message |
453 |
if is_initrd_supported |
|
454 |
|
run_hardware_detection_disks |
455 |
|
|
456 |
|
message+=$"Harddrives:\n" |
457 |
|
|
458 |
|
if [[ ! -z ${ALL_DISKS} ]] |
459 |
then |
then |
460 |
dialog_install_initrd |
for i in ${ALL_DISKS} |
461 |
initrd_config |
do |
462 |
initrd_install |
message+="\Z3${i}\Zn " |
463 |
|
done |
464 |
|
message+="\n" |
465 |
fi |
fi |
466 |
|
|
467 |
dialog_install_bootsector |
if [[ ! -z ${ALL_CDROMS} ]] |
468 |
bootloader_config |
then |
469 |
bootloader_install |
message+="\n" |
470 |
|
message+=$"Optical disk drives:\n" |
471 |
|
for i in ${ALL_CDROMS} |
472 |
|
do |
473 |
|
message+="\Z3${i}\Zn" |
474 |
|
done |
475 |
|
message+="\n" |
476 |
|
fi |
477 |
|
|
478 |
install_umount_rootfs |
# other devices |
479 |
dialog_install_successful |
run_hardware_detection |
480 |
|
case "${SPECIALDEVICE}" in |
481 |
|
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
482 |
|
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
483 |
|
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
484 |
|
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
485 |
|
esac |
486 |
|
if [[ ${FORMFACTOR} = laptop ]] |
487 |
|
then |
488 |
|
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
489 |
|
fi |
490 |
|
|
491 |
|
messagebox -y 12 -h $"Detected hardware:" "${message}" |
492 |
|
} |
493 |
|
|
494 |
|
task_setup_hdd_partitions() |
495 |
|
{ |
496 |
|
local i |
497 |
|
local retval |
498 |
|
|
499 |
|
if [[ -z ${ALL_DISKS} ]] |
500 |
|
then |
501 |
|
dialog_no_harddrive_found |
502 |
|
exit 1 |
503 |
|
else |
504 |
|
HDD=$(dialog_select_target_harddrive) |
505 |
|
retval=$? |
506 |
|
[[ ${retval} -eq 1 ]] && return 1 |
507 |
|
if [[ ${retval} -eq 0 ]] |
508 |
|
then |
509 |
|
dialog_setup_hdd_info |
510 |
|
setup_hdd_partitions |
511 |
|
fi |
512 |
|
fi |
513 |
} |
} |
514 |
|
|
515 |
run_install_auto() |
task_main() |
516 |
{ |
{ |
517 |
dialog_hardware_detection |
local method=0 |
518 |
|
local retval |
519 |
|
|
520 |
|
while [[ ${method} -le 2 ]] |
521 |
|
do |
522 |
|
method=$(dialog_main) |
523 |
|
retval=$? |
524 |
|
[[ ${retval} -eq 1 ]] && exit 1 |
525 |
|
if [[ ${retval} -eq 0 ]] |
526 |
|
then |
527 |
|
case ${method} in |
528 |
|
"1") task_setup_system_menu ;; |
529 |
|
"2") task_hardware_detection ;; |
530 |
|
"3") install_do_reboot ;; |
531 |
|
"4") /bin/bash --login -i ;; |
532 |
|
esac |
533 |
|
fi |
534 |
|
done |
535 |
|
} |
536 |
|
|
537 |
|
run_install() |
538 |
|
{ |
539 |
|
local method="$1" |
540 |
|
|
541 |
|
task_hardware_detection |
542 |
|
|
543 |
|
case "${method}" in |
544 |
|
auto) |
545 |
|
export INSTALL_METHOD="${method}" |
546 |
|
;; |
547 |
|
normal) |
548 |
|
export INSTALL_METHOD="${method}" |
549 |
|
;; |
550 |
|
*) |
551 |
|
die "Unknown install method '${method}', aborting." |
552 |
|
;; |
553 |
|
esac |
554 |
|
|
555 |
task_setup_hdd_partitions_auto |
task_setup_hdd_partitions |
556 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
557 |
setup_hdd_format > /dev/null |
setup_hdd_format > /dev/null |
558 |
install_mount_rootfs |
mount_rootfs |
559 |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
560 |
|
|
561 |
dialog_install_settings |
dialog_install_settings |
572 |
bootloader_config |
bootloader_config |
573 |
bootloader_install |
bootloader_install |
574 |
|
|
575 |
install_umount_rootfs |
umount_rootfs |
576 |
dialog_install_successful |
dialog_install_successful |
577 |
} |
} |
578 |
|
|