--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 13:29:00 2410 +++ trunk/installer-simple/bin/installer.sh.in 2014/01/08 10:43:20 2486 @@ -7,8 +7,10 @@ # Niels Rogalla # -# ignore the environment -LC_ALL=C +# setup locales +TEXTDOMAIN=installer +LC_MESSAGES=C + # include dir INSTALLER_LIBDIR="%LIBDIR%" @@ -27,6 +29,8 @@ ${INSTALLER_LIBDIR}/functions/common.sh \ ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ ${INSTALLER_LIBDIR}/functions/hwdetection.sh \ + ${INSTALLER_LIBDIR}/functions/bootloader.sh \ + ${INSTALLER_LIBDIR}/functions/initrd-tools.sh \ ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh do if [ -e ${inc} ] @@ -68,9 +72,8 @@ FORMFACTOR="${DEFAULT_FORMFACTOR}" FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" -################################################# -# DIALOG BOXEN # -################################################# + +### helper scripts ### trap_exit() { @@ -84,268 +87,7 @@ exit 1 } -dialog_die() -{ - 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\/}" - - dialog \ - --colors \ - --title "[ Festplatten Partitionierung ]" \ - --backtitle "${TITLE}" \ - --ok-label "Weiter" \ - --msgbox "\nBitte legen Sie 1 Partition an.\n\n\ - [ \Z3${SHDD}1\Zn ] Typ: \Z3Linux\Zn mit dem gesamten Speicher\n\ - Bitte ${SHDD}1 als \Z3bootable\Zn markieren." 12 81 -} - -dialog_setup_hdd_info_auto() -{ - local SHDD="${HDD//\/dev\/}" - - dialog \ - --colors \ - --title "[ Festplatten Partitionierung ]" \ - --backtitle "${TITLE}" \ - --ok-label "Weiter" \ - --msgbox "\nAchtung!\n\ - Alle Daten werden von der Disk [ \Z3${HDD}\Zn ] gelöscht!" 12 81 -} - -dialog_setup_system_menu() -{ - local i - - i=$(dialog \ - --backtitle "${TITLE}" \ - --title "[ Festplatten Partitionierung ]" \ - --cancel-label "Abbrechen" \ - --ok-label "Weiter" \ - --stdout \ - --colors \ - --menu "\nWaehlen Sie die Installations-Methode" 14 70 5 \ - "1" "Automatisches Setup (Empfohlen)" \ - "" "" \ - "" "\Z1Experten Modi:\Zn" \ - "2" "Normale IDE-Disk (Manuell)" \ - RES=$? - [[ ${RES} -eq 1 ]] && return 1 - if [[ ${RES} -eq 0 ]] - then - case "${i}" in - "1") run_install_auto ;; - "2") run_install_normal ;; - "") dialog_setup_system_menu;; - esac - fi -} - -dialog_hardware_detection() -{ - local i - local hwtmp - - if [ -x $(type -P mktemp) ] - then - hwtmp="$(mktemp)" - else - hwtmp="/tmp/hwtmp.sh" - fi - - run_hardware_detection_disks - - echo "dialog \\" > ${hwtmp} - echo "--backtitle \"${TITLE}\" \\" >> ${hwtmp} - echo "--ok-label \"Weiter\" \\" >> ${hwtmp} - echo "--stdout \\" >> ${hwtmp} - echo "--colors \\" >> ${hwtmp} - echo "--msgbox \"Gefundene Hardware:\n\n \\" >> ${hwtmp} - echo " Festplatten:\n \\" >> ${hwtmp} - - if [[ ! -z ${ALL_DISKS} ]] - then - for i in ${ALL_DISKS} - do - echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} - done - fi - - if [[ ! -z ${ALL_CDROMS} ]] - then - echo " \n \\" >> ${hwtmp} - echo " CDROM Laufwerke:\n \\" >> ${hwtmp} - for i in ${ALL_CDROMS} - do - echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} - done - fi - - # other devices - run_hardware_detection - case "${SPECIALDEVICE}" in - zotac*) echo " \n\n\n \\Z2Zotac Device erkannt.\\Zn \\" >> ${hwtmp} ;; - rangee) echo " \n\n\n \\Z2Rangee Device erkannt.\\Zn \\" >> ${hwtmp} ;; - maxdata) echo " \n\n\n \\Z2Maxdata Device erkannt.\\Zn \\" >> ${hwtmp} ;; - *) echo " \n\n\n \\ZnStandard Device erkannt.\\Zn \\" >> ${hwtmp} ;; - esac - if [[ ${FORMFACTOR} = laptop ]] - then - echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp} - fi - - echo " \" 14 70" >> ${hwtmp} - chmod a+x ${hwtmp} - ${hwtmp} - - # remove tmp file - if [[ -f ${hwtmp} ]] - then - rm ${hwtmp} - fi -} - -dialog_setup_hdd_partitions_manuell() -{ - 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 ]] - then - dialog_setup_hdd_info - setup_hdd_partitions_manuell - fi - fi -} - -dialog_setup_hdd_partitions_auto() -{ - 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 ]] - then - dialog_setup_hdd_info_auto - dialog_setup_hdd_create_partitions - setup_hdd_partitions_auto - fi - fi -} - -run_hardware_detection_disks() -{ - local bootdev - - # all disks but exclude ramdisks - 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 ]] - then - bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" - export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") - fi - export ALL_CDROMS="$(get_hwinfo cdrom)" -} - -dialog_setup_hdd_create_partitions() -{ - 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() +install_meter() { while [[ ${CURRENTLINE} != ${TOTALLINES} ]] do @@ -358,94 +100,53 @@ return 0 } - -dialog_install_bootsector() +mount_rootfs() { - dialog \ - --backtitle "${TITLE}" \ - --infobox "Schreibe den Bootsektor ..." 3 70 + is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" + [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot } -dialog_install_successful() +umount_rootfs() { - dialog \ - --backtitle "${TITLE}" \ - --colors \ - --msgbox "Die Installation war \Z2erfolgreich\Zn." 5 81 + is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot + is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} } -dialog_install_failure() -{ - dialog \ - --backtitle "${TITLE}" \ - --colors \ - --msgbox "Die Installation ist \Z1Fehlgeschlagen\Zn.\n\n\ - Fehler bei ${ERROR}, RetVal: ${RETVAL} \ - " 10 81 -} - -dialog_main() +install_do_reboot() { - METHOD=0 - - 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 + reboot } -################################################# -# Install Komandos # -################################################# run_hardware_detection() { local hwinfo hwinfo="$(hwinfo --bios --storage --pci --gfxcard --sys)" - # check for special devices/clients: - # if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd - local removable=0 - if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] - then - for i in /sys/block/[hs]d*/removable - do - if [[ $(< ${i}) = 1 ]] - then - removable=1 - fi - done - - # only add this for grub legacy, grub2 detect these settings on its own - export GRUBLEGACYOPTS="rootdelay=8" - # there are to zotac types in the wild, nvidia based gfx and intel - if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] - then - export SPECIALDEVICE="zotac_nvidia" - else - export SPECIALDEVICE="zotac_intel" - fi - fi + ## check for special devices/clients: + ## if zotac a zotac and the disk is a removeable device, then add rootdelay to kernelcmd + #local removable=0 + #if [[ ! -z $(echo "${hwinfo}" | grep -i zotac) ]] + #then + #for i in /sys/block/[hs]d*/removable + #do + #if [[ $(< ${i}) = 1 ]] + #then + #removable=1 + #fi + #done + ## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' + + ## only add this for grub legacy, grub2 detect these settings on its own + #export GRUBLEGACYOPTS="rootdelay=8" + ## there are to zotac types in the wild, nvidia based gfx and intel + #if [[ ! -z $(echo "${hwinfo}" | grep -i nouveau) ]] + #then + #export SPECIALDEVICE="zotac_nvidia" + #else + #export SPECIALDEVICE="zotac_intel" + #fi + #fi # check for special devices/clients: # if a rangee and disk ist smaller then 256mb move partion one block further ahead @@ -474,28 +175,32 @@ fi } -hdd_size_below_256mb() +run_hardware_detection_disks() { - local hdd="$1" - local size - local retval - [[ -z ${hdd} ]] && dialog_die "Error: get_hdd_size() no \$hdd given!" + local bootdev - size=$(fdisk -l ${hdd} | grep "Disk.*${hdd}" | sed 's:.*,\ \(.*\)\ byte.*:\1:') - if [[ ${size} -le 257000000 ]] + # all disks but exclude ramdisks + 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 ]] then - retval="0" - else - retval="1" + bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" + export ALL_DISKS=$(echo "${ALL_DISKS}" | grep -v "${bootdev}") fi - - return "${retval}" + export ALL_CDROMS="$(get_hwinfo cdrom)" } setup_hdd_partitions_auto() { ROOTHDD="${HDD}1" + # sanity check - should not happen + if is_mounted --device "${ROOTHDD}" + then + echo "partition: device ${ROOTHDD} is already mounted, umount it" >&2 + umount "${ROOTHDD}" + fi + # run this only if FDISKPARTITIONBELOW256MB is not already 1 if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] then @@ -554,330 +259,281 @@ fi } -setup_hdd_partitions_manuell() +setup_hdd_partitions_manual() { ROOTHDD="${HDD}1" - - ## hdds partitionieren manuell + SWAPHDD="" + BOOTHDD="" cfdisk ${HDD} || dialog_die } setup_hdd_format() { - mke2fs -j -q ${ROOTHDD} || dialog_die -} + # sanity check - should not happen + if is_mounted --device "${ROOTHDD}" + then + echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 + umount "${ROOTHDD}" + fi -install_mount_rootfs() -{ - mount ${ROOTHDD} ${INSTALLROOT} || dialog_die - install -d ${INSTALLROOT}/boot || dialog_die - cd ${INSTALLROOT} || dialog_die + mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die } install_system_image() { + pushd ${INSTALLROOT} > /dev/null tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} + popd > /dev/null } -install_bootsector_chroot() +install_system_settings() { - 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 ]] - then - # needed by grub-mkconfig on the first run - if [[ ! -f ${INSTALLROOT}/boot/grub/video.lst ]] - then - install -m0644 ${INSTALLROOT}/lib/grub/*/video.lst ${INSTALLROOT}/boot/grub/video.lst || dialog_die - fi + local CONFIG - # set kernelopts - if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] - then - sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die - else - echo "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" > ${INSTALLROOT}/etc/conf.d/grub || dialog_die - 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 + # write fstab + CONFIG="${INSTALLROOT}/etc/fstab" + clearconfig + addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" + addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" + addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" - # grub-legacy - else - ### grubconf schreiben - source ${INSTALLROOT}/boot/kernelversion + # install network config skeleton + CONFIG="${INSTALLROOT}/etc/conf.d/net.eth0" + clearconfig + addconfig 'ONBOOT="yes"' + addconfig 'NETWORKING="dhcp"' - #for alx only - if [ -e ${INSTALLROOT}/etc/alx_version ] + # intel framebuffer quirk + if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] + then + if [ -e /proc/fb ] then - OLD_ALXVER="${ALXVER}" - source ${INSTALLROOT}/etc/alx_version - KRNVER="ALX-${ALXVER}" - ALXVER="${OLD_ALXVER}" + if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] + then + 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 fi + fi +} - [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" - [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" - [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" - - # uuid support - if is_uuid_supported - then - my_roothdd="UUID=$(get_uuid ${ROOTHDD})" - else - my_roothdd="${ROOTHDD}" - fi - : > ${grubconf} || dialog_die - echo "default 0" >> ${grubconf} || dialog_die - echo "timeout 3" >> ${grubconf} || dialog_die - # using current root password - echo "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" >> ${grubconf} || dialog_die - - echo >> ${grubconf} || dialog_die - echo "# normal boot" >> ${grubconf} || dialog_die - echo "title ${KRNVER}" >> ${grubconf} || dialog_die - 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 +### installer dialogs ### - echo >> ${grubconf} || dialog_die - echo "# admin boot" >> ${grubconf} || dialog_die - echo "title ${KRNVER} - Re-run hardware-detection" >> ${grubconf} || dialog_die - echo "lock" >> ${grubconf} || dialog_die - echo "root (hd0,0)" >> ${grubconf} || dialog_die - echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" >> ${grubconf} || dialog_die - if is_initrd_supported - then - echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die - fi +dialog_die() +{ + ERROR="$1" + RETVAL="$?" + dialog_install_failure + exit 1 +} - echo >> ${grubconf} || dialog_die - echo "title ${KRNVER} - Reset *all* local settings" >> ${grubconf} || dialog_die - echo "lock" >> ${grubconf} || dialog_die - echo "root (hd0,0)" >> ${grubconf} || dialog_die - echo "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" >> ${grubconf} || dialog_die - if is_initrd_supported - then - echo "initrd /boot/${KRNINITRD}" >> ${grubconf} || dialog_die - fi +dialog_warning() +{ + local retval - # 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 + 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 +} - ## 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 - if [[ ${FORMFACTOR} = laptop ]] +### installer tasks ### + +task_setup_system_menu() +{ + local mode + local retval + + mode="$(dialog_setup_system_menu)" + retval=$? + [[ ${retval} -eq 1 ]] && return 1 + if [[ ${retval} -eq 0 ]] then - OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" + case "${mode}" in + "1") run_install_auto ;; + "2") run_install_normal ;; + "") task_setup_system_menu;; + esac fi +} - # install an appropriate uvesafb.conf - install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die - echo "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" > ${INSTALLROOT}/etc/modprobe.d/uvesafb.conf || dialog_die +task_hardware_detection() +{ + local message - # install an appropriate viafb.conf - echo "options viafb viafb_mode=1024x768 viafb_refresh=60" > ${INSTALLROOT}/etc/modprobe.d/viafb.conf || dialog_die + run_hardware_detection_disks - # install an appropriate i810fb.conf - 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 + message+=$"Harddrives:\n" - 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 + if [[ ! -z ${ALL_DISKS} ]] + then + for i in ${ALL_DISKS} + do + message+="\Z3${i}\Zn " + done + message+="\n" + fi - ## enters 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 -} + 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 -is_uuid_supported() -{ - if [[ -x $(type -P busybox.mkinitrd) ]] + # 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 - # only detect uuids if supported - if [[ ! -z $(busybox.mkinitrd | grep blkid) ]] - then - return 0 - fi + message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" fi - return 1 + messagebox -y 12 -h $"Detected hardware:" "${message}" } -get_uuid() +task_setup_hdd_partitions_manual() { - local UUID - local SEC_TYPE - local TYPE - - local dev="$1" - [[ -z ${dev} ]] && dialog_die "no dev given" + local i + local retval - # check if given device is already an UUID - if [[ ${dev/UUID=/}x != ${dev}x ]] + if [[ -z ${ALL_DISKS} ]] then - eval "${dev}" + dialog_no_harddrive_found + exit 1 else - eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //') + HDD=$(dialog_select_target_harddrive) + retval=$? + [[ ${retval} -eq 1 ]] && return 1 + if [[ ${retval} -eq 0 ]] + then + dialog_setup_hdd_info + setup_hdd_partitions_manual + fi fi - echo "${UUID}" } -install_system_settings() +task_setup_hdd_partitions_auto() { - # schreibe fstab - if is_uuid_supported - then - echo -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die - else - echo -e "${ROOTHDD}\t/\t${FORMAT_FILESYSTEM}\tnoatime\t0 0" >> ${INSTALLROOT}/etc/fstab || dialog_die - 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 - - # install network config skeleton - install -m0644 ${INSTALLROOT}/etc/alxconfig-ng/skel/net/net.eth0 ${INSTALLROOT}/etc/conf.d/ || dialog_die + local i + local retval - # intel framebufer quirk - if [[ -e /proc/fb ]] + if [[ -z ${ALL_DISKS} ]] then - if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] + dialog_no_harddrive_found + exit 1 + else + HDD=$(dialog_select_target_harddrive) + retval=$? + [[ ${retval} -eq 1 ]] && return 1 + if [[ ${retval} -eq 0 ]] then - 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 + dialog_setup_hdd_info_auto + dialog_setup_hdd_create_partitions + setup_hdd_partitions_auto fi fi } -install_umount_rootfs() +task_main() { - cd / - umount ${INSTALLROOT}/boot || dialog_die - umount ${INSTALLROOT} || dialog_die -} + local method=0 + local retval -install_do_reboot() -{ - reboot + 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") task_hardware_detection ;; + "3") install_do_reboot ;; + "4") /bin/bash --login -i ;; + esac + fi + done } -################################################# -# Install Ablauf Scripte # -################################################# - run_install_normal() { - dialog_hardware_detection + task_hardware_detection - dialog_setup_hdd_partitions_manuell + task_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 + 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 - install_initrd_chroot + if is_initrd_supported + then + dialog_install_initrd + initrd_config + initrd_install + fi dialog_install_bootsector - install_bootsector_chroot + bootloader_config + bootloader_install - install_umount_rootfs + umount_rootfs dialog_install_successful } run_install_auto() { - dialog_hardware_detection + task_hardware_detection - dialog_setup_hdd_partitions_auto + task_setup_hdd_partitions_auto 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 + 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 - install_initrd_chroot + if is_initrd_supported + then + dialog_install_initrd + initrd_config + initrd_install + fi dialog_install_bootsector - install_bootsector_chroot + bootloader_config + bootloader_install - install_umount_rootfs + umount_rootfs dialog_install_successful } # set some proper traps trap "trap_exit" SIGINT SIGQUIT -dialog_main +task_main exit 0