103 |
{ |
{ |
104 |
local retval |
local retval |
105 |
|
|
106 |
if is_mounted --location "${INSTALLROOT}" |
if [[ -n ${SWAPHDD} ]] |
107 |
then |
then |
108 |
echo $"${INSTALLROOT} already mounted" >&2 |
swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'" |
|
else |
|
|
mount "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" |
|
109 |
fi |
fi |
110 |
|
|
111 |
|
if [[ -n ${ROOTHDD} ]] |
112 |
|
then |
113 |
|
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 |
120 |
|
|
121 |
[[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
[[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot |
122 |
|
|
123 |
|
if [[ -n ${BOOTHDD} ]] |
124 |
|
then |
125 |
|
if is_mounted --location "${INSTALLROOT}"/boot |
126 |
|
then |
127 |
|
echo $"${INSTALLROOT}/boot already mounted" >&2 |
128 |
|
else |
129 |
|
mount "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" |
130 |
|
fi |
131 |
|
fi |
132 |
} |
} |
133 |
|
|
134 |
umount_rootfs() |
umount_rootfs() |
135 |
{ |
{ |
136 |
is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot |
137 |
is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} |
is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} |
138 |
|
|
139 |
|
if [[ -n ${SWAPHDD} ]] |
140 |
|
then |
141 |
|
swapoff ${SWAPHDD} || die |
142 |
|
fi |
143 |
} |
} |
144 |
|
|
145 |
install_do_reboot() |
install_do_reboot() |
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 device_minimum_size "${HDD}" 256 |
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 |
320 |
|
|
321 |
|
if [[ -n ${SWAPHDD} ]] |
322 |
then |
then |
323 |
echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 |
# sanity check - should not happen |
324 |
umount "${ROOTHDD}" |
if is_mounted --device "${SWAPHDD}" |
325 |
|
then |
326 |
|
echo "format: device ${SWAPHDD} is already mounted, umount it" >&2 |
327 |
|
umount "${SWAPHDD}" |
328 |
|
fi |
329 |
|
mkswap ${SWAPHDD} || die |
330 |
|
fi |
331 |
|
|
332 |
|
if [[ -n ${BOOTHDD} ]] |
333 |
|
then |
334 |
|
# sanity check - should not happen |
335 |
|
if is_mounted --device "${BOOTHDD}" |
336 |
|
then |
337 |
|
echo "format: device ${BOOTHDD} is already mounted, umount it" >&2 |
338 |
|
umount "${BOOTHDD}" |
339 |
|
fi |
340 |
|
|
341 |
|
mkfs."${FORMAT_FILESYSTEM}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die |
342 |
fi |
fi |
343 |
|
|
344 |
mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die |
if [[ -n ${ROOTHDD} ]] |
345 |
|
then |
346 |
|
# sanity check - should not happen |
347 |
|
if is_mounted --device "${ROOTHDD}" |
348 |
|
then |
349 |
|
echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 |
350 |
|
umount "${ROOTHDD}" |
351 |
|
fi |
352 |
|
|
353 |
|
mkfs."${FORMAT_FILESYSTEM}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die |
354 |
|
fi |
355 |
} |
} |
356 |
|
|
357 |
install_system_image() |
install_system_image() |
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 |
|
|
440 |
if [[ ${retval} -eq 0 ]] |
if [[ ${retval} -eq 0 ]] |
441 |
then |
then |
442 |
case "${mode}" in |
case "${mode}" in |
443 |
"1") run_install_auto ;; |
"1") run_install auto ;; |
444 |
"2") run_install_normal ;; |
"2") run_install normal ;; |
445 |
"") task_setup_system_menu;; |
"") task_setup_system_menu;; |
446 |
esac |
esac |
447 |
fi |
fi |
491 |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
492 |
} |
} |
493 |
|
|
494 |
task_setup_hdd_partitions_manual() |
task_setup_hdd_partitions() |
495 |
{ |
{ |
496 |
local i |
local i |
497 |
local retval |
local retval |
507 |
if [[ ${retval} -eq 0 ]] |
if [[ ${retval} -eq 0 ]] |
508 |
then |
then |
509 |
dialog_setup_hdd_info |
dialog_setup_hdd_info |
510 |
setup_hdd_partitions_manual |
setup_hdd_partitions |
|
fi |
|
|
fi |
|
|
} |
|
|
|
|
|
task_setup_hdd_partitions_auto() |
|
|
{ |
|
|
local i |
|
|
local retval |
|
|
|
|
|
if [[ -z ${ALL_DISKS} ]] |
|
|
then |
|
|
dialog_no_harddrive_found |
|
|
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 |
|
511 |
fi |
fi |
512 |
fi |
fi |
513 |
} |
} |
534 |
done |
done |
535 |
} |
} |
536 |
|
|
537 |
run_install_normal() |
run_install() |
538 |
{ |
{ |
539 |
task_hardware_detection |
local method="$1" |
|
|
|
|
task_setup_hdd_partitions_manual |
|
|
dialog_setup_hdd_format |
|
|
setup_hdd_format > /dev/null |
|
|
mount_rootfs |
|
|
(install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image |
|
|
|
|
|
dialog_install_settings |
|
|
sleep 1 |
|
|
install_system_settings |
|
|
if is_initrd_supported |
|
|
then |
|
|
dialog_install_initrd |
|
|
initrd_config |
|
|
initrd_install |
|
|
fi |
|
|
|
|
|
dialog_install_bootsector |
|
|
bootloader_config |
|
|
bootloader_install |
|
540 |
|
|
|
umount_rootfs |
|
|
dialog_install_successful |
|
|
} |
|
|
|
|
|
run_install_auto() |
|
|
{ |
|
541 |
task_hardware_detection |
task_hardware_detection |
542 |
|
|
543 |
task_setup_hdd_partitions_auto |
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 |
556 |
dialog_setup_hdd_format |
dialog_setup_hdd_format |
557 |
setup_hdd_format > /dev/null |
setup_hdd_format > /dev/null |
558 |
mount_rootfs |
mount_rootfs |