--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 13:43:24 2418 +++ trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:14:23 2430 @@ -27,6 +27,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} ] @@ -191,34 +193,17 @@ dialog_setup_hdd_partitions_manual() { local i + local retval if [[ -z ${ALL_DISKS} ]] then - dialog \ - --backtitle "${TITLE}" \ - --ok-label "Beenden" \ - --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70 + dialog_no_harddrive_found 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 ${ALL_DISKS} - 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 ]] + HDD=$(dialog_select_target_harddrive) + retval=$? + [[ ${retval} -eq 1 ]] && return 1 + if [[ ${retval} -eq 0 ]] then dialog_setup_hdd_info setup_hdd_partitions_manual @@ -229,34 +214,17 @@ dialog_setup_hdd_partitions_auto() { local i + local retval - if [[ -z ${installdevs} ]] + if [[ -z ${ALL_DISKS} ]] then - dialog \ - --backtitle "${TITLE}" \ - --ok-label "Beenden" \ - --msgbox "Kein geeignetes Laufwerk gefunden.\nDie Installation ist fehlgeschlagen." 6 70 + dialog_no_harddrive_found 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 ]] + 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 @@ -265,50 +233,7 @@ 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 @@ -321,53 +246,23 @@ 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() { - METHOD=0 + local method=0 + local retval - while [[ ${METHOD} -le 2 ]] + 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 ]] + method=$(menubox $"Configuration:" \ + $"1:Install system" \ + $"2:Show detected harddrives" \ + $"3:Exit and reboot" \ + $"4:Exit and drop into a shell") + retval=$? + [[ ${retval} -eq 1 ]] && exit 1 + if [[ ${retval} -eq 0 ]] then - case ${METHOD} in + case ${method} in "1") dialog_setup_system_menu ;; "2") dialog_hardware_detection ;; "3") install_do_reboot ;; @@ -386,29 +281,29 @@ 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 + + ## 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 @@ -437,6 +332,21 @@ 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)" +} + hdd_size_below_256mb() { local hdd="$1" @@ -802,11 +712,12 @@ 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 + (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 + dialog_install_initrd install_initrd_chroot dialog_install_bootsector @@ -824,11 +735,12 @@ 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 + (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 + dialog_install_initrd install_initrd_chroot dialog_install_bootsector