--- trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:20:31 2434 +++ trunk/installer-simple/bin/installer.sh.in 2014/01/07 14:25:34 2436 @@ -370,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 @@ -438,12 +445,19 @@ 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() { - mount ${ROOTHDD} ${INSTALLROOT} || dialog_die + is_mounted --location "${INSTALLROOT}" || mount "${ROOTHDD}" "${INSTALLROOT}" install -d ${INSTALLROOT}/boot || dialog_die } @@ -555,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 } @@ -615,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 } @@ -692,8 +694,8 @@ install_umount_rootfs() { - 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()