--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:14:23 2430 +++ trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:30:19 2438 @@ -293,6 +293,7 @@ #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" @@ -369,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 @@ -430,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() @@ -553,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 } @@ -613,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 } @@ -638,25 +642,6 @@ return 1 } -get_uuid() -{ - local UUID - local SEC_TYPE - local TYPE - - local dev="$1" - [[ -z ${dev} ]] && dialog_die "no dev given" - - # check if given device is already an UUID - if [[ ${dev/UUID=/}x != ${dev}x ]] - then - eval "${dev}" - else - eval $(busybox.mkinitrd blkid ${dev} | grep "${dev}:" | sed 's/.*:\ //') - fi - echo "${UUID}" -} - install_system_settings() { # schreibe fstab @@ -690,9 +675,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()