--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:09:01 2427 +++ trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:28:13 2437 @@ -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} ] @@ -231,21 +233,6 @@ 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)" -} - install_meter() { while [[ ${CURRENTLINE} != ${TOTALLINES} ]] @@ -294,29 +281,30 @@ 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 @@ -345,6 +333,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" @@ -367,6 +370,13 @@ { 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 @@ -428,26 +438,34 @@ setup_hdd_partitions_manual() { ROOTHDD="${HDD}1" - - ## hdds partitionieren manual + 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 + + mkfs."${FORMAT_FILESYSTEM}" -q "${ROOTHDD}" || dialog_die } install_mount_rootfs() { - mount ${ROOTHDD} ${INSTALLROOT} || dialog_die + is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" install -d ${INSTALLROOT}/boot || dialog_die - cd ${INSTALLROOT} || dialog_die } install_system_image() { + pushd ${INSTALLROOT} > /dev/null tar xvjpf ${CDROOT}/system/${CDIMAGENAME} -C ${INSTALLROOT} + popd > /dev/null } install_bootsector_chroot() @@ -551,14 +569,8 @@ CHROOTEOF 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 + # run installrc + chrooted /bin/bash --rcfile /root/.installrc -i rm ${INSTALLROOT}/root/.installrc } @@ -611,14 +623,8 @@ exit 0 CHROOTEOF - ## 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 + # run installrc + chrooted /bin/bash --rcfile /root/.installrc -i rm ${INSTALLROOT}/root/.installrc } @@ -688,9 +694,8 @@ install_umount_rootfs() { - cd / - umount ${INSTALLROOT}/boot || dialog_die - umount ${INSTALLROOT} || dialog_die + is_mounted --location ${INSTALLROOT}/boot && umount ${INSTALLROOT}/boot + is_mounted --location ${INSTALLROOT} && umount ${INSTALLROOT} } install_do_reboot()