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 |
|
LC_MESSAGES=C |
13 |
|
|
14 |
# include dir |
# include dir |
15 |
INSTALLER_LIBDIR="%LIBDIR%" |
INSTALLER_LIBDIR="%LIBDIR%" |
16 |
|
|
110 |
fi |
fi |
111 |
} |
} |
112 |
|
|
113 |
dialog_setup_hdd_info() |
task_setup_system_menu() |
|
{ |
|
|
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() |
|
|
{ |
|
|
local SHDD="${HDD//\/dev\/}" |
|
|
|
|
|
messagebox -h $"[ Harddrive partitioning ]" \ |
|
|
$"\Z1Warning!\Zn\n\nAll data on disk [ \Z3${HDD}\Zn ] will be erased!" |
|
|
} |
|
|
|
|
|
dialog_setup_system_menu() |
|
114 |
{ |
{ |
115 |
local mode |
local mode |
116 |
local retval |
local retval |
117 |
|
|
118 |
mode=$(menubox -h $"[ Harddrive partitioning ]" $"\nSelect an installation mode" \ |
mode="$(dialog_setup_system_menu)" |
|
$"1:Automatic setup (recommended)" \ |
|
|
":" \ |
|
|
$":\Z1Expert modes:\Zn" \ |
|
|
$"2:Common IDE-disk (manual setup)") |
|
119 |
retval=$? |
retval=$? |
120 |
[[ ${retval} -eq 1 ]] && return 1 |
[[ ${retval} -eq 1 ]] && return 1 |
121 |
if [[ ${retval} -eq 0 ]] |
if [[ ${retval} -eq 0 ]] |
123 |
case "${mode}" in |
case "${mode}" in |
124 |
"1") run_install_auto ;; |
"1") run_install_auto ;; |
125 |
"2") run_install_normal ;; |
"2") run_install_normal ;; |
126 |
"") dialog_setup_system_menu;; |
"") task_setup_system_menu;; |
127 |
esac |
esac |
128 |
fi |
fi |
129 |
} |
} |
162 |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
zotac*) message+=$"\n\Z2Zotac device detected.\Zn" ;; |
163 |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
rangee) message+=$"\n\Z2Rangee device detected.\Zn" ;; |
164 |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
maxdata) message+=$"\n\Z2Maxdata device detected.\Zn" ;; |
165 |
*) message+=$"\n \\ZnCommon device detected.\Zn" ;; |
*) message+=$"\n\ZnCommon device detected.\Zn" ;; |
166 |
esac |
esac |
167 |
if [[ ${FORMFACTOR} = laptop ]] |
if [[ ${FORMFACTOR} = laptop ]] |
168 |
then |
then |
169 |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" |
170 |
fi |
fi |
171 |
|
|
172 |
messagebox -y 15 -h $"Detected hardware:" "${message}" |
messagebox -y 12 -h $"Detected hardware:" "${message}" |
173 |
} |
} |
174 |
|
|
175 |
dialog_setup_hdd_partitions_manual() |
dialog_setup_hdd_partitions_manual() |
235 |
|
|
236 |
while [[ ${method} -le 2 ]] |
while [[ ${method} -le 2 ]] |
237 |
do |
do |
238 |
method=$(menubox $"Configuration:" \ |
method=$(CANCEL_LABEL=$"Exit" menubox $"Configuration:" \ |
239 |
$"1:Install system" \ |
$"1:Install system" \ |
240 |
$"2:Show detected harddrives" \ |
$"2:Show detected harddrives" \ |
241 |
$"3:Exit and reboot" \ |
$"3:Exit and reboot" \ |
245 |
if [[ ${retval} -eq 0 ]] |
if [[ ${retval} -eq 0 ]] |
246 |
then |
then |
247 |
case ${method} in |
case ${method} in |
248 |
"1") dialog_setup_system_menu ;; |
"1") task_setup_system_menu ;; |
249 |
"2") dialog_hardware_detection ;; |
"2") dialog_hardware_detection ;; |
250 |
"3") install_do_reboot ;; |
"3") install_do_reboot ;; |
251 |
"4") /bin/bash --login -i ;; |
"4") /bin/bash --login -i ;; |
450 |
popd > /dev/null |
popd > /dev/null |
451 |
} |
} |
452 |
|
|
453 |
install_bootsector_chroot() |
disabled_install_bootsector_chroot() |
454 |
{ |
{ |
455 |
local my_roothdd |
local my_roothdd |
456 |
local grubconf=${INSTALLROOT}/boot/grub/grub.conf |
local grubconf="${INSTALLROOT}/boot/grub/grub.conf" |
457 |
local grub2conf=/boot/grub/grub.cfg |
local grub2conf="/boot/grub/grub.cfg" |
458 |
|
|
459 |
# check for grub2 |
# check for grub2 |
460 |
if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] |
470 |
then |
then |
471 |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
472 |
else |
else |
473 |
echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLROOT}/etc/conf.d/grub || dialog_die |
CONFIG="${INSTALLROOT}/etc/conf.d/grub" |
474 |
fi |
clearconfig |
475 |
echo 'grub-mkdevicemap' > ${INSTALLROOT}/root/.installrc || dialog_die |
addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" |
476 |
echo "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
fi |
477 |
echo "grub-install --no-floppy ${HDD} &> /dev/null" >> ${INSTALLROOT}/root/.installrc || dialog_die |
CONFIG="${INSTALLROOT}/root/.installrc" |
478 |
echo "exit 0" >> ${INSTALLROOT}/root/.installrc || dialog_die |
clearconfig |
479 |
|
# only grub 1.99 |
480 |
|
addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap' |
481 |
|
addconfig "grub-install --no-floppy ${HDD} &> /dev/null" |
482 |
|
addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" |
483 |
|
addconfig "exit 0" |
484 |
|
|
485 |
# grub-legacy |
# grub-legacy |
486 |
else |
else |
|
### grubconf schreiben |
|
487 |
source ${INSTALLROOT}/boot/kernelversion |
source ${INSTALLROOT}/boot/kernelversion |
488 |
|
|
|
#for alx only |
|
489 |
if [ -e ${INSTALLROOT}/etc/alx_version ] |
if [ -e ${INSTALLROOT}/etc/alx_version ] |
490 |
then |
then |
491 |
OLD_ALXVER="${ALXVER}" |
OLD_ALXVER="${ALXVER}" |
499 |
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
[[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" |
500 |
|
|
501 |
# uuid support |
# uuid support |
502 |
if is_uuid_supported |
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
|
then |
|
|
my_roothdd="UUID=$(get_uuid ${ROOTHDD})" |
|
|
else |
|
|
my_roothdd="${ROOTHDD}" |
|
|
fi |
|
503 |
|
|
504 |
: > ${grubconf} || dialog_die |
CONFIG="${grubconf}" |
505 |
echo "default 0" >> ${grubconf} || dialog_die |
clearconfig |
506 |
echo "timeout 3" >> ${grubconf} || dialog_die |
addconfig "default 0" |
507 |
|
addconfig "timeout 3" |
508 |
# using current root password |
# using current root password |
509 |
echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || dialog_die |
addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" |
510 |
|
|
511 |
echo >> ${grubconf} || dialog_die |
addconfig |
512 |
echo "# normal boot" >> ${grubconf} || dialog_die |
addconfig "# normal boot" |
513 |
echo "title ${KRNVER}" >> ${grubconf} || dialog_die |
addconfig "title ${KRNVER}" |
514 |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
addconfig "root (hd0,0)" |
515 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" >> ${grubconf} || dialog_die |
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" |
516 |
if is_initrd_supported |
if is_initrd_supported |
517 |
then |
then |
518 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
addconfig "initrd /boot/${KRNINITRD}" |
519 |
fi |
fi |
520 |
|
|
521 |
echo >> ${grubconf} || dialog_die |
addconfig |
522 |
echo "# admin boot" >> ${grubconf} || dialog_die |
addconfig "# admin boot" |
523 |
echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || dialog_die |
addconfig "title ${KRNVER} - Re-run hardware-detection" |
524 |
echo "lock" >> ${grubconf} || dialog_die |
addconfig "lock" |
525 |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
addconfig "root (hd0,0)" |
526 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || dialog_die |
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" |
527 |
if is_initrd_supported |
if is_initrd_supported |
528 |
then |
then |
529 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
addconfig "initrd /boot/${KRNINITRD}" |
530 |
fi |
fi |
531 |
|
|
532 |
echo >> ${grubconf} || dialog_die |
addconfig |
533 |
echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || dialog_die |
addconfig "title ${KRNVER} - Reset *all* local settings" |
534 |
echo "lock" >> ${grubconf} || dialog_die |
addconfig "lock" |
535 |
echo "root (hd0,0)" >> ${grubconf} || dialog_die |
addconfig "root (hd0,0)" |
536 |
echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || dialog_die |
addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" |
537 |
if is_initrd_supported |
if is_initrd_supported |
538 |
then |
then |
539 |
echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die |
addconfig "initrd /boot/${KRNINITRD}" |
540 |
fi |
fi |
541 |
|
|
542 |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
# bootsector schreiben chrooted schreiben (lfs/magellan) |
555 |
rm ${INSTALLROOT}/root/.installrc |
rm ${INSTALLROOT}/root/.installrc |
556 |
} |
} |
557 |
|
|
558 |
is_initrd_supported() |
disabled_install_initrd_chroot() |
|
{ |
|
|
# only generate initrds if the cmd exists |
|
|
[[ -x ${INSTALLROOT}/sbin/mkinitrd ]] && return 0 |
|
|
return 1 |
|
|
} |
|
|
|
|
|
install_initrd_chroot() |
|
559 |
{ |
{ |
560 |
# only generate initrds if the cmd exists |
# only generate initrds if the cmd exists |
561 |
is_initrd_supported || return 0 |
is_initrd_supported || return 0 |
583 |
|
|
584 |
# install an appropriate uvesafb.conf |
# install an appropriate uvesafb.conf |
585 |
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die |
586 |
echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die |
CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf" |
587 |
|
clearconfig |
588 |
|
addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" |
589 |
|
|
590 |
# install an appropriate viafb.conf |
# install an appropriate viafb.conf |
591 |
echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die |
CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf" |
592 |
|
clearconfig |
593 |
|
addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60" |
594 |
|
|
595 |
# install an appropriate i810fb.conf |
# install an appropriate i810fb.conf |
596 |
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 |
CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf" |
597 |
|
clearconfig |
598 |
|
addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" |
599 |
|
|
600 |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
cat > ${INSTALLROOT}/root/.installrc << CHROOTEOF |
601 |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
echo "MODULES=\"${FORMAT_FILESYSTEM} ${DISKMODS} ${OLDATAMODS} ${PATAMODS} ${SATAMODS} ${DRMMODS} ${FBMODS} ${OTHERMODS}\"" > /etc/conf.d/mkinitrd |
608 |
rm ${INSTALLROOT}/root/.installrc |
rm ${INSTALLROOT}/root/.installrc |
609 |
} |
} |
610 |
|
|
|
is_uuid_supported() |
|
|
{ |
|
|
if [[ -x $(type -P busybox.mkinitrd) ]] |
|
|
then |
|
|
# only detect uuids if supported |
|
|
if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] |
|
|
then |
|
|
return 0 |
|
|
fi |
|
|
fi |
|
|
|
|
|
return 1 |
|
|
} |
|
|
|
|
|
get_uuid() |
|
|
{ |
|
|
local UUID |
|
|
local SEC_TYPE |
|
|
local TYPE |
|
|
|
|
|
local dev="$1" |
|
|
[[ -z ${dev} ]] && dialog_die "no dev given" |
|
|
|
|
|
# check if given device is already an UUID |
|
|
if [[ ${dev/UUID=/}x != ${dev}x ]] |
|
|
then |
|
|
eval "${dev}" |
|
|
else |
|
|
eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //') |
|
|
fi |
|
|
echo "${UUID}" |
|
|
} |
|
|
|
|
611 |
install_system_settings() |
install_system_settings() |
612 |
{ |
{ |
613 |
# schreibe fstab |
local CONFIG |
614 |
if is_uuid_supported |
|
615 |
then |
# write fstab |
616 |
echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
CONFIG="${INSTALLROOT}/etc/fstab" |
617 |
else |
clearconfig |
618 |
echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die |
addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" |
619 |
fi |
addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" |
620 |
# not needed busybox loads all with swapon -a, even if not mentioned in fstab |
addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" |
|
#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 |
|
621 |
|
|
622 |
# install network config skeleton |
# install network config skeleton |
623 |
install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die |
CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" |
624 |
|
clearconfig |
625 |
|
addconfig 'ONBOOT="yes"' |
626 |
|
addconfig 'NETWORKING="dhcp"' |
627 |
|
|
628 |
# intel framebufer quirk |
# intel framebuffer quirk |
629 |
if [[ -e /proc/fb ]] |
if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] |
630 |
then |
then |
631 |
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
if [ -e /proc/fb ] |
632 |
then |
then |
633 |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] |
|
if [[ ${fbdev} != 0 ]] |
|
634 |
then |
then |
635 |
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') |
636 |
|
if [[ ${fbdev} != 0 ]] |
637 |
|
then |
638 |
|
sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${INSTALLROOT}/etc/splash/splash.conf || dialog_die |
639 |
|
fi |
640 |
fi |
fi |
641 |
fi |
fi |
642 |
fi |
fi |
670 |
dialog_install_settings |
dialog_install_settings |
671 |
sleep 1 |
sleep 1 |
672 |
install_system_settings |
install_system_settings |
673 |
dialog_install_initrd |
if is_initrd_supported |
674 |
install_initrd_chroot |
then |
675 |
|
dialog_install_initrd |
676 |
|
initrd_config |
677 |
|
initrd_install |
678 |
|
fi |
679 |
|
|
680 |
dialog_install_bootsector |
dialog_install_bootsector |
681 |
install_bootsector_chroot |
bootloader_config |
682 |
|
bootloader_install |
683 |
|
|
684 |
install_umount_rootfs |
install_umount_rootfs |
685 |
dialog_install_successful |
dialog_install_successful |
698 |
dialog_install_settings |
dialog_install_settings |
699 |
sleep 1 |
sleep 1 |
700 |
install_system_settings |
install_system_settings |
701 |
dialog_install_initrd |
if is_initrd_supported |
702 |
install_initrd_chroot |
then |
703 |
|
dialog_install_initrd |
704 |
|
initrd_config |
705 |
|
initrd_install |
706 |
|
fi |
707 |
|
|
708 |
dialog_install_bootsector |
dialog_install_bootsector |
709 |
install_bootsector_chroot |
bootloader_config |
710 |
|
bootloader_install |
711 |
|
|
712 |
install_umount_rootfs |
install_umount_rootfs |
713 |
dialog_install_successful |
dialog_install_successful |