--- trunk/installer-simple/bin/installer.sh.in 2014/01/08 10:21:09 2477 +++ trunk/installer-simple/bin/installer.sh.in 2015/07/31 10:53:19 2888 @@ -9,7 +9,6 @@ # setup locales TEXTDOMAIN=installer -LC_MESSAGES=C # include dir INSTALLER_LIBDIR="%LIBDIR%" @@ -41,27 +40,13 @@ fi done -# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! -# -> now in images.conf -CDIMAGENAME="" -TOTALLINES="" -CURRENTLINE=0 -if [ -e /mnt/cdrom/system/images.conf ] -then - source /mnt/cdrom/system/images.conf - # check if all required variables are set - [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in /mnt/cdrom/system/images.conf" - [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in /mnt/cdrom/system/images.conf" -else - die "/mnt/cdrom/system/images.conf not found" -fi - ### System/Config Version VERSION="%VERSIONTAG%" TITLE="${DEFAULT_TITLE} - ${VERSION}" # some sane defaults -CDROOT="${DEFAULT_CDROOT}" +LIVEROOT="${DEFAULT_LIVEROOT}" +IMAGEROOT="${DEFAULT_IMAGEROOT}" INSTALLROOT="${DEFAULT_INSTALLROOT}" KERNELPKG="${DEFAULT_KERNELPKG}" KERNELOPTS="${DEFAULT_KERNELOPTS}" @@ -72,9 +57,22 @@ FORMFACTOR="${DEFAULT_FORMFACTOR}" FORMAT_FILESYSTEM="${DEFAULT_FILESYSTEM}" -################################################# -# DIALOG BOXEN # -################################################# +# TOTALLINES=linecount of ${CDIMAGENAME}-tarball -1 ! +# -> now in images.conf +CDIMAGENAME="" +TOTALLINES="" +CURRENTLINE=0 +if [ -e ${IMAGEROOT}/images.conf ] +then + source ${IMAGEROOT}/images.conf + # check if all required variables are set + [[ -z ${CDIMAGENAME} ]] && die "CDIMAGENAME is empty in ${IMAGEROOT}/images.conf" + [[ -z ${TOTALLINES} ]] && die "TOTALLINES is empty in ${IMAGEROOT}/images.conf" +else + die "${IMAGEROOT}/images.conf not found" +fi + +### helper scripts ### trap_exit() { @@ -88,201 +86,97 @@ exit 1 } -dialog_die() -{ - ERROR="$1" - RETVAL="$?" - dialog_install_failure - exit 1 -} - -dialog_warning() +install_meter() { - 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 + while [[ ${CURRENTLINE} != ${TOTALLINES} ]] + do + CURRENTLINE=$(grep -c . /tmp/install.log) + PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) + echo ${PERCENT} + sleep 1 + done + rm -f /tmp/install.log + return 0 } -task_setup_system_menu() +mount_rootfs() { - local mode local retval - mode="$(dialog_setup_system_menu)" - retval=$? - [[ ${retval} -eq 1 ]] && return 1 - if [[ ${retval} -eq 0 ]] + if [[ -n ${SWAPHDD} ]] then - case "${mode}" in - "1") run_install_auto ;; - "2") run_install_normal ;; - "") task_setup_system_menu;; - esac + swapon ${SWAPHDD} || dialog_die $"Could not enable swap space '${SWAPHDD}'" fi -} - -dialog_hardware_detection() -{ - local message - - run_hardware_detection_disks - - message+=$"Harddrives:\n" - if [[ ! -z ${ALL_DISKS} ]] - then - for i in ${ALL_DISKS} - do - message+="\Z3${i}\Zn " - done - message+="\n" - fi - - 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 - - # 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 ]] + if [[ -n ${ROOTHDD} ]] then - message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" + if is_mounted --location "${INSTALLROOT}" + then + echo $"${INSTALLROOT} already mounted" >&2 + else + mount -t "${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" "${INSTALLROOT}" || dialog_die $"Could not mount rootfs - drive '${ROOTHDD}' -> '${INSTALLROOT}'" + fi fi - messagebox -y 12 -h $"Detected hardware:" "${message}" -} - -dialog_setup_hdd_partitions_manual() -{ - local i - local retval + [[ -d ${INSTALLROOT}/boot ]] || install -d ${INSTALLROOT}/boot - if [[ -z ${ALL_DISKS} ]] + if [[ -n ${BOOTHDD} ]] then - dialog_no_harddrive_found - exit 1 - else - HDD=$(dialog_select_target_harddrive) - retval=$? - [[ ${retval} -eq 1 ]] && return 1 - if [[ ${retval} -eq 0 ]] + if is_mounted --location "${INSTALLROOT}"/boot then - dialog_setup_hdd_info - setup_hdd_partitions_manual + echo $"${INSTALLROOT}/boot already mounted" >&2 + else + mount -t "${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" "${INSTALLROOT}"/boot || dialog_die $"Could not mount bootfs - drive '${BOOTHDD}' -> '${INSTALLROOT}/boot'" fi fi } -dialog_setup_hdd_partitions_auto() +umount_rootfs() { - local i - local retval + is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot + is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} - if [[ -z ${ALL_DISKS} ]] + if [[ -n ${SWAPHDD} ]] then - dialog_no_harddrive_found - exit 1 - else - 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 - setup_hdd_partitions_auto - fi + swapoff ${SWAPHDD} || die fi } -install_meter() -{ - while [[ ${CURRENTLINE} != ${TOTALLINES} ]] - do - CURRENTLINE=$(grep -c . /tmp/install.log) - PERCENT=$(( ${CURRENTLINE} * 100 / ${TOTALLINES})) - echo ${PERCENT} - sleep 1 - done - rm -f /tmp/install.log - return 0 -} - -task_main() +install_do_reboot() { - local method=0 - local retval - - 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") 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 + # 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 + # if [[ $(< ${i}) = 1 ]] + # then + # removable=1 + # fi #done - ## smartcard = udevadm info -n /dev/sda -a | grep -i 'configuration.*card' + # 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 + # 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 @@ -318,51 +212,59 @@ # 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 ]] + if [[ $(grep '[[:space:]]${LIVEROOT}[[:space:]]' /proc/mounts | cut -d' ' -f3) != iso9660 ]] then - bootdev="$(grep '[[:space:]]/mnt/cdrom[[:space:]]' /proc/mounts | cut -d' ' -f1 | sed 's:[0-9]::g')" + bootdev=$(grep "[[:space:]]${LIVEROOT}[[: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)" } -setup_hdd_partitions_auto() +setup_hdd_partitions() { - 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 ]] + if [[ -n ${BOOTHDD} ]] then - if hdd_size_below_256mb ${HDD} + if is_mounted --device "${BOOTHDD}" then - FDISKPARTIONBELOW256MB=1 - else - FDISKPARTIONBELOW256MB=0 + echo "partition: device ${BOOTHDD} is already mounted, umount it" >&2 + umount "${BOOTHDD}" fi fi - ## delete disk - dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die - - if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] + if [[ ${INSTALL_METHOD} = auto ]] then - ## setup one bootable partition - #1. n= new disk - #2. p= primary disk - #3. 1= first partition - #4. 2= default sector start // small disk needs more space for grub2 mbr sector - #5. ''= defaul sector end - #6. a= bootable flag - #7. 1= boot flag for partition 1 - #8. w= write/quit - fdisk ${HDD} &> /dev/null << EOF + # run this only if FDISKPARTITIONBELOW256MB is not already 1 + if [[ ${FDISKPARTIONBELOW256MB} != 1 ]] + then + if device_minimum_size "${HDD}" 256 + then + FDISKPARTIONBELOW256MB=1 + else + FDISKPARTIONBELOW256MB=0 + fi + fi + + ## delete disk + dd if=/dev/zero of=${HDD} count=1 &> /dev/null || dialog_die + + if [[ ${FDISKPARTIONBELOW256MB} = 1 ]] + then + ## setup one bootable partition + #1. n= new disk + #2. p= primary disk + #3. 1= first partition + #4. 2= default sector start // small disk needs more space for grub2 mbr sector + #5. ''= defaul sector end + #6. a= bootable flag + #7. 1= boot flag for partition 1 + #8. w= write/quit + fdisk ${HDD} &> /dev/null << EOF n p 1 @@ -372,17 +274,17 @@ 1 w EOF - else - ## setup one bootable partition - #1. n= new disk - #2. p= primary disk - #3. 1= first partition - #4. ''= default sector start - #5. ''= defaul sector end - #6. a= bootable flag - #7. 1= boot flag for partition 1 - #8. w= write/quit - fdisk ${HDD} &> /dev/null << EOF + else + ## setup one bootable partition + #1. n= new disk + #2. p= primary disk + #3. 1= first partition + #4. ''= default sector start + #5. ''= defaul sector end + #6. a= bootable flag + #7. 1= boot flag for partition 1 + #8. w= write/quit + fdisk ${HDD} &> /dev/null << EOF n p 1 @@ -392,198 +294,58 @@ 1 w EOF + fi + else + cfdisk ${HDD} || dialog_die fi } -setup_hdd_partitions_manual() -{ - ROOTHDD="${HDD}1" - SWAPHDD="" - BOOTHDD="" - cfdisk ${HDD} || dialog_die -} - setup_hdd_format() { - # sanity check - should not happen - if is_mounted --device "${ROOTHDD}" - then - echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 - umount "${ROOTHDD}" - fi - - mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die -} - -install_mount_rootfs() -{ - is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" - install -d ${INSTALLROOT}/boot || dialog_die -} - -install_system_image() -{ - pushd ${INSTALLROOT} > /dev/null - tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} - popd > /dev/null -} - -disabled_install_bootsector_chroot() -{ - local my_roothdd - local grubconf="${INSTALLROOT}/boot/grub/grub.conf" - local grub2conf="/boot/grub/grub.cfg" + install -d /tmp + :> /tmp/format.log - # check for grub2 - if [[ -f ${INSTALLROOT}/sbin/grub-mkconfig ]] + if [[ -n ${SWAPHDD} ]] 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 - - # set kernelopts - if [[ -f ${INSTALLROOT}/etc/conf.d/grub ]] + # sanity check - should not happen + if is_mounted --device "${SWAPHDD}" then - sed -i "s:^\(export GRUB_CMDLINE_LINUX_DEFAULT=\).*:\1\"${KERNELOPTS}\":" ${INSTALLROOT}/etc/conf.d/grub || dialog_die - else - CONFIG="${INSTALLROOT}/etc/conf.d/grub" - clearconfig - addconfig "export GRUB_CMDLINE_LINUX_DEFAULT=\"${KERNELOPTS}\"" - fi - CONFIG="${INSTALLROOT}/root/.installrc" - clearconfig - # only grub 1.99 - addconfig 'type -P grub-mkdevicemap && grub-mkdevicemap' - addconfig "grub-install --no-floppy ${HDD} &> /dev/null" - addconfig "LC_ALL=C grub-mkconfig -o ${grub2conf} &> /dev/null" - addconfig "exit 0" - - # grub-legacy - else - source ${INSTALLROOT}/boot/kernelversion - - if [ -e ${INSTALLROOT}/etc/alx_version ] - then - OLD_ALXVER="${ALXVER}" - source ${INSTALLROOT}/etc/alx_version - KRNVER="ALX-${ALXVER}" - ALXVER="${OLD_ALXVER}" + echo "format: device ${SWAPHDD} is already mounted, umount it" >&2 + umount "${SWAPHDD}" fi + mkswap ${SWAPHDD} || die + fi - [[ -z ${KRNVER} ]] && KRNVER="AutoSta_LX" - [[ -z ${KRNINITRD} ]] && KRNINITRD="initrd" - [[ -z ${KRNIMG} ]] && KRNIMG="vmlinuz" - - # uuid support - my_roothdd="UUID=$(get_uuid ${ROOTHDD})" - - CONFIG="${grubconf}" - clearconfig - addconfig "default 0" - addconfig "timeout 3" - # using current root password - addconfig "password --md5 $(cat ${INSTALLROOT}/etc/shadow | grep root | cut -d: -f2)" - - addconfig - addconfig "# normal boot" - addconfig "title ${KRNVER}" - addconfig "root (hd0,0)" - addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS}" - if is_initrd_supported + if [[ -n ${BOOTHDD} ]] + then + # sanity check - should not happen + if is_mounted --device "${BOOTHDD}" then - addconfig "initrd /boot/${KRNINITRD}" + echo "format: device ${BOOTHDD} is already mounted, umount it" >&2 + umount "${BOOTHDD}" fi - addconfig - addconfig "# admin boot" - addconfig "title ${KRNVER} - Re-run hardware-detection" - addconfig "lock" - addconfig "root (hd0,0)" - addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} hardware-auto-detection" - if is_initrd_supported - then - addconfig "initrd /boot/${KRNINITRD}" - fi + mkfs."${FORMAT_FILESYSTEM_BOOTHDD}" "${BOOTHDD}" &>> /tmp/format.log || dialog_die + fi - addconfig - addconfig "title ${KRNVER} - Reset *all* local settings" - addconfig "lock" - addconfig "root (hd0,0)" - addconfig "kernel /boot/${KRNIMG} root=${my_roothdd} ${KERNELOPTS} ${GRUBLEGACYOPTS} alx-reset-settings" - if is_initrd_supported + if [[ -n ${ROOTHDD} ]] + then + # sanity check - should not happen + if is_mounted --device "${ROOTHDD}" then - addconfig "initrd /boot/${KRNINITRD}" + echo "format: device ${ROOTHDD} is already mounted, umount it" >&2 + umount "${ROOTHDD}" fi - # 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 + mkfs."${FORMAT_FILESYSTEM_ROOTHDD}" "${ROOTHDD}" &>> /tmp/format.log || dialog_die fi +} - # run installrc - chrooted /bin/bash --rcfile /root/.installrc -i - rm ${INSTALLROOT}/root/.installrc -} - -disabled_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 ]] - then - OTHERMODS="acpi-cpufreq cpufreq_ondemand cpufreq_conservative cpufreq_powersave" - fi - - # install an appropriate uvesafb.conf - install -d ${INSTALLROOT}/etc/modprobe.d || dialog_die - CONFIG="${INSTALLROOT}/etc/modprobe.d/uvesafb.conf" - clearconfig - addconfig "options uvesafb mode_option=1024x768-32@60 scroll=ywrap" - - # install an appropriate viafb.conf - CONFIG="${INSTALLROOT}/etc/modprobe.d/viafb.conf" - clearconfig - addconfig "options viafb viafb_mode=1024x768 viafb_refresh=60" - - # install an appropriate i810fb.conf - CONFIG="${INSTALLROOT}/etc/modprobe.d/i810fb.conf" - clearconfig - addconfig "options i810fb xres=1024 yres=768 bpp=16 mtrr=1 hsync1=30 hsync2=62 vsync1=30 vsync2=60" - - 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 - - # run installrc - chrooted /bin/bash --rcfile /root/.installrc -i - rm ${INSTALLROOT}/root/.installrc +install_system_image() +{ + pushd ${INSTALLROOT} > /dev/null + tar xvjpf ${IMAGEROOT}/${CDIMAGENAME} -C ${INSTALLROOT} + popd > /dev/null } install_system_settings() @@ -593,7 +355,18 @@ # write fstab CONFIG="${INSTALLROOT}/etc/fstab" clearconfig - addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM}\tnoatime,noauto\t1 1" + if [[ -n ${BOOTHDD} ]] + then + addconfig -e "UUID=$(get_uuid ${BOOTHDD})\t/\t${FORMAT_FILESYSTEM_BOOTHDD}\tnoatime\t1 1" + fi + if [[ -n ${ROOTHDD} ]] + then + addconfig -e "UUID=$(get_uuid ${ROOTHDD})\t/\t${FORMAT_FILESYSTEM_ROOTHDD}\tnoatime\t0 0" + fi + if [[ -n ${SWAPHDD} ]] + then + addconfig -e "UUID='$(get_uuid ${SWAPHDD})'\tswap\tswap\tpri=1\t0 0" + fi addconfig -e "proc\t/proc\tproc\tdefaults\t0 0" addconfig -e "shm\t/dev/shm\ttmpfs\tdefaults\t0 0" @@ -604,73 +377,198 @@ addconfig 'NETWORKING="dhcp"' # intel framebuffer quirk - if [ -e ${INSTALLROOT}/etc/splash/splash.conf ] + CONFIG="${INSTALLROOT}/etc/splash/splash.conf" + if [ -e ${CONFIG} ] && [ -e /proc/fb ] then - if [ -e /proc/fb ] + if [[ ! -z $(grep 'inteldrmfb' /proc/fb) ]] then - 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 + fbdev=$(grep 'inteldrmfb' /proc/fb | sed 's:\([0-9]\).*:\1:') + [[ ${fbdev} != 0 ]] && sed -i "s:^\(SPLASH_DEV=\).*:\1\"/dev/fb${fbdev}\":" ${CONFIG} || dialog_die fi fi } -install_umount_rootfs() + +### installer dialogs ### + +dialog_die() { - is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot - is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} + ERROR="$1" + RETVAL="$?" + dialog_install_failure + exit 1 } -install_do_reboot() +dialog_warning() { - reboot + 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 } -################################################# -# Install Ablauf Scripte # -################################################# -run_install_normal() +### installer tasks ### + +task_setup_system_menu() { - dialog_hardware_detection + local mode + local retval - 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 | install_meter | dialog_install_system_image + mode="$(dialog_setup_system_menu)" + retval=$? + [[ ${retval} -eq 1 ]] && return 1 + if [[ ${retval} -eq 0 ]] + then + case "${mode}" in + "1") run_install auto ;; + "2") run_install normal ;; + "") task_setup_system_menu;; + esac + fi +} - dialog_install_settings - sleep 1 - install_system_settings - if is_initrd_supported +task_hardware_detection() +{ + local message + + run_hardware_detection_disks + + message+=$"Harddrives:\n" + + if [[ ! -z ${ALL_DISKS} ]] then - dialog_install_initrd - initrd_config - initrd_install + for i in ${ALL_DISKS} + do + message+="\Z3${i}\Zn " + done + message+="\n" fi - dialog_install_bootsector - bootloader_config - bootloader_install + 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 - install_umount_rootfs - dialog_install_successful + # 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 + message+=$"\n\ZnFormfactor Laptop, activating 'ondemand' powersaving mode.\Zn" + fi + + messagebox -y 12 -h $"Detected hardware:" "${message}" +} + +task_setup_hdd_partitions() +{ + local i + local retval + + if [[ -z ${ALL_DISKS} ]] + then + dialog_no_harddrive_found + exit 1 + else + HDD=$(dialog_select_target_harddrive) + retval=$? + [[ ${retval} -eq 1 ]] && return 1 + if [[ ${retval} -eq 0 ]] + then + dialog_setup_hdd_info + setup_hdd_partitions + fi + fi } -run_install_auto() +task_main() { - dialog_hardware_detection + local method=0 + local retval + + 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 +} + +run_install() +{ + local method="$1" + + task_hardware_detection + + case "${method}" in + auto) + export BOOTHDD="" + export SWAPHDD="" + export ROOTHDD="${HDD}1" + export FORMAT_FILESYSTEM_BOOTHDD="" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" + export INSTALL_METHOD="${method}" + ;; + normal) + export BOOTHDD="${HDD}1" + export SWAPHDD="${HDD}2" + export ROOTHDD="${HDD}3" + export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" + export INSTALL_METHOD="${method}" + ;; + single) + export BOOTHDD="" + export SWAPHDD="" + export ROOTHDD="${HDD}1" + export FORMAT_FILESYSTEM_BOOTHDD="" + export FORMAT_FILESYSTEM_ROOTHDD="${FORMAT_FILESYSTEM}" + export INSTALL_METHOD="${method}" + ;; + flash) + export BOOTHDD="${HDD}1" + export SWAPHDD="" + export ROOTHDD="${HDD}2" + export FORMAT_FILESYSTEM_BOOTHDD="${FORMAT_FILESYSTEM}" + export FORMAT_FILESYSTEM_ROOTHDD="f2fs" + export INSTALL_METHOD="${method}" + ;; + *) + die "Unknown install method '${method}', aborting." + ;; + esac - dialog_setup_hdd_partitions_auto + task_setup_hdd_partitions dialog_setup_hdd_format setup_hdd_format > /dev/null - install_mount_rootfs + mount_rootfs (install_system_image > /tmp/install.log) 2> /tmp/install_errors.log | install_meter | dialog_install_system_image dialog_install_settings @@ -687,7 +585,7 @@ bootloader_config bootloader_install - install_umount_rootfs + umount_rootfs dialog_install_successful }