--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 13:29:00 2410 +++ 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} ] @@ -110,50 +112,33 @@ { 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 + 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\/}" - 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 + messagebox -h $"[ Harddrive partitioning ]" \ + $"\Z1Warning!\Zn\n\nAll data on disk [ \Z3${HDD}\Zn ] will be erased!" } dialog_setup_system_menu() { - local i + local mode + local retval - 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 ]] + mode=$(menubox -h $"[ Harddrive partitioning ]" $"\nSelect an installation mode" \ + $"1:Automatic setup (recommended)" \ + ":" \ + $":\Z1Expert modes:\Zn" \ + $"2:Common IDE-disk (manual setup)") + retval=$? + [[ ${retval} -eq 1 ]] && return 1 + if [[ ${retval} -eq 0 ]] then - case "${i}" in + case "${mode}" in "1") run_install_auto ;; "2") run_install_normal ;; "") dialog_setup_system_menu;; @@ -163,102 +148,65 @@ dialog_hardware_detection() { - local i - local hwtmp - - if [ -x $(type -P mktemp) ] - then - hwtmp="$(mktemp)" - else - hwtmp="/tmp/hwtmp.sh" - fi + local message 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} + message+=$"Harddrives:\n" if [[ ! -z ${ALL_DISKS} ]] then for i in ${ALL_DISKS} do - echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} + message+="\Z3${i}\Zn " done + message+="\n" fi if [[ ! -z ${ALL_CDROMS} ]] then - echo " \n \\" >> ${hwtmp} - echo " CDROM Laufwerke:\n \\" >> ${hwtmp} + message+="\n" + message+=$"Optical disk drives:\n" for i in ${ALL_CDROMS} do - echo " \\Z3${i}\\Zn\n \\" >> ${hwtmp} + message+="\Z3${i}\Zn" done + message+="\n" 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} ;; + 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 - echo " \n \\ZnFormfactor Laptop, Powersave Modus 'ondemand' wird aktiviert.\\Zn \\" >> ${hwtmp} + message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" fi - echo " \" 14 70" >> ${hwtmp} - chmod a+x ${hwtmp} - ${hwtmp} - - # remove tmp file - if [[ -f ${hwtmp} ]] - then - rm ${hwtmp} - fi + messagebox -y 15 -h $"Detected hardware:" "${message}" } -dialog_setup_hdd_partitions_manuell() +dialog_setup_hdd_partitions_manual() { 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 - setup_hdd_partitions_manuell + setup_hdd_partitions_manual fi fi } @@ -266,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 @@ -302,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 @@ -358,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 ;; @@ -423,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 @@ -474,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" @@ -554,11 +427,11 @@ fi } -setup_hdd_partitions_manuell() +setup_hdd_partitions_manual() { ROOTHDD="${HDD}1" - ## hdds partitionieren manuell + ## hdds partitionieren manual cfdisk ${HDD} || dialog_die } @@ -835,15 +708,16 @@ { dialog_hardware_detection - dialog_setup_hdd_partitions_manuell + dialog_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 + (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 @@ -861,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