--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 13:16:16 2401 +++ trunk/installer-simple/bin/installer.sh.in 2014/01/07 13:43:24 2418 @@ -23,7 +23,11 @@ } # load common includes -for inc in %SYSCONFDIR%/installer.conf +for inc in %SYSCONFDIR%/installer.conf \ + ${INSTALLER_LIBDIR}/functions/common.sh \ + ${INSTALLER_LIBDIR}/functions/common-dialogs.sh \ + ${INSTALLER_LIBDIR}/functions/hwdetection.sh \ + ${INSTALLER_LIBDIR}/functions/installer-dialogs.sh do if [ -e ${inc} ] then @@ -48,37 +52,38 @@ die "/mnt/cdrom/system/images.conf not found" fi -# includes -source ${INSTALLER_LIBDIR}/functions/hwdetection.sh - ### System/Config Version VERSION="%VERSIONTAG%" TITLE="${DEFAULT_TITLE} - ${VERSION}" +# some sane defaults CDROOT="${DEFAULT_CDROOT}" INSTALLROOT="${DEFAULT_INSTALLROOT}" - -# standard kernel opts -KERNELOPTS="quiet video=1024x768" - -# grub options +KERNELPKG="${DEFAULT_KERNELPKG}" +KERNELOPTS="${DEFAULT_KERNELOPTS}" GRUBLEGACYOPTS="" GRUB2OPTS="" - -# fdisk options FDISKPARTIONBELOW256MB=0 - -# default specialdevices SPECIALDEVICE="" -FORMFACTOR="desktop" - -# target filesystem +FORMFACTOR="${DEFAULT_FORMFACTOR}" FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" ################################################# # DIALOG BOXEN # ################################################# +trap_exit() +{ + is_mounted --location "${INSTALLROOT}/dev" && umount ${INSTALLROOT}/dev + is_mounted --location "${INSTALLROOT}/proc" && umount ${INSTALLROOT}/proc + is_mounted --location "${INSTALLROOT}/sys" && umount ${INSTALLROOT}/sys + is_mounted --location "${INSTALLROOT}/boot" && umount ${INSTALLROOT}/boot + is_mounted --location "${INSTALLROOT}" && umount ${INSTALLROOT} + + echo $"Installation aborted." + exit 1 +} + dialog_die() { ERROR="$1" @@ -103,52 +108,35 @@ dialog_setup_hdd_info() { - local SHDD="$(echo $HDD | sed 's/\/dev\///')" + 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="$(echo $HDD | sed 's/\/dev\///')" + 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;; @@ -158,73 +146,53 @@ 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 - if [[ -z ${installdevs} ]] + if [[ -z ${ALL_DISKS} ]] then dialog \ --backtitle "${TITLE}" \ @@ -240,7 +208,7 @@ echo "--stdout \\" >> /tmp/hddtmp.sh echo "--menu \"Installations Laufwerk auswaehlen:\" 10 70 3 \\" >> /tmp/hddtmp.sh - for i in ${installdevs} + for i in ${ALL_DISKS} do echo "\"${i}\" \"\" \\" >> /tmp/hddtmp.sh done @@ -253,7 +221,7 @@ if [[ ${RES} -eq 0 ]] then dialog_setup_hdd_info - setup_hdd_partitions_manuell + setup_hdd_partitions_manual fi fi } @@ -549,11 +517,11 @@ fi } -setup_hdd_partitions_manuell() +setup_hdd_partitions_manual() { ROOTHDD="${HDD}1" - ## hdds partitionieren manuell + ## hdds partitionieren manual cfdisk ${HDD} || dialog_die } @@ -830,7 +798,7 @@ { 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 @@ -870,6 +838,9 @@ dialog_install_successful } +# set some proper traps +trap "trap_exit" SIGINT SIGQUIT + dialog_main exit 0